Function esp_idf_hal::sys::esp_core_dump_to_flash
source · pub unsafe extern "C" fn esp_core_dump_to_flash(
info: *mut panic_info_t,
)
Expand description
@brief Saves core dump to flash.
The structure of data stored in flash is as follows:
| TOTAL_LEN | VERSION | TASKS_NUM | TCB_SIZE | | TCB_ADDR_1 | STACK_TOP_1 | STACK_END_1 | TCB_1 | STACK_1 | . . . . . . . . | TCB_ADDR_N | STACK_TOP_N | STACK_END_N | TCB_N | STACK_N | | CHECKSUM |
Core dump in flash consists of header and data for every task in the system at the moment of crash. For flash data integrity, a checksum is used at the end of core the dump data. The structure of core dump data is described below in details.
- Core dump starts with header: 1.1) TOTAL_LEN is total length of core dump data in flash including the checksum. Size is 4 bytes. 1.2) VERSION field keeps 4 byte version of core dump. 1.2) TASKS_NUM is the number of tasks for which data are stored. Size is 4 bytes. 1.3) TCB_SIZE is the size of task’s TCB structure. Size is 4 bytes.
- Core dump header is followed by the data for every task in the system. Task data are started with task header: 2.1) TCB_ADDR is the address of TCB in memory. Size is 4 bytes. 2.2) STACK_TOP is the top of task’s stack (address of the topmost stack item). Size is 4 bytes. 2.2) STACK_END is the end of task’s stack (address from which task’s stack starts). Size is 4 bytes.
- Task header is followed by TCB data. Size is TCB_SIZE bytes.
- Task’s stack is placed after TCB data. Size is (STACK_END - STACK_TOP) bytes.
- The checksum is placed at the end of the data.