mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
refactor(espcoredump): format coredump component with astyle
This commit is contained in:
parent
10f14d5cca
commit
f4acf0b378
@ -78,7 +78,7 @@ enum class CreateAnd {
|
||||
};
|
||||
|
||||
struct MockQueue : public CMockFix {
|
||||
MockQueue (CreateAnd flags) : queue(reinterpret_cast<QueueHandle_t>(0xdeadbeef))
|
||||
MockQueue(CreateAnd flags) : queue(reinterpret_cast<QueueHandle_t>(0xdeadbeef))
|
||||
{
|
||||
if (flags == CreateAnd::FAIL) {
|
||||
xQueueGenericCreate_ExpectAnyArgsAndReturn(nullptr);
|
||||
@ -101,7 +101,7 @@ struct MockQueue : public CMockFix {
|
||||
};
|
||||
|
||||
struct MockMutex : public CMockFix {
|
||||
MockMutex (CreateAnd flags) : sem(reinterpret_cast<QueueHandle_t>(0xdeadbeef))
|
||||
MockMutex(CreateAnd flags) : sem(reinterpret_cast<QueueHandle_t>(0xdeadbeef))
|
||||
{
|
||||
if (flags == CreateAnd::FAIL) {
|
||||
xQueueCreateMutex_ExpectAnyArgsAndReturn(nullptr);
|
||||
@ -124,7 +124,7 @@ struct MockMutex : public CMockFix {
|
||||
};
|
||||
|
||||
struct MockTask : public CMockFix {
|
||||
MockTask (CreateAnd flags) : task((TaskHandle_t) 1)
|
||||
MockTask(CreateAnd flags) : task((TaskHandle_t) 1)
|
||||
{
|
||||
if (flags == CreateAnd::FAIL) {
|
||||
xTaskCreatePinnedToCore_ExpectAnyArgsAndReturn(pdFALSE);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2015-2023 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2015-2024 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2015-2023 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2015-2024 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
@ -50,7 +50,6 @@ bool esp_core_dump_get_task_snapshot(core_dump_task_handle_t handle,
|
||||
*/
|
||||
void esp_core_dump_reset_tasks_snapshots_iter(void);
|
||||
|
||||
|
||||
/**
|
||||
* @brief Check if the TCB passed as a parameter is sane.
|
||||
*
|
||||
@ -67,7 +66,6 @@ bool esp_core_dump_tcb_addr_is_sane(uint32_t addr);
|
||||
*/
|
||||
uint32_t esp_core_dump_get_user_ram_segments(void);
|
||||
|
||||
|
||||
/**
|
||||
* @brief Get start address and size of a memory region.
|
||||
*
|
||||
@ -79,7 +77,6 @@ uint32_t esp_core_dump_get_user_ram_segments(void);
|
||||
*/
|
||||
int esp_core_dump_get_user_ram_info(coredump_region_t region, uint32_t *start);
|
||||
|
||||
|
||||
/**
|
||||
* @brief Check if the current task is in an ISR.
|
||||
*
|
||||
@ -87,7 +84,6 @@ int esp_core_dump_get_user_ram_info(coredump_region_t region, uint32_t *start);
|
||||
*/
|
||||
bool esp_core_dump_in_isr_context(void);
|
||||
|
||||
|
||||
/**
|
||||
* @brief Get the size all the memory regions (DRAM, RTC, RTC_FAST, IRAM)
|
||||
*
|
||||
@ -95,7 +91,6 @@ bool esp_core_dump_in_isr_context(void);
|
||||
*/
|
||||
uint32_t esp_core_dump_get_user_ram_size(void);
|
||||
|
||||
|
||||
/**
|
||||
* @brief Get TCB length, in bytes.
|
||||
*
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2015-2023 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2015-2024 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
@ -60,7 +60,6 @@ void esp_core_dump_reset_fake_stacks(void);
|
||||
*/
|
||||
uint32_t esp_core_dump_get_isr_stack_end(void);
|
||||
|
||||
|
||||
/**
|
||||
* @brief Get the top of the ISR stack.
|
||||
*
|
||||
@ -68,7 +67,6 @@ uint32_t esp_core_dump_get_isr_stack_end(void);
|
||||
*/
|
||||
uint8_t* esp_core_dump_get_isr_stack_top(void);
|
||||
|
||||
|
||||
/**
|
||||
* @brief Check the stack defined by address given.
|
||||
*
|
||||
@ -78,7 +76,6 @@ uint8_t* esp_core_dump_get_isr_stack_top(void);
|
||||
*/
|
||||
bool esp_core_dump_check_stack(core_dump_task_header_t *task);
|
||||
|
||||
|
||||
/**
|
||||
* @brief Check if the memory segment is sane.
|
||||
*
|
||||
@ -89,7 +86,6 @@ bool esp_core_dump_check_stack(core_dump_task_header_t *task);
|
||||
*/
|
||||
bool esp_core_dump_mem_seg_is_sane(uint32_t addr, uint32_t sz);
|
||||
|
||||
|
||||
/**
|
||||
* @brief Get the stack of a task.
|
||||
*
|
||||
@ -104,7 +100,6 @@ bool esp_core_dump_mem_seg_is_sane(uint32_t addr, uint32_t sz);
|
||||
uint32_t esp_core_dump_get_stack(core_dump_task_header_t* task_snapshot,
|
||||
uint32_t* stk_vaddr, uint32_t* stk_paddr);
|
||||
|
||||
|
||||
/**
|
||||
* @brief Check the task passed as a parameter.
|
||||
*
|
||||
@ -120,7 +115,6 @@ uint32_t esp_core_dump_get_stack(core_dump_task_header_t* task_snapshot,
|
||||
*/
|
||||
bool esp_core_dump_check_task(core_dump_task_header_t *task);
|
||||
|
||||
|
||||
/**
|
||||
* @brief Get a dump of the task's registers.
|
||||
*
|
||||
|
@ -88,7 +88,7 @@ extern "C" {
|
||||
* MUST be a multiple of 16.
|
||||
*/
|
||||
#if (COREDUMP_CACHE_SIZE % 16) != 0
|
||||
#error "Coredump cache size must be a multiple of 16"
|
||||
#error "Coredump cache size must be a multiple of 16"
|
||||
#endif
|
||||
|
||||
/**
|
||||
@ -96,8 +96,7 @@ extern "C" {
|
||||
*/
|
||||
#define COREDUMP_VERSION_CHIP CONFIG_IDF_FIRMWARE_CHIP_ID
|
||||
|
||||
typedef struct _core_dump_write_data_t
|
||||
{
|
||||
typedef struct _core_dump_write_data_t {
|
||||
uint32_t off; /*!< Current offset of data being written */
|
||||
uint8_t cached_data[COREDUMP_CACHE_SIZE]; /*!< Cache used to write to flash */
|
||||
uint8_t cached_bytes; /*!< Number of bytes filled in the cached */
|
||||
@ -116,7 +115,6 @@ typedef esp_err_t (*esp_core_dump_flash_write_data_t)(core_dump_write_data_t* pr
|
||||
void * data,
|
||||
uint32_t data_len);
|
||||
|
||||
|
||||
/**
|
||||
* @brief Core dump emitter control structure.
|
||||
* This structure contains the functions that are called in order to write
|
||||
@ -127,8 +125,7 @@ typedef esp_err_t (*esp_core_dump_flash_write_data_t)(core_dump_write_data_t* pr
|
||||
* - write (called once or more)
|
||||
* - end
|
||||
*/
|
||||
typedef struct _core_dump_write_config_t
|
||||
{
|
||||
typedef struct _core_dump_write_config_t {
|
||||
esp_core_dump_write_prepare_t prepare; /*!< Function called for sanity checks */
|
||||
esp_core_dump_write_start_t start; /*!< Function called at the beginning of data writing */
|
||||
esp_core_dump_flash_write_data_t write; /*!< Function called to write data chunk */
|
||||
@ -139,8 +136,7 @@ typedef struct _core_dump_write_config_t
|
||||
/**
|
||||
* @brief Core dump data header
|
||||
* This header predecesses the actual core dump data (ELF or binary). */
|
||||
typedef struct _core_dump_header_t
|
||||
{
|
||||
typedef struct _core_dump_header_t {
|
||||
uint32_t data_len; /*!< Data length */
|
||||
uint32_t version; /*!< Core dump version */
|
||||
uint32_t tasks_num; /*!< Number of tasks */
|
||||
@ -158,8 +154,7 @@ typedef void* core_dump_task_handle_t;
|
||||
/**
|
||||
* @brief Header for the tasks
|
||||
*/
|
||||
typedef struct _core_dump_task_header_t
|
||||
{
|
||||
typedef struct _core_dump_task_header_t {
|
||||
core_dump_task_handle_t tcb_addr; /*!< TCB address */
|
||||
uint32_t stack_start; /*!< Start of the stack address */
|
||||
uint32_t stack_end; /*!< End of the stack address */
|
||||
@ -168,8 +163,7 @@ typedef struct _core_dump_task_header_t
|
||||
/**
|
||||
* @brief Core dump memory segment header
|
||||
*/
|
||||
typedef struct _core_dump_mem_seg_header_t
|
||||
{
|
||||
typedef struct _core_dump_mem_seg_header_t {
|
||||
uint32_t start; /*!< Memory region start address */
|
||||
uint32_t size; /*!< Memory region size */
|
||||
} core_dump_mem_seg_header_t;
|
||||
@ -179,7 +173,6 @@ typedef struct _core_dump_mem_seg_header_t
|
||||
*/
|
||||
void esp_core_dump_flash_init(void);
|
||||
|
||||
|
||||
/**
|
||||
* @brief Common core dump write function
|
||||
*/
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2015-2022 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2015-2024 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
@ -35,14 +35,13 @@ typedef struct {
|
||||
*/
|
||||
FORCE_INLINE_ATTR void esp_core_dump_replace_sp(void* new_sp, core_dump_stack_context_t* old_ctx)
|
||||
{
|
||||
asm volatile ("mv %0, sp \n\t\
|
||||
asm volatile("mv %0, sp \n\t\
|
||||
mv sp, %1 \n\t\
|
||||
"
|
||||
: "=&r"(old_ctx->sp)
|
||||
: "r"(new_sp));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Restore the stack pointer that was returned when calling `esp_core_dump_replace_sp()` function.
|
||||
*
|
||||
@ -50,7 +49,7 @@ FORCE_INLINE_ATTR void esp_core_dump_replace_sp(void* new_sp, core_dump_stack_co
|
||||
*/
|
||||
FORCE_INLINE_ATTR void esp_core_dump_restore_sp(core_dump_stack_context_t* old_ctx)
|
||||
{
|
||||
asm volatile ("mv sp, %0 \n\t" :: "r"(old_ctx->sp));
|
||||
asm volatile("mv sp, %0 \n\t" :: "r"(old_ctx->sp));
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2015-2022 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2015-2024 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
@ -48,7 +48,7 @@ FORCE_INLINE_ATTR void esp_core_dump_replace_sp(void* new_sp, core_dump_stack_co
|
||||
xthal_window_spill();
|
||||
|
||||
/* Backup the special registers PS, WindowBase and WindowStart. We will need to restore them later */
|
||||
asm volatile ("mov %0, sp \n" \
|
||||
asm volatile("mov %0, sp \n" \
|
||||
"mov %1, a0 \n" \
|
||||
"rsr.ps %2 \n"\
|
||||
"rsr.windowbase %3 \n"\
|
||||
@ -63,7 +63,6 @@ FORCE_INLINE_ATTR void esp_core_dump_replace_sp(void* new_sp, core_dump_stack_co
|
||||
SET_STACK(new_sp);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Restore the stack pointer that was returned when calling `esp_core_dump_replace_sp()` function.
|
||||
*
|
||||
@ -74,7 +73,7 @@ FORCE_INLINE_ATTR void esp_core_dump_restore_sp(core_dump_stack_context_t* old_c
|
||||
/* Start by disabling WindowOverflowEnable bit from PS to make sure we won't get a Window Overflow exception
|
||||
* restoring WindowBase and WindowStart registers */
|
||||
const uint32_t ps_woe = old_ctx->ps & ~(PS_WOE_MASK);
|
||||
asm volatile ( \
|
||||
asm volatile(\
|
||||
"wsr.ps %0 \n"\
|
||||
"rsync \n"\
|
||||
"wsr.windowbase %1 \n"\
|
||||
|
@ -16,7 +16,6 @@
|
||||
|
||||
const static char TAG[] __attribute__((unused)) = "esp_core_dump_binary";
|
||||
|
||||
|
||||
static esp_err_t esp_core_dump_save_task(core_dump_write_config_t *write_cfg,
|
||||
core_dump_task_header_t *task)
|
||||
{
|
||||
@ -25,7 +24,7 @@ static esp_err_t esp_core_dump_save_task(core_dump_write_config_t *write_cfg,
|
||||
uint32_t stk_paddr = 0;
|
||||
uint32_t stk_len = esp_core_dump_get_stack(task, &stk_vaddr, &stk_paddr);
|
||||
|
||||
stk_len = esp_core_dump_get_memory_len(stk_vaddr, stk_vaddr+stk_len);
|
||||
stk_len = esp_core_dump_get_memory_len(stk_vaddr, stk_vaddr + stk_len);
|
||||
|
||||
// Save memory segment header
|
||||
err = write_cfg->write(write_cfg->priv, (void*)task, sizeof(core_dump_task_header_t));
|
||||
@ -107,19 +106,19 @@ esp_err_t esp_core_dump_write_binary(core_dump_write_config_t *write_cfg)
|
||||
cur_task = task_iter.pxTaskHandle;
|
||||
ESP_COREDUMP_LOG_PROCESS("Task %x %x is first crashed task.", cur_task, task_hdr.tcb_addr);
|
||||
}
|
||||
ESP_COREDUMP_LOG_PROCESS("Stack len = %lu (%x %x)", task_hdr.stack_end-task_hdr.stack_start,
|
||||
ESP_COREDUMP_LOG_PROCESS("Stack len = %lu (%x %x)", task_hdr.stack_end - task_hdr.stack_start,
|
||||
task_hdr.stack_start, task_hdr.stack_end);
|
||||
// Increase core dump size by task stack size
|
||||
uint32_t stk_vaddr = 0;
|
||||
uint32_t stk_paddr = 0;
|
||||
uint32_t stk_len = esp_core_dump_get_stack(&task_hdr, &stk_vaddr, &stk_paddr);
|
||||
data_len += esp_core_dump_get_memory_len(stk_vaddr, stk_vaddr+stk_len);
|
||||
data_len += esp_core_dump_get_memory_len(stk_vaddr, stk_vaddr + stk_len);
|
||||
// Add tcb size
|
||||
data_len += (tcb_sz + sizeof(core_dump_task_header_t));
|
||||
if (mem_seg.size > 0) {
|
||||
ESP_COREDUMP_LOG_PROCESS("Add interrupted task stack %lu bytes @ %x",
|
||||
mem_seg.size, mem_seg.start);
|
||||
data_len += esp_core_dump_get_memory_len(mem_seg.start, mem_seg.start+mem_seg.size);
|
||||
data_len += esp_core_dump_get_memory_len(mem_seg.start, mem_seg.start + mem_seg.size);
|
||||
data_len += sizeof(core_dump_mem_seg_header_t);
|
||||
hdr.mem_segs_num++;
|
||||
}
|
||||
@ -205,8 +204,9 @@ esp_err_t esp_core_dump_write_binary(core_dump_write_config_t *write_cfg)
|
||||
// Write all other tasks in the snapshot
|
||||
esp_core_dump_task_iterator_init(&task_iter);
|
||||
while (esp_core_dump_task_iterator_next(&task_iter) != -1) {
|
||||
if (!esp_core_dump_get_task_snapshot(task_iter.pxTaskHandle, &task_hdr, NULL))
|
||||
if (!esp_core_dump_get_task_snapshot(task_iter.pxTaskHandle, &task_hdr, NULL)) {
|
||||
continue;
|
||||
}
|
||||
// Skip first crashed task
|
||||
if (task_iter.pxTaskHandle == cur_task) {
|
||||
continue;
|
||||
@ -226,8 +226,9 @@ esp_err_t esp_core_dump_write_binary(core_dump_write_config_t *write_cfg)
|
||||
esp_core_dump_reset_tasks_snapshots_iter();
|
||||
esp_core_dump_task_iterator_init(&task_iter);
|
||||
while (esp_core_dump_task_iterator_next(&task_iter) != -1) {
|
||||
if (!esp_core_dump_get_task_snapshot(task_iter.pxTaskHandle, &task_hdr, &mem_seg))
|
||||
if (!esp_core_dump_get_task_snapshot(task_iter.pxTaskHandle, &task_hdr, &mem_seg)) {
|
||||
continue;
|
||||
}
|
||||
if (mem_seg.size > 0) {
|
||||
ESP_COREDUMP_LOG_PROCESS("Save interrupted task stack %lu bytes @ %x",
|
||||
mem_seg.size, mem_seg.start);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2015-2023 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2015-2024 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
@ -46,13 +46,12 @@ extern int _coredump_rtc_fast_end;
|
||||
* a stack that will be used during the whole core dump generation.
|
||||
*/
|
||||
#if LOG_LOCAL_LEVEL >= ESP_LOG_DEBUG
|
||||
/* Increase stack size in verbose mode */
|
||||
#define ESP_COREDUMP_STACK_SIZE (CONFIG_ESP_COREDUMP_STACK_SIZE+100)
|
||||
/* Increase stack size in verbose mode */
|
||||
#define ESP_COREDUMP_STACK_SIZE (CONFIG_ESP_COREDUMP_STACK_SIZE+100)
|
||||
#else
|
||||
#define ESP_COREDUMP_STACK_SIZE CONFIG_ESP_COREDUMP_STACK_SIZE
|
||||
#define ESP_COREDUMP_STACK_SIZE CONFIG_ESP_COREDUMP_STACK_SIZE
|
||||
#endif
|
||||
|
||||
|
||||
#define COREDUMP_STACK_FILL_BYTE (0xa5U)
|
||||
|
||||
static uint8_t s_coredump_stack[ESP_COREDUMP_STACK_SIZE];
|
||||
@ -90,9 +89,8 @@ FORCE_INLINE_ATTR void esp_core_dump_setup_stack(void)
|
||||
FORCE_INLINE_ATTR uint32_t esp_core_dump_free_stack_space(const uint8_t *pucStackByte)
|
||||
{
|
||||
uint32_t ulCount = 0U;
|
||||
while ( ulCount < ESP_COREDUMP_STACK_SIZE &&
|
||||
*pucStackByte == (uint8_t)COREDUMP_STACK_FILL_BYTE )
|
||||
{
|
||||
while (ulCount < ESP_COREDUMP_STACK_SIZE &&
|
||||
*pucStackByte == (uint8_t)COREDUMP_STACK_FILL_BYTE) {
|
||||
pucStackByte -= portSTACK_GROWTH;
|
||||
ulCount++;
|
||||
}
|
||||
@ -121,7 +119,7 @@ FORCE_INLINE_ATTR void esp_core_dump_report_stack_usage(void)
|
||||
|
||||
/* Here, we are not going to use a custom stack for coredump. Make sure the current configuration doesn't require one. */
|
||||
#if CONFIG_ESP_COREDUMP_USE_STACK_SIZE
|
||||
#pragma error "CONFIG_ESP_COREDUMP_STACK_SIZE must not be 0 in the current configuration"
|
||||
#pragma error "CONFIG_ESP_COREDUMP_STACK_SIZE must not be 0 in the current configuration"
|
||||
#endif // ESP_COREDUMP_USE_STACK_SIZE
|
||||
|
||||
FORCE_INLINE_ATTR void esp_core_dump_setup_stack(void)
|
||||
@ -130,14 +128,13 @@ FORCE_INLINE_ATTR void esp_core_dump_setup_stack(void)
|
||||
if (esp_core_dump_in_isr_context()) {
|
||||
uint8_t* topStack = esp_core_dump_get_isr_stack_top();
|
||||
esp_cpu_clear_watchpoint(1);
|
||||
esp_cpu_set_watchpoint(1, topStack+xPortGetCoreID()*configISR_STACK_SIZE, 1, ESP_CPU_WATCHPOINT_STORE);
|
||||
esp_cpu_set_watchpoint(1, topStack + xPortGetCoreID()*configISR_STACK_SIZE, 1, ESP_CPU_WATCHPOINT_STORE);
|
||||
} else {
|
||||
/* for tasks user should enable stack overflow detection in menuconfig
|
||||
TODO: if not enabled in menuconfig enable it ourselves */
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
FORCE_INLINE_ATTR void esp_core_dump_report_stack_usage(void)
|
||||
{
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2015-2023 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2015-2024 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
@ -44,23 +44,20 @@
|
||||
return (ret_val); \
|
||||
}
|
||||
|
||||
typedef enum
|
||||
{
|
||||
typedef enum {
|
||||
ELF_STAGE_CALC_SPACE = 0,
|
||||
ELF_STAGE_PLACE_HEADERS = 1,
|
||||
ELF_STAGE_PLACE_DATA = 2
|
||||
} core_dump_elf_stages_t;
|
||||
|
||||
typedef enum _elf_err_t
|
||||
{
|
||||
typedef enum _elf_err_t {
|
||||
ELF_PROC_ERR_SKIP_HEADER = 0,
|
||||
ELF_PROC_ERR_STACK_CORRUPTED = -1,
|
||||
ELF_PROC_ERR_WRITE_FAIL = -2,
|
||||
ELF_PROC_ERR_OTHER = -3
|
||||
} core_dump_elf_proc_err_t;
|
||||
|
||||
typedef struct _core_dump_task_info_t
|
||||
{
|
||||
typedef struct _core_dump_task_info_t {
|
||||
elf_phdr* phdr;
|
||||
void* frame;
|
||||
core_dump_task_header_t* task_hdr;
|
||||
@ -69,8 +66,7 @@ typedef struct _core_dump_task_info_t
|
||||
int* size_ptr;
|
||||
} core_dump_task_data_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
typedef struct {
|
||||
uint32_t version; // coredump version
|
||||
uint8_t app_elf_sha256[ELF_APP_SHA256_SIZE]; // sha256 of elf file
|
||||
} core_dump_elf_version_info_t;
|
||||
@ -78,8 +74,7 @@ typedef struct
|
||||
const static char TAG[] __attribute__((unused)) = "esp_core_dump_elf";
|
||||
|
||||
// Main ELF handle type
|
||||
typedef struct _core_dump_elf_t
|
||||
{
|
||||
typedef struct _core_dump_elf_t {
|
||||
core_dump_elf_version_info_t elf_version_info;
|
||||
uint16_t elf_stage;
|
||||
uint32_t elf_next_data_offset;
|
||||
@ -417,8 +412,9 @@ static int elf_process_tasks_regs(core_dump_elf_t *self)
|
||||
esp_core_dump_task_iterator_init(&task_iter);
|
||||
while (esp_core_dump_task_iterator_next(&task_iter) != -1) {
|
||||
task = task_iter.pxTaskHandle;
|
||||
if (!task || task == esp_core_dump_get_current_task_handle()) // skip current task (already processed)
|
||||
if (!task || task == esp_core_dump_get_current_task_handle()) { // skip current task (already processed)
|
||||
continue;
|
||||
}
|
||||
if (esp_core_dump_get_task_snapshot(task, &task_hdr, NULL)) {
|
||||
ret = elf_add_regs(self, &task_hdr);
|
||||
if (self->elf_stage == ELF_STAGE_PLACE_HEADERS) {
|
||||
@ -619,7 +615,9 @@ static int elf_write_core_dump_info(core_dump_elf_t *self)
|
||||
extern bool g_twdt_isr;
|
||||
if (g_twdt_isr) {
|
||||
ret = elf_add_wdt_panic_details(self);
|
||||
if (ret <= 0) { return ret; }
|
||||
if (ret <= 0) {
|
||||
return ret;
|
||||
}
|
||||
data_len += ret;
|
||||
}
|
||||
#endif
|
||||
@ -686,7 +684,9 @@ esp_err_t esp_core_dump_write_elf(core_dump_write_config_t *write_cfg)
|
||||
self.elf_stage = ELF_STAGE_CALC_SPACE;
|
||||
ESP_COREDUMP_LOG_PROCESS("================= Calc data size ===============");
|
||||
int ret = esp_core_dump_do_write_elf_pass(&self);
|
||||
if (ret < 0) return ret;
|
||||
if (ret < 0) {
|
||||
return ret;
|
||||
}
|
||||
tot_len += ret;
|
||||
ESP_COREDUMP_LOG_PROCESS("Core dump tot_len=%lu", tot_len);
|
||||
ESP_COREDUMP_LOG_PROCESS("============== Data size = %d bytes ============", tot_len);
|
||||
@ -728,7 +728,9 @@ esp_err_t esp_core_dump_write_elf(core_dump_write_config_t *write_cfg)
|
||||
// set initial offset to elf segments data area
|
||||
self.elf_next_data_offset = sizeof(elfhdr) + ELF_SEG_HEADERS_COUNT(&self) * sizeof(elf_phdr);
|
||||
ret = esp_core_dump_do_write_elf_pass(&self);
|
||||
if (ret < 0) return ret;
|
||||
if (ret < 0) {
|
||||
return ret;
|
||||
}
|
||||
write_len += ret;
|
||||
ESP_COREDUMP_LOG_PROCESS("============== Headers size = %d bytes ============", write_len);
|
||||
|
||||
@ -736,7 +738,9 @@ esp_err_t esp_core_dump_write_elf(core_dump_write_config_t *write_cfg)
|
||||
// set initial offset to elf segments data area, this is not necessary in this stage, just for pretty debug output
|
||||
self.elf_next_data_offset = sizeof(elfhdr) + ELF_SEG_HEADERS_COUNT(&self) * sizeof(elf_phdr);
|
||||
ret = esp_core_dump_do_write_elf_pass(&self);
|
||||
if (ret < 0) return ret;
|
||||
if (ret < 0) {
|
||||
return ret;
|
||||
}
|
||||
write_len += ret;
|
||||
ESP_COREDUMP_LOG_PROCESS("=========== Data written size = %d bytes ==========", write_len);
|
||||
|
||||
@ -768,7 +772,7 @@ typedef struct {
|
||||
static esp_err_t elf_core_dump_image_mmap(esp_partition_mmap_handle_t* core_data_handle, const void **map_addr)
|
||||
{
|
||||
size_t out_size;
|
||||
assert (core_data_handle);
|
||||
assert(core_data_handle);
|
||||
assert(map_addr);
|
||||
|
||||
/* Find the partition that could potentially contain a (previous) core dump. */
|
||||
|
@ -19,8 +19,7 @@ const static char TAG[] __attribute__((unused)) = "esp_core_dump_flash";
|
||||
|
||||
#if CONFIG_ESP_COREDUMP_ENABLE_TO_FLASH
|
||||
|
||||
typedef struct _core_dump_partition_t
|
||||
{
|
||||
typedef struct _core_dump_partition_t {
|
||||
/* Core dump partition start. */
|
||||
uint32_t start;
|
||||
/* Core dump partition size. */
|
||||
@ -35,8 +34,7 @@ typedef struct _core_dump_partition_t
|
||||
|
||||
typedef uint32_t core_dump_crc_t;
|
||||
|
||||
typedef struct _core_dump_flash_config_t
|
||||
{
|
||||
typedef struct _core_dump_flash_config_t {
|
||||
/* Core dump partition config. */
|
||||
core_dump_partition_t partition;
|
||||
/* CRC of core dump partition config. */
|
||||
@ -119,10 +117,11 @@ static esp_err_t esp_core_dump_flash_write_data(core_dump_write_data_t* priv, ui
|
||||
/* Some bytes are in the cache, let's continue filling the cache
|
||||
* with the data received as parameter. Let's calculate the maximum
|
||||
* amount of bytes we can still fill the cache with. */
|
||||
if ((COREDUMP_CACHE_SIZE - wr_data->cached_bytes) > data_size)
|
||||
if ((COREDUMP_CACHE_SIZE - wr_data->cached_bytes) > data_size) {
|
||||
wr_sz = data_size;
|
||||
else
|
||||
} else {
|
||||
wr_sz = COREDUMP_CACHE_SIZE - wr_data->cached_bytes;
|
||||
}
|
||||
|
||||
/* Append wr_sz bytes from data parameter to the cache. */
|
||||
memcpy(&wr_data->cached_data[wr_data->cached_bytes], data, wr_sz);
|
||||
|
@ -21,7 +21,8 @@ const static char TAG[] __attribute__((unused)) = "esp_core_dump_uart";
|
||||
* explicitly the header for each board. */
|
||||
int esp_clk_cpu_freq(void);
|
||||
|
||||
static void esp_core_dump_b64_encode(const uint8_t *src, uint32_t src_len, uint8_t *dst) {
|
||||
static void esp_core_dump_b64_encode(const uint8_t *src, uint32_t src_len, uint8_t *dst)
|
||||
{
|
||||
const static char b64[] =
|
||||
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
||||
int i, j, a, b, c;
|
||||
@ -97,7 +98,9 @@ static esp_err_t esp_core_dump_uart_write_data(core_dump_write_data_t *priv, voi
|
||||
|
||||
while (addr < end) {
|
||||
size_t len = end - addr;
|
||||
if (len > 48) len = 48;
|
||||
if (len > 48) {
|
||||
len = 48;
|
||||
}
|
||||
/* Copy to stack to avoid alignment restrictions. */
|
||||
char *tmp = buf + (sizeof(buf) - len);
|
||||
memcpy(tmp, addr, len);
|
||||
@ -113,7 +116,8 @@ static esp_err_t esp_core_dump_uart_write_data(core_dump_write_data_t *priv, voi
|
||||
return err;
|
||||
}
|
||||
|
||||
static int esp_core_dump_uart_get_char(void) {
|
||||
static int esp_core_dump_uart_get_char(void)
|
||||
{
|
||||
int i = -1;
|
||||
uint32_t reg = (READ_PERI_REG(UART_STATUS_REG(0)) >> UART_RXFIFO_CNT_S) & UART_RXFIFO_CNT;
|
||||
if (reg) {
|
||||
@ -130,7 +134,7 @@ void esp_core_dump_to_uart(panic_info_t *info)
|
||||
.start = esp_core_dump_uart_write_start,
|
||||
.end = esp_core_dump_uart_write_end,
|
||||
.write = esp_core_dump_uart_write_data,
|
||||
.priv = (void*)&wr_data
|
||||
.priv = (void*) &wr_data
|
||||
};
|
||||
uint32_t tm_end = 0;
|
||||
uint32_t tm_cur = 0;
|
||||
@ -153,7 +157,7 @@ void esp_core_dump_to_uart(panic_info_t *info)
|
||||
ch = esp_core_dump_uart_get_char();
|
||||
while (!(ch == '\n' || ch == '\r')) {
|
||||
tm_cur = esp_cpu_get_cycle_count() / cpu_ticks_per_ms;
|
||||
if (tm_cur >= tm_end){
|
||||
if (tm_cur >= tm_end) {
|
||||
break;
|
||||
}
|
||||
ch = esp_core_dump_uart_get_char();
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2015-2022 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2015-2024 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
@ -144,7 +144,6 @@ typedef struct {
|
||||
uint32_t isr_context;
|
||||
} riscv_extra_info_t;
|
||||
|
||||
|
||||
/* Allocate the fake stack that will be used by broken tasks. */
|
||||
static RvExcFrame s_fake_stack_frame = {
|
||||
.mepc = COREDUMP_FAKE_STACK_START,
|
||||
@ -214,7 +213,7 @@ uint8_t* esp_core_dump_get_isr_stack_top(void)
|
||||
uint32_t esp_core_dump_get_isr_stack_end(void)
|
||||
{
|
||||
uint8_t* isr_top_stack = esp_core_dump_get_isr_stack_top();
|
||||
return (uint32_t)(isr_top_stack + (xPortGetCoreID()+1)*configISR_STACK_SIZE);
|
||||
return (uint32_t)(isr_top_stack + (xPortGetCoreID() + 1) * configISR_STACK_SIZE);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -238,7 +237,7 @@ bool esp_core_dump_check_stack(core_dump_task_header_t *task)
|
||||
if (!esp_stack_ptr_is_sane(task->stack_start) ||
|
||||
!esp_core_dump_task_stack_end_is_sane(task->stack_end) ||
|
||||
(task->stack_start >= task->stack_end) ||
|
||||
((task->stack_end-task->stack_start) > COREDUMP_MAX_TASK_STACK_SIZE)) {
|
||||
((task->stack_end - task->stack_start) > COREDUMP_MAX_TASK_STACK_SIZE)) {
|
||||
// Check if current task stack is corrupted
|
||||
ESP_COREDUMP_LOG_PROCESS("Invalid stack (%x...%x)!", task->stack_start, task->stack_end);
|
||||
return false;
|
||||
@ -308,11 +307,11 @@ bool esp_core_dump_check_task(core_dump_task_header_t *task)
|
||||
*/
|
||||
bool esp_core_dump_mem_seg_is_sane(uint32_t addr, uint32_t sz)
|
||||
{
|
||||
return (esp_ptr_in_dram((void *)addr) && esp_ptr_in_dram((void *)(addr+sz-1)))
|
||||
|| (esp_ptr_in_rtc_slow((void *)addr) && esp_ptr_in_rtc_slow((void *)(addr+sz-1)))
|
||||
|| (esp_ptr_in_rtc_dram_fast((void *)addr) && esp_ptr_in_rtc_dram_fast((void *)(addr+sz-1)))
|
||||
|| (esp_ptr_external_ram((void *)addr) && esp_ptr_external_ram((void *)(addr+sz-1)))
|
||||
|| (esp_ptr_in_iram((void *)addr) && esp_ptr_in_iram((void *)(addr+sz-1)));
|
||||
return (esp_ptr_in_dram((void *)addr) && esp_ptr_in_dram((void *)(addr + sz - 1)))
|
||||
|| (esp_ptr_in_rtc_slow((void *)addr) && esp_ptr_in_rtc_slow((void *)(addr + sz - 1)))
|
||||
|| (esp_ptr_in_rtc_dram_fast((void *)addr) && esp_ptr_in_rtc_dram_fast((void *)(addr + sz - 1)))
|
||||
|| (esp_ptr_external_ram((void *)addr) && esp_ptr_external_ram((void *)(addr + sz - 1)))
|
||||
|| (esp_ptr_in_iram((void *)addr) && esp_ptr_in_iram((void *)(addr + sz - 1)));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -355,7 +354,8 @@ uint32_t esp_core_dump_get_task_regs_dump(core_dump_task_header_t *task, void **
|
||||
/**
|
||||
* Save the crashed task handle in the extra info structure.
|
||||
*/
|
||||
void esp_core_dump_port_set_crashed_tcb(uint32_t handle) {
|
||||
void esp_core_dump_port_set_crashed_tcb(uint32_t handle)
|
||||
{
|
||||
s_extra_info.crashed_task_tcb = handle;
|
||||
}
|
||||
|
||||
@ -420,7 +420,7 @@ void esp_core_dump_summary_parse_backtrace_info(esp_core_dump_bt_info_t *bt_info
|
||||
/* Check whether the stack is a fake stack created during coredump generation
|
||||
* If its a fake stack, we don't have any actual stack dump
|
||||
*/
|
||||
if (vaddr >= (void*) COREDUMP_FAKE_STACK_START && vaddr < (void*) COREDUMP_FAKE_STACK_LIMIT) {
|
||||
if (vaddr >= (void *) COREDUMP_FAKE_STACK_START && vaddr < (void *) COREDUMP_FAKE_STACK_LIMIT) {
|
||||
bt_info->dump_size = 0;
|
||||
return;
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2015-2023 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2015-2024 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
@ -44,8 +44,7 @@ const static char TAG[] __attribute__((unused)) = "esp_core_dump_port";
|
||||
|
||||
// Enumeration of registers of exception stack frame
|
||||
// and solicited stack frame
|
||||
typedef enum
|
||||
{
|
||||
typedef enum {
|
||||
// XT_SOL_EXIT = 0,
|
||||
XT_SOL_PC = 1,
|
||||
XT_SOL_PS = 2,
|
||||
@ -69,8 +68,7 @@ typedef enum
|
||||
|
||||
// Xtensa ELF core file register set representation ('.reg' section).
|
||||
// Copied from target-side ELF header <xtensa/elf.h>.
|
||||
typedef struct
|
||||
{
|
||||
typedef struct {
|
||||
uint32_t pc;
|
||||
uint32_t ps;
|
||||
uint32_t lbeg;
|
||||
@ -79,18 +77,16 @@ typedef struct
|
||||
uint32_t sar;
|
||||
uint32_t windowstart;
|
||||
uint32_t windowbase;
|
||||
uint32_t reserved[8+48];
|
||||
uint32_t reserved[8 + 48];
|
||||
uint32_t ar[XCHAL_NUM_AREGS];
|
||||
} __attribute__((packed)) xtensa_gregset_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
typedef struct {
|
||||
uint32_t reg_index;
|
||||
uint32_t reg_val;
|
||||
} __attribute__((packed)) core_dump_reg_pair_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
typedef struct {
|
||||
uint32_t crashed_task_tcb;
|
||||
core_dump_reg_pair_t exccause;
|
||||
core_dump_reg_pair_t excvaddr;
|
||||
@ -99,8 +95,7 @@ typedef struct
|
||||
} __attribute__((packed)) xtensa_extra_info_t;
|
||||
|
||||
// Xtensa Program Status for GDB
|
||||
typedef struct
|
||||
{
|
||||
typedef struct {
|
||||
uint32_t si_signo;
|
||||
uint32_t si_code;
|
||||
uint32_t si_errno;
|
||||
@ -118,8 +113,7 @@ typedef struct
|
||||
uint64_t pr_cstime;
|
||||
} __attribute__((packed)) xtensa_pr_status_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
typedef struct {
|
||||
xtensa_pr_status_t pr_status;
|
||||
xtensa_gregset_t regs;
|
||||
// Todo: acc to xtensa_gregset_t number of regs must be 128,
|
||||
@ -132,7 +126,7 @@ typedef struct
|
||||
static XtExcFrame s_fake_stack_frame = {
|
||||
.pc = (UBaseType_t) COREDUMP_FAKE_STACK_START, // task entrypoint fake_ptr
|
||||
.a0 = (UBaseType_t) 0, // to terminate GDB backtrace
|
||||
.a1 = (UBaseType_t) (COREDUMP_FAKE_STACK_START + sizeof(XtExcFrame)), // physical top of stack frame
|
||||
.a1 = (UBaseType_t)(COREDUMP_FAKE_STACK_START + sizeof(XtExcFrame)), // physical top of stack frame
|
||||
.exit = (UBaseType_t) 0, // user exception exit dispatcher
|
||||
.ps = (PS_UM | PS_EXCM),
|
||||
.exccause = (UBaseType_t) COREDUMP_INVALID_CAUSE_VALUE,
|
||||
@ -152,10 +146,9 @@ static xtensa_extra_info_t s_extra_info;
|
||||
static void *esp_core_dump_get_fake_stack(uint32_t *stk_len)
|
||||
{
|
||||
*stk_len = sizeof(s_fake_stack_frame);
|
||||
return (uint8_t*)COREDUMP_FAKE_STACK_START + sizeof(s_fake_stack_frame)*s_fake_stacks_num++;
|
||||
return (uint8_t*)COREDUMP_FAKE_STACK_START + sizeof(s_fake_stack_frame) * s_fake_stacks_num++;
|
||||
}
|
||||
|
||||
|
||||
static core_dump_reg_pair_t *esp_core_dump_get_epc_regs(core_dump_reg_pair_t* src)
|
||||
{
|
||||
#pragma GCC diagnostic push
|
||||
@ -210,8 +203,7 @@ static esp_err_t esp_core_dump_get_regs_from_stack(void* stack_addr,
|
||||
uint32_t rc = exc_frame->exit;
|
||||
|
||||
// is this current crashed task?
|
||||
if (rc == COREDUMP_CURR_TASK_MARKER)
|
||||
{
|
||||
if (rc == COREDUMP_CURR_TASK_MARKER) {
|
||||
s_extra_info.exccause.reg_val = exc_frame->exccause;
|
||||
s_extra_info.exccause.reg_index = EXCCAUSE;
|
||||
s_extra_info.excvaddr.reg_val = exc_frame->excvaddr;
|
||||
@ -301,10 +293,9 @@ uint8_t* esp_core_dump_get_isr_stack_top(void)
|
||||
uint32_t esp_core_dump_get_isr_stack_end(void)
|
||||
{
|
||||
uint8_t* isr_top_stack = esp_core_dump_get_isr_stack_top();
|
||||
return (uint32_t)(isr_top_stack + (xPortGetCoreID()+1)*configISR_STACK_SIZE);
|
||||
return (uint32_t)(isr_top_stack + (xPortGetCoreID() + 1) * configISR_STACK_SIZE);
|
||||
}
|
||||
|
||||
|
||||
static inline bool esp_core_dump_task_stack_end_is_sane(uint32_t sp)
|
||||
{
|
||||
return esp_ptr_in_dram((void *)sp)
|
||||
@ -317,14 +308,13 @@ static inline bool esp_core_dump_task_stack_end_is_sane(uint32_t sp)
|
||||
;
|
||||
}
|
||||
|
||||
|
||||
bool esp_core_dump_check_stack(core_dump_task_header_t *task)
|
||||
{
|
||||
// Check task's stack
|
||||
if (!esp_stack_ptr_is_sane(task->stack_start) ||
|
||||
!esp_core_dump_task_stack_end_is_sane(task->stack_end) ||
|
||||
(task->stack_start >= task->stack_end) ||
|
||||
((task->stack_end-task->stack_start) > COREDUMP_MAX_TASK_STACK_SIZE)) {
|
||||
((task->stack_end - task->stack_start) > COREDUMP_MAX_TASK_STACK_SIZE)) {
|
||||
// Check if current task stack is corrupted
|
||||
ESP_COREDUMP_LOG_PROCESS("Invalid stack (%x...%x)!", task->stack_start, task->stack_end);
|
||||
return false;
|
||||
@ -339,11 +329,11 @@ bool esp_core_dump_check_stack(core_dump_task_header_t *task)
|
||||
*/
|
||||
bool esp_core_dump_mem_seg_is_sane(uint32_t addr, uint32_t sz)
|
||||
{
|
||||
return (esp_ptr_in_dram((void *)addr) && esp_ptr_in_dram((void *)(addr+sz-1)))
|
||||
|| (esp_ptr_in_rtc_slow((void *)addr) && esp_ptr_in_rtc_slow((void *)(addr+sz-1)))
|
||||
|| (esp_ptr_in_rtc_dram_fast((void *)addr) && esp_ptr_in_rtc_dram_fast((void *)(addr+sz-1)))
|
||||
|| (esp_ptr_external_ram((void *)addr) && esp_ptr_external_ram((void *)(addr+sz-1)))
|
||||
|| (esp_ptr_in_iram((void *)addr) && esp_ptr_in_iram((void *)(addr+sz-1)));
|
||||
return (esp_ptr_in_dram((void *)addr) && esp_ptr_in_dram((void *)(addr + sz - 1)))
|
||||
|| (esp_ptr_in_rtc_slow((void *)addr) && esp_ptr_in_rtc_slow((void *)(addr + sz - 1)))
|
||||
|| (esp_ptr_in_rtc_dram_fast((void *)addr) && esp_ptr_in_rtc_dram_fast((void *)(addr + sz - 1)))
|
||||
|| (esp_ptr_external_ram((void *)addr) && esp_ptr_external_ram((void *)(addr + sz - 1)))
|
||||
|| (esp_ptr_in_iram((void *)addr) && esp_ptr_in_iram((void *)(addr + sz - 1)));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -416,7 +406,7 @@ bool esp_core_dump_check_task(core_dump_task_header_t *task)
|
||||
sol_frame->a1);
|
||||
} else {
|
||||
// to avoid warning that 'exc_frame' is unused when ESP_COREDUMP_LOG_PROCESS does nothing
|
||||
#if CONFIG_ESP_COREDUMP_ENABLE_TO_FLASH && CONFIG_ESP_COREDUMP_LOGS
|
||||
#if CONFIG_ESP_COREDUMP_ENABLE_TO_FLASH && CONFIG_ESP_COREDUMP_LOGS
|
||||
XtExcFrame *exc_frame = (XtExcFrame *)task->stack_start;
|
||||
ESP_COREDUMP_LOG_PROCESS("Task (TCB:%x) EXIT/PC/PS/A0/SP %x %x %x %x %x",
|
||||
task->tcb_addr,
|
||||
@ -425,13 +415,12 @@ bool esp_core_dump_check_task(core_dump_task_header_t *task)
|
||||
exc_frame->ps,
|
||||
exc_frame->a0,
|
||||
exc_frame->a1);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get a dump of the task's registers.
|
||||
* Check core dump port interface for more information about this function.
|
||||
@ -464,8 +453,8 @@ uint32_t esp_core_dump_get_task_regs_dump(core_dump_task_header_t *task, void **
|
||||
return sizeof(s_reg_dump);
|
||||
}
|
||||
|
||||
|
||||
void esp_core_dump_port_set_crashed_tcb(uint32_t handle) {
|
||||
void esp_core_dump_port_set_crashed_tcb(uint32_t handle)
|
||||
{
|
||||
s_extra_info.crashed_task_tcb = handle;
|
||||
}
|
||||
|
||||
@ -496,7 +485,7 @@ void esp_core_dump_summary_parse_extra_info(esp_core_dump_summary_t *summary, vo
|
||||
|
||||
memset(summary->ex_info.epcx, 0, sizeof(summary->ex_info.epcx));
|
||||
summary->ex_info.epcx_reg_bits = 0;
|
||||
for (i = 0; i < COREDUMP_EXTRA_REG_NUM; i++ ) {
|
||||
for (i = 0; i < COREDUMP_EXTRA_REG_NUM; i++) {
|
||||
if (ei->extra_regs[i].reg_index >= EPC_1
|
||||
&& ei->extra_regs[i].reg_index < (EPC_1 + XCHAL_NUM_INTLEVELS)) {
|
||||
summary->ex_info.epcx[ei->extra_regs[i].reg_index - EPC_1] = ei->extra_regs[i].reg_val;
|
||||
@ -531,7 +520,7 @@ void esp_core_dump_summary_parse_backtrace_info(esp_core_dump_bt_info_t *bt_info
|
||||
bool corrupted;
|
||||
esp_backtrace_frame_t frame;
|
||||
XtExcFrame *stack = (XtExcFrame *) paddr;
|
||||
int max_depth = (int) (sizeof(bt_info->bt) / sizeof(bt_info->bt[0]));
|
||||
int max_depth = (int)(sizeof(bt_info->bt) / sizeof(bt_info->bt[0]));
|
||||
int index = 0;
|
||||
|
||||
frame.pc = stack->pc;
|
||||
|
@ -30,7 +30,7 @@ extern int _coredump_rtc_fast_end;
|
||||
static inline bool is_addr_in_region(void *addr, uint8_t *region, int region_size)
|
||||
{
|
||||
const void *start = (void *) region;
|
||||
const void *end = (void *) (region + region_size);
|
||||
const void *end = (void *)(region + region_size);
|
||||
return addr >= start && addr < end;
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2015-2023 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2015-2024 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
@ -291,9 +291,9 @@ static bool enum_stage_start(enum_ctrl_t *enum_ctrl)
|
||||
enum_ctrl->pipe = enum_dflt_pipe_hdl;
|
||||
|
||||
// Flag to gracefully exit the enumeration process if requested by the user in the enumeration filter cb
|
||||
#ifdef ENABLE_ENUM_FILTER_CALLBACK
|
||||
#ifdef ENABLE_ENUM_FILTER_CALLBACK
|
||||
enum_ctrl->graceful_exit = false;
|
||||
#endif // ENABLE_ENUM_FILTER_CALLBACK
|
||||
#endif // ENABLE_ENUM_FILTER_CALLBACK
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -339,7 +339,7 @@ static void get_string_desc_index_and_langid(enum_ctrl_t *enum_ctrl, uint8_t *in
|
||||
|
||||
static bool set_config_index(enum_ctrl_t *enum_ctrl, const usb_device_desc_t *device_desc)
|
||||
{
|
||||
#ifdef ENABLE_ENUM_FILTER_CALLBACK
|
||||
#ifdef ENABLE_ENUM_FILTER_CALLBACK
|
||||
// Callback enabled in the menuncofig, but the callback function was not defined
|
||||
if (enum_ctrl->enum_filter_cb == NULL) {
|
||||
enum_ctrl->enum_config_index = ENUM_CONFIG_INDEX_DEFAULT;
|
||||
@ -363,9 +363,9 @@ static bool set_config_index(enum_ctrl_t *enum_ctrl, const usb_device_desc_t *de
|
||||
} else {
|
||||
enum_ctrl->enum_config_index = enum_config_index - 1;
|
||||
}
|
||||
#else // ENABLE_ENUM_FILTER_CALLBACK
|
||||
#else // ENABLE_ENUM_FILTER_CALLBACK
|
||||
enum_ctrl->enum_config_index = ENUM_CONFIG_INDEX_DEFAULT;
|
||||
#endif // ENABLE_ENUM_FILTER_CALLBACK
|
||||
#endif // ENABLE_ENUM_FILTER_CALLBACK
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -971,15 +971,15 @@ static void enum_handle_events(void)
|
||||
if (stage_pass) {
|
||||
ESP_LOGD(HUB_DRIVER_TAG, "Stage done: %s", enum_stage_strings[enum_ctrl->stage]);
|
||||
} else {
|
||||
#ifdef ENABLE_ENUM_FILTER_CALLBACK
|
||||
#ifdef ENABLE_ENUM_FILTER_CALLBACK
|
||||
if (!enum_ctrl->graceful_exit) {
|
||||
ESP_LOGE(HUB_DRIVER_TAG, "Stage failed: %s", enum_stage_strings[enum_ctrl->stage]);
|
||||
} else {
|
||||
ESP_LOGD(HUB_DRIVER_TAG, "Stage done: %s", enum_stage_strings[enum_ctrl->stage]);
|
||||
}
|
||||
#else // ENABLE_ENUM_FILTER_CALLBACK
|
||||
#else // ENABLE_ENUM_FILTER_CALLBACK
|
||||
ESP_LOGE(HUB_DRIVER_TAG, "Stage failed: %s", enum_stage_strings[enum_ctrl->stage]);
|
||||
#endif // ENABLE_ENUM_FILTER_CALLBACK
|
||||
#endif // ENABLE_ENUM_FILTER_CALLBACK
|
||||
}
|
||||
enum_set_next_stage(enum_ctrl, stage_pass);
|
||||
}
|
||||
@ -1014,9 +1014,9 @@ esp_err_t hub_install(hub_config_t *hub_config)
|
||||
hub_driver_obj->dynamic.driver_state = HUB_DRIVER_STATE_INSTALLED;
|
||||
hub_driver_obj->single_thread.enum_ctrl.stage = ENUM_STAGE_NONE;
|
||||
hub_driver_obj->single_thread.enum_ctrl.urb = enum_urb;
|
||||
#ifdef ENABLE_ENUM_FILTER_CALLBACK
|
||||
#ifdef ENABLE_ENUM_FILTER_CALLBACK
|
||||
hub_driver_obj->single_thread.enum_ctrl.enum_filter_cb = hub_config->enum_filter_cb;
|
||||
#endif // ENABLE_ENUM_FILTER_CALLBACK
|
||||
#endif // ENABLE_ENUM_FILTER_CALLBACK
|
||||
hub_driver_obj->constant.root_port_hdl = port_hdl;
|
||||
hub_driver_obj->constant.proc_req_cb = hub_config->proc_req_cb;
|
||||
hub_driver_obj->constant.proc_req_cb_arg = hub_config->proc_req_cb_arg;
|
||||
|
@ -22,7 +22,6 @@ extern "C" {
|
||||
|
||||
// ---------------------------------------------------- HID Mouse ------------------------------------------------------
|
||||
|
||||
|
||||
/*
|
||||
Note: The mock HID mouse tests require that USB low speed mouse be connected. The mouse should...
|
||||
|
||||
|
@ -70,7 +70,6 @@ components_not_formatted_temporary:
|
||||
- "/components/esp_rom/"
|
||||
- "/components/esp_wifi/"
|
||||
- "/components/esp-tls/"
|
||||
- "/components/espcoredump/"
|
||||
- "/components/esptool_py/"
|
||||
- "/components/fatfs/"
|
||||
- "/components/hal/"
|
||||
@ -165,6 +164,8 @@ components_not_formatted_permanent:
|
||||
# Example resource files (generated)
|
||||
- "/examples/peripherals/lcd/i80_controller/main/images/"
|
||||
- "/examples/peripherals/dac/dac_continuous/dac_audio/main/audio_example_file.h"
|
||||
# Coredump (generated)
|
||||
- /components/espcoredump/include_core_dump/elf.h
|
||||
|
||||
docs:
|
||||
# Docs directory contains some .inc files, which are not C include files
|
||||
|
Loading…
Reference in New Issue
Block a user