Case Study: App Upgrade Bootloader
A board is based on the STM32F4 series microcontroller. The customer wanted a provision to update the application image through the Ethernet interface. The application image should be accepted by the board only if its from an authorized source, so that unauthorized update is prohibited.
Problem
A board is based on the STM32F4 series microcontroller. The customer wanted a provision to update the application image through the Ethernet interface. The application image should be accepted by the board only if its from an authorized source, so that unauthorized update is prohibited.
Solution
A bootloader was implemented that resides at reset location in the internal Flash. The bootloader transfers control to the application, after checking if there is an application image available for update. The application image is made available to the bootloader through a TFTP server. The bootloader after downloading the image, verifies that image is from an authorized, by decrypting the image, using a pre-shared key.
The bootloader is developed using STM32CubeMX and STM32Cube HAL. The TCP / IP and TFTP is implemented using LwIP, that is integrated as part of the STM32Cube HAL.
Host side scripts were developed using Python, to add image header and for encrypting the image, with a specified key.
Project Highlights
TFTP Backport
The TFTP code in the LwIP supported by STM32Cube, did not support the TFTP client code required for the download. The latest version of LwIP supported the TFTP client code. So we back ported the TFTP code from the latest version of LwIP, so that we can we use the client code in our application.