STM32 In-Application flash updater
Update your STM32 Application firmware over TCP/IP
Project motivation
Any good embedded application needs a firmware updater ...
This one is for STM32 chips and works over ethernet (TCP/IP). It has two major disadvantages:
The usable flash size is reduced to half of the original size
The bootloader does not provide to recover from a broken or crashed application.
It is split into two parts:
The bootloader
The application
After reset, the bootloader checks for availability of a compressed firmware image. If one is available, it will be expanded and flashed into the main
application flash area. If there isn't an image, the bootloader will jump directly into the application.
The main application is responsible to receice a compressed firmware image over TCP/IP and flash it into the update flash area. To start the update,
the main application simply resets the controller to give control to the bootloader.
Short info
Get the source and run make.
Then obey these rules for the first start:
Flash the bootloader part (cd nucleo-fxxx-upd-bl1; make flash)
Flash the gzip'd application image (cd nucleo-fxxx-upd; make flash)
After you've done this, your demo should run. Watch the messages on the serial port, and try to ping the board.
To apply a application firmware update:
Use your favourite networking tool to send the gzip'd image to port 40000 of your board
Example:
cd nucleo-fxxx-upd
make
netcat 192.168.x.y 40000 <nucleo-fxxx-upd.bin.gz
If anything is OK, the board should send "Valid update file received" and restart. The bootloader will uncompress and flash the new image, then start the new
firmware.
Warning
The bootloader doesn't do any plausibility checks on the firmware image. So it is possible to send any gzip'd file which
doesn't contain a valid firmware and the bootloader will recognize it an update. Afterwards the board will hang and you'll have
to use your favourite debugger to reflash a valid firmware image.
Supported Hardware
I've made the demo for these boards:
Nucleo-F746ZG (large Nucleo-144 board)
Nucleo-F429ZI (large Nucleo-144 board)
Nucleo-F207ZG (large Nucleo-144 board)
Olimex E407 (tested with Rev. B)
Download
here: nucleo-lwip-upd.tar.gz
All neccessary library files are included in the tarball. You do not need to
download or install additional sources to compile the examples. The included sources
may not be complete in terms of their original source. I've provided the appropriate download locations below.
Links
Get the full zlib sources and documentation from the zlib home page
Download the full ChibiOS source code here: Chibios Homepage
Get the most recent version of LwIP here: LwIP project homepage
Go to the ST website to get the CubeMX tools and libraries
Look here: The STM32 files for my other
STM32 related pages.
