Putting it all together Use cases during developmentĬreate a debug configuration, Download_and_debug_Bootloader, for the Bootloader project.Įdit the debug startup script and instruct the debugger to set a breakpoint at boot_main. SCB->VTOR = FLASH_BASE | VECT_TAB_OFFSET /* Vector Table Relocation in Internal FLASH */ #endif Ĭonstructing the application Always a good idea to verify! Lookout for any application code that might circumvent this behavior! For instance the “SystemInit” in this example: #ifdef VECT_TAB_SRAM SCB->VTOR = SRAM_BASE | VECT_TAB_OFFSET /* Vector Table Relocation in Internal SRAM */ #else We need to change this! You may also want to reduce LENGTH of FLASH 1024K- 3x16K = 976KĬonstructing the application NOTE! In this example we have chosen to let the bootloader set up the basic environment (stack pointer, vector table, etc.) for the application. Linker configuration file (stm32f4_flash.ld) will, by default, place the code at the start of flash at 0x08000000 0x0800C000. (Exceptions/IRQ now finds its handlers here!) (Stored at second entry in application vector table.)Ĭonfigures the vector table offset register. (Stored at first entry in application vector table.) Locates and sets the application stack pointer address. Sets up the environment for the application:
Performs a firmware update if requested (not implemented in this example!). Rename Reset_Handler to Boot_Reset_Handler and update all references (7 in startup_stm32F40xx.s and 1 in stm32f4_flash.ld)! Rename main() to boot_main() and update all references! You probably have another version with the same name in the application also! Use different symbolic names for critical functions Simplifies breakpoint handling etc.įor instance the entry point for the bootloader will be the Reset_Handler function by default. This is what we want!Ĭonstructing the bootloader To avoid confusing the debugger when debugging the bootloader and the application in the same debug session: Linker configuration file (stm32f4_flash.ld) will, by default, place the code at the start of flash at 0x08000000. (STM32F4-Discovery board, code in flash memory.) Start with a project template generated by the project wizard. Rest of the flash allocated to the application Both must be downloaded.īootloader and application separated in flash (Important! Separated by flash pages!)įirst 3 16K flash pages allocated to the bootloader.
įile New Download new example project from TrueSTORE STMicroelectronics STM32F4-Discovery īL = Bootloader.
Etc.Įxample hardware & code STM32-F4-Discovery kit from STMicroelectronics Download the example projects with ready-made code from TrueSTORE (inside TrueSTUDIO). Interaction between the bootloader and the main application.Ĭoverage It will not cover the actual self-update feature (downloading and flash reprogramming of the main application) Many methods exists and are highly application specific! Ĭonstructing and building the bootloader.Ĭonstructing and building the main application.
New requirements – Need a method to upgrade a product’s firmware due to new functionality.Ī product recall might not be a feasible option!Ĭoverage This document will cover the area of bootloaders from the perspective of Atollic TrueSTUDIO on ARM Cortex-M devices.