1 // Copyright 2021 Espressif Systems (Shanghai) PTE LTD 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 #pragma once 15 #include "sdkconfig.h" 16 #include <stdint.h> 17 18 #ifdef __cplusplus 19 extern "C" 20 { 21 #endif 22 23 #if CONFIG_ESP_COREDUMP_ENABLE_TO_FLASH && CONFIG_ESP_COREDUMP_DATA_FORMAT_ELF 24 25 /** 26 * @brief Backtrace information 27 * 28 * For RISCV, backtrace cannot be generated on device without including and parsing 29 * DWARF sections. Including these sections would increase the binary size so provide 30 * the stackdump that can be later used to generate backtrace with the help of GDB or by parsing the ELF file 31 * on the host machine 32 */ 33 typedef struct { 34 uint8_t stackdump[CONFIG_ESP_COREDUMP_SUMMARY_STACKDUMP_SIZE]; /*!< Stack dump of the crashing task. */ 35 uint32_t dump_size; /*!< Size (in bytes) of the stack dump */ 36 } esp_core_dump_bt_info_t; 37 38 /** 39 * @brief RISC-V architecture specific extra information 40 */ 41 typedef struct { 42 uint32_t mstatus; /* Machine Status */ 43 uint32_t mtvec; /* Machine Trap-Vector Base Address */ 44 uint32_t mcause; /* Machine Trap Cause */ 45 uint32_t mtval; /* Machine Trap Value */ 46 uint32_t ra; /* Return Address */ 47 uint32_t sp; /* Stack pointer */ 48 uint32_t exc_a[8]; /* A0-A7 registers when the exception caused */ 49 } esp_core_dump_summary_extra_info_t; 50 51 #endif /* CONFIG_ESP_COREDUMP_ENABLE_TO_FLASH && CONFIG_ESP_COREDUMP_DATA_FORMAT_ELF */ 52 53 #ifdef __cplusplus 54 } 55 #endif 56