简体   繁体   中英

ARM GDB cannot access memory only on Linux

Trying to switch development to Linux, but running into a (probably simple newbie) problem. On my Mac, I can use ARM GDB ( arm-eabi-none-gdb from the GNU ARM Embedded Toolchain) to load my elf to my STM32L432, then at my breakpoints a simple i lo (or examine, or whatever) gives me the local vars. On Linux, however, the exact same code gives me something like the following:

cr1 = <error reading variable cr1 (Cannot access memory at address 0x2000fff4)>

Is there something I should be doing different to map the memory correctly?

Edit: Thought I'd start again today with a mem dump of the entire SRAM block (datasheet RM0394 page 63) to see if there's just some offset (maybe some sort of memory aliasing that I was unaware of), but even the dump command is stymied:

(gdb) dump ihex memory result.bin 0x20000000 0x40000000
Cannot access memory at address 0x2000c000

This isn't happening on my Mac, and I can see the data I'm looking for on my scope (nothing like debugging software with a scope), so the problem isn't with the SRAM, but with gdb .

And to the person who voted to close, could you specify in what way this is off-topic? I'm stepping through code using gdb and there are tags for pretty much everything I mention, which leads me to believe that this is an appropriate place for the question. I'm not asking for "debugging help" as in "help with debugging specific code", I'm asking for help with a very widely used debugger on somewhat common equipment.

For anyone with this problem in the future ( sc. myself), the issue was that gdb was not tracking the memory region that includes my SRAM ( viz. 0x2000c000 to 0x40000000). The fix was to set up a memory region manually.

Before:

(gdb) info mem
Using memory regions provided by the target.
Num Enb Low Addr   High Addr  Attrs 
0   y   0x00000000 0x00040000 ro nocache 
1   y   0x08000000 0x08040000 flash blocksize 0x800 nocache 
2   y   0x1fff0000 0x1fff7000 ro nocache 
3   y   0x1ffff800 0x1ffff810 ro nocache 
4   y   0x20000000 0x2000c000 rw nocache 
5   y   0x40000000 0x5fffffff rw nocache 
6   y   0xe0000000 0xffffffff rw nocache

After:

(gdb) mem 0x2000c000 0x40000000 32 rw
(gdb) info mem
Using user-defined memory regions.
Num Enb Low Addr   High Addr  Attrs 
0   y   0x00000000 0x00040000 ro nocache 
1   y   0x08000000 0x08040000 flash blocksize 0x800 nocache 
2   y   0x1fff0000 0x1fff7000 ro nocache 
3   y   0x1ffff800 0x1ffff810 ro nocache 
4   y   0x20000000 0x2000c000 rw nocache 
1   y   0x2000c000 0x40000000 rw 32 nocache 
5   y   0x40000000 0x5fffffff rw nocache 
6   y   0xe0000000 0xffffffff rw nocache

(gdb) x/x cr1
0x36c:  0x60f8af00

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM