We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
I am working on a boot loader for a STM32F103 (Cortex M3) and I cannot get the jump code to work properly. I am fairly new to ARM and I have exhausted my knowledge in trying to fix this. This is what I have:
#define USER_FLASH_START ( 0x8000000 + ( 16 * 1024 ) ) /* Flash start address 16K */ #define USER_FLASH_END ( 0x8000000 + ( 0x10000 ) ) #define USER_FLASH_SIZE ( USER_FLASH_END - USER_FLASH_START )
void GoToUserApp(void) {
u32 appJumpAddress;
void (*GoToApp)(void);
appJumpAddress = *((volatile u32*)(USER_FLASH_START + 4));
GoToApp = (void (*)(void))appJumpAddress;
SCB->VTOR = USER_FLASH_START;
__set_MSP(*((volatile u32*) USER_FLASH_START)); //stack pointer (to RAM) for USER app
GoToApp();
}
The above code just keeps causing the controller to reset. If I debug, I am getting these values:
- USER_FLASH_START: 0x8004000 - appJumpAddress: 0x8000101 - GoToApp: 0x8000101 - __set_MSP: 0x8000156
These values do not make sense to me so I am hoping someone here can help me out. Thanks.
Thanks! That was the problem. I didn't change the boot loader but I recompiled my test code and changed the R/O Base to 0x08004000 in the Linker tab. That fixed it.