firmwaremodules / stm32-secure-patching-bootloader

Secure Patching Bootloader and Firmware Update System for STM32 MCUs
Other
55 stars 12 forks source link

Support for STM32L476VGTx #2

Closed SizeDrip closed 1 year ago

SizeDrip commented 2 years ago

Hello,

I'm currently working on a firmware update project with 2 STM32L476VGTx DISCOVERY boards over UART, with one acting as a host and another as a receiver (i.e. the one that's getting updated). However, I've been having trouble properly accessing the factory bootloader and came across your project, but it doesn't support my board. Would it be possible to add support for my STM board?

Thanks! Emma

firmwareguru commented 2 years ago

Hi there, if the factory bootloader is good enough for your application, I would suggest you figure out why you can't access or use it. Despite doing my best to make the stm32-secure-patching-bootloader easy to integrate into projects (at least compared to other secure bootloader systems like X-CUBE-SBSFU), it is still much more complex than the factory bootloader, which does not require you to make any modifications to your actual firmware project.

Please let me know if you think the stm32-secure-patching-bootloader would be a good fit for your project. You'll have to modify your firmware project according to the instructions/user guide. Then for board-to-board update, you will need to implement a YMODEM server in your host board (the one sending the firmware update) to talk to the stm32-secure-patching-bootloader's built-in YMODEM client updater. Then to automate the update, you would have to have the host board power reset the target running stm32-secure-patching-bootloader, wait for a string "UART loader check", then send the code load to trigger the UART loader, after which you then perform the YMODEM transfer.

This is not the only way to do it, but it is the only way that is built-in. You can add update capability in your firmware application itself using the stm32-secure-patching-bootloader APIs (documented here), and then you can transfer the firmware image/patch data using any means and interface you desire.

SizeDrip commented 2 years ago

Thanks for the quick reply! I've dabbled a bit in X-CUBE, and yours certainly seems easier to use, as well as being explained much more thoroughly. I've gone through the quick start guides and some of your documentation and did come across the YMODEM server, would that require any additional hardware? I'm ultimately building this as a demonstration piece and am planning to use as little hardware as possible (I'm currently just using 2 DISCO boards and the accompanying UART/grnd wires).

I'll look more into the bootloader APIs, as that may be a feasible route here. As for the factory bootloader, I was originally planning to use it to simply jump to the code in SRAM (which would then run the update) though I haven't currently gotten that far. Thanks for the help!

Emma

firmwareguru commented 2 years ago

I'll add support for the 32L476GDISCOVERY. There is no additional hardware required for a YMODEM "server" - the YMODEM send() function is often included with libraries that also receive().

firmwareguru commented 2 years ago

OK, support for STM32L476VGTx has been added in the form of the DISCO-L476G board library.

A quick test of the bootloader on this board can be done by programming the .bin file in https://github.com/firmwaremodules/stm32-secure-patching-bootloader/tree/main/Test/DISCO-L476G.

In fact, demonstrating board-board update over YMODEM/UART could be done by just using the test binaries with the target board and a custom-built YMODEM server running on the "host" board delivering the .sfb or .sfbp update file.

firmwareguru commented 1 year ago

Released v1.2.0.