cancel
Showing results for 
Search instead for 
Did you mean: 

Jump to application at 0x8001000 when no bootloader is present

Tom
Associate II

Hi Guys,

I'm writting a bootlader/application for STM32L4 in STM32CubeIDE i I want my app to run even if there is no bootloader in memory.

This is my *.ld file:

/* Memories definition */
MEMORY
{
  RAM    (xrw)    : ORIGIN = 0x20000000,   LENGTH = 96K
  RAM2    (xrw)    : ORIGIN = 0x10000000,   LENGTH = 32K
  FLASH    (rx)    : ORIGIN = 0x8001000,   LENGTH = 1024K-0x1000
  BOOT     (rx)    : ORIGIN = 0x8000000,   LENGTH = 131K
}

I my app source I have the below function (which is properly placed at 0x8000000 in flash) :

#define MY_BL_FUNCTIONS __attribute__((section(".bootsection")))
void __attribute__((optimize("O0"))) Bootloader_JumpToApplication(void); MY_BL_FUNCTIONS
 
void __attribute__((optimize("O0"))) Bootloader_JumpToApplication(void)
{
        asm("ldr R0,=0x8001004"); //my app start address
        asm("BX R0");   //jump to app
}

Unfortunately asm("BX R0") makes a sudden jump to my HardFault_Handler. instead of 0x8001004.

What do I do wrong?

Thanks in advance

Tom

10 REPLIES 10

>>Any solution?

Yeah, code like you're running on a Cortex-M4F.. rather than FAFO

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