Bootloader and Application Code
Thank you for your answers
Sadly I still can’t figure it out.
I included before the jump is executed:
SCB->VTOR = memoryAddress;
When I step through the jump_to function everything seems to be fine.
Just before the SysMemBootJump() it looks like this:
MSP: 0x20010000
PSP: 0x4ef1c2ac
PRIMASK: 1
CONTROL: 0
SCB->VTOR: 0x8012000
SysMemBootJump(): 0x0801C509
And the memory at address 0x0812000:
0x08012000: | 0x20010000 | 0x0801C509 |
The application should flash an led after the jump is completed but it doesn’t.
It does not lock up but it is stuck in an infinite loop. I disassembled the instructions and it looks like this:
0x8012dfc: mov sp, r7
0x8012dfe: pop {r7}
0x8012e00: bx lr
0x801a1f0: mov r3, r0
0x801a1f2: and.w r3, r3, #512 ; 0x200
0x801a1f6: cmp r3, #0
0x801a1f8: beq.n 0x801a1ea
0x801a1ea: ldr r0, pc, #20 ; (0x801a200)
0x801a1ec: bl 0x8012dec
0x8012dec: push {r7}
0x8012dee: sub sp, #12
0x8012df0: add r7, sp, #0
0x8012df2: str r0, r7, #4
0x8012df4: ldr r3, r7, #4
0x8012df6: ldr r3, r3, #40 ; 0x28
0x8012df8: mov r0, r3
0x8012dfa: adds r7, #12
0x8012dfc: mov sp, r7
...
Notice that the last command is also the first.
I’m not sure if this helps.
I am using an STM32F107, I don’t know if and how I can disable the data and instruction caches.
Thanks again for your help