Hi,
is it, in principle, possible to read flash memory in GDB?
I have tried to print the partition table at address 0x8000. But only zeros are returned.
The chip in question is an ESP32S3 with 32MB external flash memory.
Maybe some lowlevel openocd command can be used?
Thanks!
[Solved] Read flash memory in debugger (incl. reserved regions)
[Solved] Read flash memory in debugger (incl. reserved regions)
Last edited by espnoob on Tue Dec 20, 2022 7:41 am, edited 1 time in total.
Re: Read flash memory in debugger (incl. reserved regions)
Nothing?
Printing flash memory should be possible (for internal memory, but also for external memory because it is mapped into address space).
Maybe the MMU interferes during runtime?
Printing flash memory should be possible (for internal memory, but also for external memory because it is mapped into address space).
Maybe the MMU interferes during runtime?
-
- Posts: 9757
- Joined: Thu Nov 26, 2015 4:08 am
Re: Read flash memory in debugger (incl. reserved regions)
Only the text&rodata portions (by default) are mapped into the address space, not the entire flash. I think you can access flash directly by running the OpenOCD 'flash read_bank' command. (Note in gdb you would use 'mon flash read_bank' to pass the command through to openocd)
Re: Read flash memory in debugger (incl. reserved regions)
Hello Sprite,
thanks for the pointers.
Indeed, some data can be dumped with "mon flash read_bank"; for just printing to the screen "mon flash mdb" seems to work fine, too.
I still seem to miss something: suppose I have a custom partition table with an entry for data at offset 0xF000 and suppose that
data gets written to the partition using the partition API (e.g. esp_partition_write_raw).
Should I be able to read the memory at the given offset after the write operations are finished? Is there some other mechanism
(mmap?) involved? What about NVS?
Thanks!
thanks for the pointers.
Indeed, some data can be dumped with "mon flash read_bank"; for just printing to the screen "mon flash mdb" seems to work fine, too.
I still seem to miss something: suppose I have a custom partition table with an entry for data at offset 0xF000 and suppose that
data gets written to the partition using the partition API (e.g. esp_partition_write_raw).
Should I be able to read the memory at the given offset after the write operations are finished? Is there some other mechanism
(mmap?) involved? What about NVS?
Thanks!
-
- Posts: 9757
- Joined: Thu Nov 26, 2015 4:08 am
Re: Read flash memory in debugger (incl. reserved regions)
You would need to mmap (part of) the partition for it to be visible as memory; as I said before, by default only the text/rodata segments of your program are mmap'ped in. So NVS also wouldn't be visible unless you mmap the partition manually.
Re: Read flash memory in debugger (incl. reserved regions)
OK, understood, thanks!
Who is online
Users browsing this forum: No registered users and 404 guests