forked from espressif/esp-idf
Merge branch 'fix/coredump-gcc-analyzer-warnings_v5.2' into 'release/v5.2'
fix(system): fix GCC-14 analyzer warnings for coredump (v5.2) See merge request espressif/esp-idf!35524
This commit is contained in:
@@ -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
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*/
|
*/
|
||||||
@@ -223,7 +223,7 @@ static inline void disable_all_wdts(void)
|
|||||||
wdt_hal_write_protect_enable(&wdt0_context);
|
wdt_hal_write_protect_enable(&wdt0_context);
|
||||||
|
|
||||||
#if SOC_TIMER_GROUPS >= 2
|
#if SOC_TIMER_GROUPS >= 2
|
||||||
//Interupt WDT is the Main Watchdog Timer of Timer Group 1
|
//Interrupt WDT is the Main Watchdog Timer of Timer Group 1
|
||||||
wdt_hal_write_protect_disable(&wdt1_context);
|
wdt_hal_write_protect_disable(&wdt1_context);
|
||||||
wdt_hal_disable(&wdt1_context);
|
wdt_hal_disable(&wdt1_context);
|
||||||
wdt_hal_write_protect_enable(&wdt1_context);
|
wdt_hal_write_protect_enable(&wdt1_context);
|
||||||
@@ -298,17 +298,17 @@ void esp_panic_handler(panic_info_t *info)
|
|||||||
// in debug mode.
|
// in debug mode.
|
||||||
#if CONFIG_ESP_DEBUG_OCDAWARE
|
#if CONFIG_ESP_DEBUG_OCDAWARE
|
||||||
if (esp_cpu_dbgr_is_attached()) {
|
if (esp_cpu_dbgr_is_attached()) {
|
||||||
char *panic_reason_str = NULL;
|
char *panic_reason_str = NULL;
|
||||||
if (info->pseudo_excause) {
|
if (info->pseudo_excause) {
|
||||||
panic_reason_str = (char *)info->reason;
|
panic_reason_str = (char *)info->reason;
|
||||||
} else if (g_panic_abort && strlen(g_panic_abort_details)) {
|
} else if (g_panic_abort) {
|
||||||
panic_reason_str = g_panic_abort_details;
|
panic_reason_str = g_panic_abort_details;
|
||||||
}
|
}
|
||||||
if (panic_reason_str) {
|
if (panic_reason_str) {
|
||||||
/* OpenOCD will print the halt cause when target is stopped at the below breakpoint (info->addr) */
|
/* OpenOCD will print the halt cause when target is stopped at the below breakpoint (info->addr) */
|
||||||
long args[] = {(long)panic_reason_str, strlen(panic_reason_str)};
|
long args[] = {(long)panic_reason_str, strlen(panic_reason_str)};
|
||||||
semihosting_call_noerrno(ESP_SEMIHOSTING_SYS_PANIC_REASON, args);
|
semihosting_call_noerrno(ESP_SEMIHOSTING_SYS_PANIC_REASON, args);
|
||||||
}
|
}
|
||||||
panic_print_str("Setting breakpoint at 0x");
|
panic_print_str("Setting breakpoint at 0x");
|
||||||
panic_print_hex((uint32_t)info->addr);
|
panic_print_hex((uint32_t)info->addr);
|
||||||
panic_print_str(" and returning...\r\n");
|
panic_print_str(" and returning...\r\n");
|
||||||
|
@@ -208,7 +208,7 @@ static int elf_write_note_header(core_dump_elf_t *self,
|
|||||||
elf_note note_hdr = { 0 };
|
elf_note note_hdr = { 0 };
|
||||||
|
|
||||||
memcpy(name_buffer, name, name_len);
|
memcpy(name_buffer, name, name_len);
|
||||||
note_hdr.n_namesz = ALIGN_UP(name_len, 4);
|
note_hdr.n_namesz = ALIGN_UP(name_len + 1, 4);
|
||||||
note_hdr.n_descsz = data_sz;
|
note_hdr.n_descsz = data_sz;
|
||||||
note_hdr.n_type = type;
|
note_hdr.n_type = type;
|
||||||
// write note header
|
// write note header
|
||||||
@@ -241,7 +241,7 @@ static int elf_write_note(core_dump_elf_t *self,
|
|||||||
// write segment data during second pass
|
// write segment data during second pass
|
||||||
if (self->elf_stage == ELF_STAGE_PLACE_DATA) {
|
if (self->elf_stage == ELF_STAGE_PLACE_DATA) {
|
||||||
ELF_CHECK_ERR(data, ELF_PROC_ERR_OTHER, "Invalid data pointer %x.", (uint32_t)data);
|
ELF_CHECK_ERR(data, ELF_PROC_ERR_OTHER, "Invalid data pointer %x.", (uint32_t)data);
|
||||||
err = elf_write_note_header(self, name, name_len, data_sz, type);
|
err = elf_write_note_header(self, name, strlen(name), data_sz, type);
|
||||||
if (err != ESP_OK) {
|
if (err != ESP_OK) {
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
@@ -543,7 +543,7 @@ static void elf_write_core_dump_note_cb(void *opaque, const char *data)
|
|||||||
|
|
||||||
static int elf_add_wdt_panic_details(core_dump_elf_t *self)
|
static int elf_add_wdt_panic_details(core_dump_elf_t *self)
|
||||||
{
|
{
|
||||||
uint32_t name_len = sizeof(ELF_ESP_CORE_DUMP_PANIC_DETAILS_NOTE_NAME);
|
uint32_t name_len = sizeof(ELF_ESP_CORE_DUMP_PANIC_DETAILS_NOTE_NAME) - 1;
|
||||||
core_dump_elf_opaque_t param = {
|
core_dump_elf_opaque_t param = {
|
||||||
.self = self,
|
.self = self,
|
||||||
.total_size = 0,
|
.total_size = 0,
|
||||||
|
@@ -168,7 +168,7 @@ static esp_err_t esp_core_dump_flash_write_data(core_dump_write_data_t* wr_data,
|
|||||||
wr_data->off += COREDUMP_CACHE_SIZE;
|
wr_data->off += COREDUMP_CACHE_SIZE;
|
||||||
|
|
||||||
/* Update checksum with the newly written data on the flash. */
|
/* Update checksum with the newly written data on the flash. */
|
||||||
esp_core_dump_checksum_update(&wr_data->checksum_ctx, &wr_data->cached_data, COREDUMP_CACHE_SIZE);
|
esp_core_dump_checksum_update(&wr_data->checksum_ctx, wr_data->cached_data, COREDUMP_CACHE_SIZE);
|
||||||
|
|
||||||
/* Reset cache from the next use. */
|
/* Reset cache from the next use. */
|
||||||
wr_data->cached_bytes = 0;
|
wr_data->cached_bytes = 0;
|
||||||
|
Reference in New Issue
Block a user