after calling __set_MSP the local variables get corrupted
- July 14, 2022
- 8 replies
- 6987 views
Hello,
First, I am sharing some basic information.
The target - STM32G0, compiler Keil C11.
I am trying to jump from a Bootloader to an application. The scenario is very frequent and there are many questions about that on the web, but unfortunately I failed to find a solution to my problem. One of the problems I haven't yet resolved is corruption of the local variables right before the jump as result of __set_MSP which stores in the stack the base address of the applicatio, where I am trying to jump to.
You see here 2 pictures.
On the 1st picture you can see that appJumpAddress is 0x800515D, which is correct.
On the 2nd picture , after calling __set_MSP, written in asm, you see that appJumpAddress is already wrong and therefore my BL jumps to the wrong place in Flash memory .
The operation is standard , described everywhere. What I might did wrong?
Thanks!
P.S.
If someone here has an implementation of such a jump in Keil, can you please share these 3-4 lines?
