2017-07-24 02:04 AM
Hello,
I am working on a project based on the STM32F769i-Discovery board.
What I am trying to accomplish is start a bootloader application and then jump from it to an offset of the flash memory where my main application is located.
The bootloader application does the following:
According to ST code examples and forums in order for the bootloader to jump to the main application I used the following code:
if (((*(__IO uint32_t*)USER_FLASH_FIRST_PAGE_ADDRESS) & 0x2FFE0000 ) == 0x20000000)
{/* Jump to user application */
JumpAddress = *(__IO uint32_t*) (USER_FLASH_FIRST_PAGE_ADDRESS + 4); Jump_To_Application = (pFunction) JumpAddress;/* Initialize user application's Stack Pointer */
__set_MSP(*(__IO uint32_t*) USER_FLASH_FIRST_PAGE_ADDRESS); Jump_To_Application(); }where USER_FLASH_FIRST_PAGE_ADDRESS is the 0x8020000 offset of the flash memory.
The main application just makes two user leds blink.
According, again, to what is suggested by forums I made the following changes to the main application:
MEMORY
{RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 512KFLASH (rx) : ORIGIN = 0x8020000, LENGTH = 2048K - 128K}Considering that everything is set correctly I run the bootloader application which executes normally and when it makes the jump nothing happens.
Something that is worth noting is that when I use the ST-Link Utility to store the main application binary at the 0x8020000 offset of the flash (instead of reading from the SD card) then when the bootloader makes the jump the main application seems to start (the red led lights up) and then hangs.
What could I be missing?
Is there any STM32F769-specific constraint that I should take into consideration?
#stm32f769i-disco #firmware #bootloader #iap2017-07-24 05:22 AM
Consider using a debugger to understand what is happening and where the code execution goes.
Stop in the debugger, where is it?
Have a Hard Fault Handler that does something useful.
Make sure you don't have random interrupts enabled, and firing. SysTick? HAL_Delay()
Instrument infinite spin loops.
2018-04-24 08:50 AM
Did you solve your problem?
I used to added below code.
But, I don't know cause.
__asm('CPSID I');
// this code is same '__disable_irq'.
I added this code before jump command.
refer to below site.
https://www.iar.com/support/tech-notes/general/creating-a-bootloader-for-cortex-m/
2018-04-24 11:02 AM
And what do you expect will re-enable them?
Turn off the interrupts at the source (peripherals), not blanket disable them on the processor, that's just taking no responsibility for the mess you leave the system in.
The System Loader expects to enter at near reset conditions, unwind your initialization until you get there, or jump to the loader at reset before you muddle it up.