'How to check the Cortex-M4 VTOR register with gdb command?
(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!
ADD 1 - 7:43 AM 3/2/2022
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:
- Something I can configure?
- Or determined by the reel board manufacturer?
- Or the binary I flashed into the board?
ADD 2 - 4:46 PM 5/3/2022
A similar issue with Cannot access memory at address xxxx
error. It may be related to optimization. But no definite answer yet.
Solution 1:[1]
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)
Solution 2:[2]
It is a memory mapped register, so you can inspect it that way.
Get the address from the manual you mention:
0xE000ED08 VTOR RW 0x00000000a Vector Table Offset Register, VTOR on page B3-601.
Try something like
(gdb) x/w 0xe000ed08
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | |
Solution 2 | domen |