I am working on a stm32l152 now.
My boot up vector table is located on flash 0x0800 0000
, where there is a valid reset handler vector and stack pointer. The rest of the exception/interrupt vectors are just endless loops.
Then I setup another vector table in ram, starting at 0x2000 0000
. This vector table will have all necessary vectors.
My problem is that after doing a memory remap to map 0x0000 0000
to 0x2000 0000
, and when my interrupt fires off, it seems the mcu is still looking for the vectors in 0x0800 0000
. I have confirmed this by changing my related-vector in the flash table to that of the one in the ram table. If the flash table related-vector points to a endless loop, my program will loop endlessly. Also, I confirmed my memory remap is correct by writing/read back some memory locations across 0x0000 0000
, 0x0800 0000
, 0x2000 0000
.
Next I use the other method of changing the VTOR in the mcu to offset the vector table by 0x2000 0000
. Now, it works and the mcu will find the vector in the ram. Note that in this method, I did not do any above memory remapping.
My question is: can I use memory remap to relocate my vector table (Without changing VTOR)?
What other uses are there for memory remapping?
Can I write to 0x0000 0000
(mapped to 0x0800 0000
flash) and modify flash during runtime?