cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F407DISCO IAP over Ethernet

PUrsu.1
Associate II

Hey there,

following situation: lets say there is a product on the market based on a STM32F407 uC. This product has an ethernet connection over a PHY and it should be possible to update the firmware of the device over the ethernet connection.

As the Webserver is running all the time, because the product needs that, I could offer an upload function over HTML form and transmit the BIN file to the MCU using a post request.

If I understood everything correctly I can not just write the received file directly into the "normal" space where the program is stored because the application is running obviously. So my thought was to use a tiny boot loader which checks if the "firmware update received" flag at a certain position in the flash is set. If it is set I copy the code from the behind flash into the starting position for my "normal" program. After that I reset the update flag and the boot loader skips to the "normal" updated code.

Would it work that way or are there any more simple solutions for that? I'm just trying to figure out how big companies solve that. (The upload firmware option should be possible at any time, without pressing any button to boot in "update mode" or so).

Am I getting this right?

Thanks in advance!

edit: of course I've read all the documentation available for IAP from STM =)

2 REPLIES 2

Yes, one would typically stage the new firmware, or compressed image, deeper into the FLASH, or external SPI, and recognize that and copy it down to it's normal position. This could be done with a small loader in the first 16KB block, or a small block of code moved to RAM, and then replacing the primary image. The latter has more vulnerability to power failure, etc. but is workable if space is tight and you have secondary recovery methods.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Piranha
Chief II

Alternatively one can make update based on TFTP protocol and even replace the firmware in-place, but then the bootloader must be smart enough to recover under any situation. Take a note that TFTP uses UDP. That means the updater doesn't need TCP at all, which saves a significant amount of code space.