EasyManua.ls Logo

Espressif ESP32-S2 - Dumping Variables on Demand; Running Espcoredump.py

Espressif ESP32-S2
1695 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
Chapter 4. API Guides
broken with error message at the first ROM function. To overcome this issue you can use ROM ELF provided by
Espressif (https://dl.espressif.com/dl/esp32s2_rom.elf) and pass it to espcoredump.py.
4.9.6 Dumping variables on demand
Sometimes you want to read the last value of a variable to understand the root cause of a crash. Core dump supports
retrieving variable data over GDB by attributing special notations declared variables.
Supported notations and RAM regions
COREDUMP_DRAM_ATTR places variable into DRAM area which will be included into dump.
COREDUMP_RTC_ATTR places variable into RTC area which will be included into dump.
COREDUMP_RTC_FAST_ATTR places variable into RTC_FAST area which will be included into dump.
Example
1. In Project Configuration Menu, enable COREDUMP TO FLASH, then save and exit.
2. In your project, create a global variable in DRAM area as such as:
// uint8_t global_var;
COREDUMP_DRAM_ATTR uint8_t global_var;
3. In main application, set the variable to any value and assert(0) to cause a crash.
global_var = 25;
assert(0);
4. Build, flash and run the application on a target device and wait for the dumping information.
5. Run the command below to start core dumping in GDB, where PORT is the device USB port:
espcoredump.py -p PORT dbg_corefile <path/to/elf>
6. In GDB shell, type p global_var to get the variable content:
(gdb) p global_var
$1 = 25 '\031'
4.9.7 Running espcoredump.py
Generic command syntax: espcoredump.py [options] command [args]
Script Options
chip {auto,esp32,esp32s2,esp32s3,esp32c3} Target chip type. Default value is auto
--port PORT, -p PORT Serial port device. Eitherchiporportneed to be
specified to determine the port when you have multi-target
connected at the same time.
--baud BAUD, -b BAUD Serial port baud rate used when flashing/reading
--gdb-timeout-sec GDB_TIMEOUT_SEC Overwrite the default internal delay
for gdb responses
Commands dbg_corefile Starts GDB debugging session with specified corefile
info_corefile Print core dump info from file
Command Arguments
--debug DEBUG, -d DEBUG Log level (0..3)
--gdb GDB, -g GDB Path to gdb
--core CORE, -c CORE Path to core dump file (if skipped core dump will be
read from flash)
Espressif Systems 1329
Submit Document Feedback
Release v4.4

Table of Contents