cancel
Showing results for 
Search instead for 
Did you mean: 

Jump in memory issue in C on STM32L152

tgloague
Associate
Posted on July 03, 2015 at 10:08

Hello everyone,

I made a custom bootloader for my stm32L1 but my problem resides in jumping at the beginning of the flash when my new binary file is loaded.

I made some research on this subject.. the PC and the MSP register need to be changed with the new address.

Here is the function I made to jump in memory but it doesn't work and I don't understand why..

t_error Jump_to_app(pFunction Jump_To_Application, uint32_t JumpAddress) {

if (((*(__IO uint32_t*) WRITE_START_ADDR) & 0x2FFE0000) == 0x20000000) {

JumpAddress = *(__IO uint32_t*) 0x08000004;

Jump_To_Application = (pFunction) JumpAddress;

__set_MSP_BOOT(*(__IO uint32_t*) 0x08000000);

Jump_To_Application();

} else {

return (NOK);

}

return (OK);

This function doesn't work but when I press the RESET button, the jump works and my binary is executed.. but I can't figure why this function doesn't do the magic..

I checked on the Eclipse debugger the value of the MSP register seems to be good : 00400120 

Maybe the PC register is not modified.. I really have no ideas 

If someone knows a way to made simples jump in memory using C, it would be very helpfull !!!

#stm32 #bootloader #c #jump
0 REPLIES 0