Hi, I am using this function to branch to application wo problems on GNU tools:
static void boot_jump(uint32_t lAddress) { __asm( "LDR SP, [R0]\n" "LDR PC, [R0, #4]\n" ); }
But compiling in MDK-ARM reports: bootloader.c(45): error: #20: identifier "SP" is undefined
How to solve this or what method must be used in MDK-ARM to do the same? I could not find any bootloader example in the Keil pack that comes for STM32F micro.
Sorry correct code is:
static void boot_jump(uint32_t address) { typedef void (*pFunction)(void); pFunction jumpToApplication = (pFunction) *(__IO uint32_t*)(address + 4); /* Initialize user application's Stack Pointer */ __set_MSP(*(__IO uint32_t*) address); jumpToApplication(); }
Solution is:
static void boot_jump(uint32_t lAddress) { typedef void (*pFunction)(void); pFunction jumpToApplication = (pFunction) lAddress; /* Initialize user application's Stack Pointer */ __set_MSP(*(__IO uint32_t*) lAddress); jumpToApplication(); }
Found the example elsewhere.
View all questions in Keil forum