cancel
Showing results for 
Search instead for 
Did you mean: 

Update from application

T.Die
Associate II

Hey,

Is it possible to create a seperate space on every microcontroller for a second bootloader and firmware location? To update the firmware live? Or is this only possible on specific series? 

A second firmware location to place the new firmware and to verify the firmware is compleet. The second bootloader should start the new firmware and even copy this to the current firmware. 

Is there an application note or guide for this?

Kind regards,

9 REPLIES 9

Yes, but need to keep it small to fit in one or two FLASH pages

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Andrew Neil
Evangelist III

@T.Die wrote:

Is there an application note or guide for this?


Yes!

Application Note AN4657STM32 in-application programming (IAP) using the USART:

https://www.st.com/resource/en/application_note/an4657-stm32-inapplication-programming-iap-using-the-usart-stmicroelectronics.pdf

https://www.st.com/en/embedded-software/x-cube-iap-usart.html

 

Hi Tesla DeLorean,

Why one or two flash pages? Or is this just to make sure there's still flash memory left? 

Kind regards

Simon.T
ST Employee

Hello @T.Die ,

 

You can have a look on the ST Open bootloader. For STM32C0, a code example is available on the STM32Cube C0 FW, following this GitHub link:  https://github.com/STMicroelectronics/STM32CubeC0/tree/main/Projects/NUCLEO-C031C6/Applications/OpenBootloader

 

If you want to have more detail, there is this knowledge article available here : https://community.st.com/t5/stm32-mcus/how-to-use-the-st-open-bootloader-for-stm32-microcontrollers/ta-p/49896

 

Best regards,

 

Simon

 

 

Your question isnt clean info, then reply is simple example. Here is one example of unnamed mcu flash sectors

MM1_0-1728547621669.png

as you can see have 5 area for erase sectors, then this is all limits for your loaders. Too i dont understand why you named secondary . How is primary bootloader function ? 

T.Die
Associate II

Hi all,

Somebody advised me to look at the following project:

https://github.com/jonahswain/stm32g0-bootloader

From what I understand this example creates places for 2 applications and a costum bootloader. 

In the make file I see that there are 3 elf files being created. And if I am correct also 3 files will be uploaded to the microcontroller. This depending on 3 linker scripts. Can this be done in STM32CubeIDE?

Or do I need to adjust the linkerfiles so that there's just one linker file? If so how do I setup the program so that the compiler knows that I want the bootloader on the bootloader linker script place and that the application1 needs to be on the linker script of application1? 

Kind regards

Typically you'd need a specific linker script for each section of memory the different images are placed.

The MCU is always booting from 0x08000000 for FLASH, the CM0+ parts have SCB->VTOR to relocate the vector table via SystemInit() whereas the CM0 part does not, and there you need to copy the alternate vector table(s) into RAM at 0x20000000 and remap the RAM at ZERO (via SYSCFG ?, or mapping register)

Now all the CM0(+) parts are relatively small, if you start pulling in HAL and math libraries things can disappear very quickly. I don't find 16KB (L011) parts to be adequate, currently using a 32KB (G031) that I can at least fit a 2 or 4KB loader, and ability to stage/recover so as not to brick the device.

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

Hi @Tesla DeLorean ,

Thank you for your feedback. 

Ok, so I need different images with each there own linker script. Is this possible to setup in STM32CubeIDE? Or do you need change the linker script and main file for each build? 

Or would you advise to not do this in STM32CubeIde and run this on a self written make file? 

Kind regards

 

Hi,

Just found a way that works for me. Hopefully this will help somebody. 

It's possible to use different applications in a project with different linker scripts. But that gives a complicated configuration. Every application needs to be compiled seperatly and also for future use I don't think this is the best approach. 

For a better overview I created different projects for the applications. Just have to be extra carefull when setting the linkerscripts so that the addresses don't overlap. For this a common file can used to share the memory locations. 

To start STM32CubeProgrammer was used. For this a bin file needs to be created. This bin file can be programmed with STM32CubeProgrammer on a specific address.