cancel
Showing results for 
Search instead for 
Did you mean: 

I'm trying to add the ability for updating firmware in application developed with the STM32CubeIDE

Todd Barrett
Associate II

I have seen several posts and application notes about doing this, but unfortunately the instruction haven't been explicit enough for me to figure how to do this using the STM32cubeIDE. For instance I haven't seen explicit instructions on how to force code like that in the AN4065 note to be forced into a section of flash that is not to be overwritten. I have a SMT32F07X custom board. I'd be willing to use the standard boot loader, but even that the instructions have been too opaque for me to figure out how to do this. Unfortunately I don't have access to the boot lines to change from a standard boot so I'll have to initiate from software.

Does anyone have an example project where this is done?

1 REPLY 1

Writing a bootloader is relatively easy - it's a relatively normal application, performing communication of your choice (e.g. X/Y/Z-modem through UART) with some initiation method, again of your choice (e.g. detecting some pin being tied low/high - that's how the user starts the bootloader), and updating the application part of FLASH. Of course, as usually, the devil is in the details, but you'd find out that during course of implementation.

But the most tricky part is, that you then have to start the application from the bootloader, and that given bootloader has to be the first application running (to prevent suicide) thus occupy the "normal" starting position (at 0x0800'0000 of FLASH), it's the application which has to be modified to be located at a higher address, leaving enough room for the bootloader (that depends on size of bootloader and FLASH granularity). This is ormally achieved in the GNU toolchain by modifying the linker script by moving the .text section (normally by changing the memory area into which it's mapped) to the required position; CubeIDE might have some clicky for this, I don't know, I loathe the eclipsoids. In bootloader, then, when it's time to run the application, you have to use some mechanism to change the vector table from bootloader's to the application's (which in 'F0, given no mechanism to remap vector table in the processor (contrary to Cortex-M3/4/7-based models), this entails moving the vector table to RAM and remapping RAM at 0x0000'0000 instead of FLASH; or, as an alternative, writing a jumppad into the bootloader, which redirects all interrupts into application in software i.e. in manner you choose, at the cost of increased latencies); and then just jump into the reset/startup code of the application (which of course has to reside at a predetermined position, too).

I don't think there's some detailed instructable for you out there, especially going to such details as "using CubeIde". If you have to ask here, I'd recommend you to rather stick to the factory bootloader, even at the cost of redesigning your board.

JW