diff --git a/components/esp32/CMakeLists.txt b/components/esp32/CMakeLists.txt index 9ad6256311..4e9740a405 100644 --- a/components/esp32/CMakeLists.txt +++ b/components/esp32/CMakeLists.txt @@ -59,7 +59,7 @@ else() # app_update is added here because cpu_start.c uses esp_ota_get_app_description() function. set(COMPONENT_PRIV_REQUIRES app_trace app_update bootloader_support ethernet log mbedtls nvs_flash - pthread smartconfig_ack spi_flash vfs wpa_supplicant xtensa-debug-module) + pthread smartconfig_ack spi_flash vfs wpa_supplicant xtensa-debug-module espcoredump) set(COMPONENT_ADD_LDFRAGMENTS linker.lf ld/esp32_fragments.lf) diff --git a/components/esp32/include/esp_core_dump.h b/components/esp32/include/esp_core_dump.h deleted file mode 100644 index 4c798f59ed..0000000000 --- a/components/esp32/include/esp_core_dump.h +++ /dev/null @@ -1,85 +0,0 @@ -// Copyright 2015-2016 Espressif Systems (Shanghai) PTE LTD -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at - -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -#ifndef ESP_CORE_DUMP_H_ -#define ESP_CORE_DUMP_H_ - - -/**************************************************************************************/ -/******************************** EXCEPTION MODE API **********************************/ -/**************************************************************************************/ - -/** - * @brief Initializes core dump module internal data. - * - * @note Should be called at system startup. - */ -void esp_core_dump_init(); - -/** - * @brief Saves core dump to flash. - * - * The structure of data stored in flash is as follows: - * - * | TOTAL_LEN | 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 | - * | CRC32 | - * - * Core dump in flash consists of header and data for every task in the system at the moment of crash. - * For flash data integrity control CRC is used at the end of core the dump data. - * The structure of core dump data is described below in details. - * 1) Core dump starts with header: - * 1.1) TOTAL_LEN is total length of core dump data in flash including CRC. Size is 4 bytes. - * 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. - * 2) 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. - * 3) Task header is followed by TCB data. Size is TCB_SIZE bytes. - * 4) Task's stack is placed after TCB data. Size is (STACK_END - STACK_TOP) bytes. - * 5) CRC is placed at the end of the data. - */ -void esp_core_dump_to_flash(); - -/** - * @brief Print base64-encoded core dump to UART. - * - * The structure of core dump data is the same as for data stored in flash (@see esp_core_dump_to_flash) with some notes: - * 1) CRC is not present in core dump printed to UART. - * 2) Since CRC is omitted TOTAL_LEN does not include its size. - * 3) Printed base64 data are surrounded with special messages to help user recognize the start and end of actual data. - */ -void esp_core_dump_to_uart(); - - -/**************************************************************************************/ -/*********************************** USER MODE API ************************************/ -/**************************************************************************************/ - -/** - * @brief Retrieves address and size of coredump data in flash. - * This function is always available, even when core dump is disabled in menuconfig. - * - * @param out_addr pointer to store image address in flash. - * @param out_size pointer to store image size in flash (including CRC). In bytes. - * - * @return ESP_OK on success, otherwise \see esp_err_t - */ -esp_err_t esp_core_dump_image_get(size_t* out_addr, size_t *out_size); - -#endif diff --git a/components/espcoredump/include/esp_core_dump.h b/components/espcoredump/include/esp_core_dump.h index 5201f1e94d..e19b45c98a 100644 --- a/components/espcoredump/include/esp_core_dump.h +++ b/components/espcoredump/include/esp_core_dump.h @@ -14,6 +14,10 @@ #ifndef ESP_CORE_DUMP_H_ #define ESP_CORE_DUMP_H_ +#include +#include "esp_err.h" +#include "freertos/xtensa_context.h" + /**************************************************************************************/ /******************************** EXCEPTION MODE API **********************************/ /**************************************************************************************/ @@ -54,7 +58,7 @@ void esp_core_dump_init(); * 4) Task's stack is placed after TCB data. Size is (STACK_END - STACK_TOP) bytes. * 5) CRC is placed at the end of the data. */ -void esp_core_dump_to_flash(); +void esp_core_dump_to_flash(XtExcFrame *frame); /** * @brief Print base64-encoded core dump to UART. @@ -64,7 +68,7 @@ void esp_core_dump_to_flash(); * 2) Since CRC is omitted TOTAL_LEN does not include its size. * 3) Printed base64 data are surrounded with special messages to help user recognize the start and end of actual data. */ -void esp_core_dump_to_uart(); +void esp_core_dump_to_uart(XtExcFrame *frame); /**************************************************************************************/ diff --git a/components/espcoredump/linker.lf b/components/espcoredump/linker.lf index 71072ab0a6..30d13caefc 100644 --- a/components/espcoredump/linker.lf +++ b/components/espcoredump/linker.lf @@ -3,4 +3,5 @@ archive: libespcoredump.a entries: core_dump_uart (noflash_text) core_dump_flash (noflash_text) - core_dump_common (noflash_text) \ No newline at end of file + core_dump_common (noflash_text) + core_dump_port (noflash_text) \ No newline at end of file