Hi Benj. I have a project that I would like to add a bootloader to. The PIC device dials in to my PC. Without having to monitor the connection I would like to have the device dial in, check to see if there is a newer version of firmware and if so automatically down load and update its self. I had a look at the Tiny bootloader. I saw this statement below:
"If a filename is specified as a command line parameter, it will automatically try to write it;" Does this mean that the Tiny PC program listens on the serial port and if it get a connection from the device it will automatically start the process to upload the new file. If not, could you advise me on how I might go about accomplishing an untended unmonitored file update using the Tiny bootloader? If the statement listed above is corrent in that the software can perform and unattend file upload. Could you explain how to specified a filename as a command line parameter. Could you give and example?
Thanks in advance.
Ondra
Remote firmware update
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: Remote firmware update
Hello Ondra
I gave an example of how to use the Tiny bootloader in another topic of this forum.
For the bootloader to work it requires a reset to allow it to go into bootloader mode and allow programming.
To do this in a automatic way you could do simething like this. When you are ready to send updated firmware to the device first transmit a byte or number of bytes from the PC to the PIC. When the PIC receives this byte or specific series of bytes it knows it is suppost to reset to enter bootloader mode. To manually reset the devices one way would be to enable the watchdog timer in the configuration and to stop clearing the watchdog timer when you have received the command to reset. Another way would be to use a transistor etc driven from an output pin to manually pull the MCLR pin low.
Once you have restarted the device the bootloader will kick in and your program will be transferred.
I gave an example of how to use the Tiny bootloader in another topic of this forum.
For the bootloader to work it requires a reset to allow it to go into bootloader mode and allow programming.
To do this in a automatic way you could do simething like this. When you are ready to send updated firmware to the device first transmit a byte or number of bytes from the PC to the PIC. When the PIC receives this byte or specific series of bytes it knows it is suppost to reset to enter bootloader mode. To manually reset the devices one way would be to enable the watchdog timer in the configuration and to stop clearing the watchdog timer when you have received the command to reset. Another way would be to use a transistor etc driven from an output pin to manually pull the MCLR pin low.
Once you have restarted the device the bootloader will kick in and your program will be transferred.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Re: Remote firmware update
Thanks Benj. Under the TINY bootloader topic, A flowcode client "Gou16F" make a recommendation to which you did not respond. Is he correct? And if so, could you simplify in flowcode language what he is saying. Thanks in advance.
Ondra
Ondra
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: Remote firmware update
Hello Ondra
Gou16F's comments are just saying that there is a minor problem with the bootloader code if you do not have interrupts enabled. If you have an interrupt enabled in your program then the bootloader should work fine. You could always enable and disable an interrupt straight away in your program if you want to use the bootloader without interrupts in your program.
Gou16F's comments are just saying that there is a minor problem with the bootloader code if you do not have interrupts enabled. If you have an interrupt enabled in your program then the bootloader should work fine. You could always enable and disable an interrupt straight away in your program if you want to use the bootloader without interrupts in your program.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Re: Remote firmware update
One more thing. On the TINY bootloader website under instructions for using the bootloader PC program, the author makes the following statement: - "If a filename is specified as a command line parameter, it will automatically try to write it;" Does this mean that the Tiny PC program listens on the serial port and if it get a connection from the device it will automatically start the process to upload the new file? And how would I go about specifing a filename as a command line parameter?
Ondra
Ondra
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: Remote firmware update
Hello Ondra
You call command line parameters via a command prompt, a shortcut or using an application such as Flowcode.
To do this via Flowcode go into the Chip -> Compiler options window.
In the programmer location setting define the location of the Tiny programming tool. Then for the parameters you should just be able to use "%f.hex" to specify the flowcode generated hex file as the programming source.
You call command line parameters via a command prompt, a shortcut or using an application such as Flowcode.
To do this via Flowcode go into the Chip -> Compiler options window.
In the programmer location setting define the location of the Tiny programming tool. Then for the parameters you should just be able to use "%f.hex" to specify the flowcode generated hex file as the programming source.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel