(I am learning about ARM debugging so this may be a dumb question.)
I checked the ARMv7-M Arch Ref Manual. It says the reset vector offset is stored in the VTOR (Vector Table Offset Register).
I am using a gdb specific to the Cortex-M. So I expected the gdb command info registers
should show the VTOR
register. But it only shows some general registers.
So is there a way to check VTOR with gdb command?
Thanks!
The VTOR
is memory mapped to 0xe000ed08
according to the ARMv7 ARM. But when I try to access it with gdb command, it shows below error:
>>> x /4xb 0xe000ed08
0xe000ed08: Cannot access memory at address 0xe000ed08
And according to this thread, I checked the memory region known to the gdb client:
>>> info mem
Using memory regions provided by the target.
Num Enb Low Addr High Addr Attrs
0 y 0x00000000 0x00100000 flash blocksize 0x1000 nocache
1 y 0x10001000 0x10001400 flash blocksize 0x400 nocache
2 y 0x20000000 0x20040000 rw nocache
It seems the VOTR offset 0xe000ed08 is not within these regions.
Now I am looking into how to workaround this.
Not sure which decides it:
A similar issue with Cannot access memory at address xxxx
error. It may be related to optimization. But no definite answer yet.
Add the missing region using the gdb mem
command.
mem 0xE0000000 0xE00FFFFF
Then you will be able to access the VTOR at 0xe000ed08.
For a more permanent solution add the region to the target memory map configuration (https://sourceware.org/gdb/onlinedocs/gdb/Memory-Map-Format.html)