Reputation: 823
I would like to run my program from the SRAM region of the device.
It seemed quite clear to me, that I have to perform following steps:
SCB->VTOR
(located at 0xE000ED08
) to point to the beginning of the SRAM region, as that is where my vector table is located: 0x20000000
Unfortunately, whenever I issue a reset init
command in OpenOCD, the value of SCB->VTOR
gets cleared. Hence, stack pointer initialization value and reset handler adress are fetched from 0x00000000
instead of 0x20000000
.
How do I get my STM32F4 to fetch the vector table from 0x20000000
?
Upvotes: 2
Views: 2070
Reputation: 7711
Just load the SP
(MSP) from 0x20000000
(=VTOR) and the PC
from 0x20000004
(=VTOR+4) manually.
The reset init
command will usually reset the whole chip and no just the core - and VTOR
will be initialized to zero even then.
Upvotes: 2