mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
Merge branch 'staging/espcoredump_move_strings_flash_v5.0' into 'release/v5.0'
change(espcoredump): save RAM space by placing constants in flash (backport v5.0) See merge request espressif/esp-idf!29192
This commit is contained in:
commit
3bb82f7ce4
@ -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
|
||||
*/
|
||||
@ -19,7 +19,7 @@ extern "C" {
|
||||
#include "core_dump_checksum.h"
|
||||
|
||||
#if CONFIG_ESP_COREDUMP_LOGS
|
||||
#define ESP_COREDUMP_LOG( level, format, ... ) if (LOG_LOCAL_LEVEL >= level) { esp_rom_printf(DRAM_STR(format), esp_log_early_timestamp(), (const char *)TAG, ##__VA_ARGS__); }
|
||||
#define ESP_COREDUMP_LOG( level, format, ... ) if (LOG_LOCAL_LEVEL >= level) { esp_rom_printf((format), esp_log_early_timestamp(), (const char *)TAG, ##__VA_ARGS__); }
|
||||
#else
|
||||
#define ESP_COREDUMP_LOG( level, format, ... ) // dummy define doing nothing
|
||||
#endif
|
||||
@ -30,6 +30,11 @@ extern "C" {
|
||||
#define ESP_COREDUMP_LOGD( format, ... ) ESP_COREDUMP_LOG(ESP_LOG_DEBUG, LOG_FORMAT(D, format), ##__VA_ARGS__)
|
||||
#define ESP_COREDUMP_LOGV( format, ... ) ESP_COREDUMP_LOG(ESP_LOG_VERBOSE, LOG_FORMAT(V, format), ##__VA_ARGS__)
|
||||
|
||||
/**
|
||||
* @brief Always print the given message, regardless of the log level
|
||||
*/
|
||||
#define ESP_COREDUMP_PRINT( format, ... ) do { esp_rom_printf((format), ##__VA_ARGS__); } while(0)
|
||||
|
||||
/**
|
||||
* @brief Assertion to be verified in a release context. Cannot be muted.
|
||||
*/
|
||||
|
@ -37,11 +37,13 @@ entries:
|
||||
archive: libespcoredump.a
|
||||
entries:
|
||||
if ESP_PANIC_HANDLER_IRAM = y:
|
||||
core_dump_uart (noflash_text)
|
||||
core_dump_flash (noflash_text)
|
||||
core_dump_common (noflash_text)
|
||||
core_dump_port (noflash_text)
|
||||
core_dump_elf (noflash_text)
|
||||
core_dump_uart (noflash)
|
||||
core_dump_flash (noflash)
|
||||
core_dump_common (noflash)
|
||||
core_dump_port (noflash)
|
||||
core_dump_elf (noflash)
|
||||
core_dump_checksum (noflash)
|
||||
core_dump_binary (noflash)
|
||||
else:
|
||||
* (default)
|
||||
|
||||
|
@ -13,7 +13,7 @@
|
||||
|
||||
#if CONFIG_ESP_COREDUMP_DATA_FORMAT_BIN
|
||||
|
||||
const static DRAM_ATTR char TAG[] __attribute__((unused)) = "esp_core_dump_binary";
|
||||
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,
|
||||
|
@ -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
|
||||
*/
|
||||
@ -26,7 +26,7 @@
|
||||
|
||||
#if CONFIG_ESP_COREDUMP_ENABLE
|
||||
|
||||
const static DRAM_ATTR char TAG[] __attribute__((unused)) = "esp_core_dump_checksum";
|
||||
const static char TAG[] __attribute__((unused)) = "esp_core_dump_checksum";
|
||||
|
||||
#define COREDUMP_SHA256_LEN 32
|
||||
|
||||
@ -147,13 +147,13 @@ static void esp_core_dump_print_sha256(const char* msg, const uint8_t* sha_outpu
|
||||
/* As this function is only called by `esp_core_dump_print_checksum`, we
|
||||
* have the guarantee that sha_output is not NULL. */
|
||||
if (msg != NULL) {
|
||||
esp_rom_printf(DRAM_STR("%s='"), msg);
|
||||
ESP_COREDUMP_PRINT("%s='", msg);
|
||||
}
|
||||
|
||||
for (int i = 0; i < COREDUMP_SHA256_LEN; i++) {
|
||||
esp_rom_printf(DRAM_STR("%02x"), sha_output[i]);
|
||||
ESP_COREDUMP_PRINT("%02x", sha_output[i]);
|
||||
}
|
||||
esp_rom_printf(DRAM_STR("'\r\n"));
|
||||
ESP_COREDUMP_PRINT("'\r\n");
|
||||
}
|
||||
|
||||
#endif
|
||||
@ -170,10 +170,10 @@ void esp_core_dump_print_checksum(const char* msg, core_dump_checksum_bytes chec
|
||||
|
||||
#if CONFIG_ESP_COREDUMP_CHECKSUM_CRC32
|
||||
if (msg != NULL) {
|
||||
esp_rom_printf(DRAM_STR("%s='"), msg);
|
||||
ESP_COREDUMP_PRINT("%s='", msg);
|
||||
}
|
||||
esp_rom_printf(DRAM_STR("%08x"), *((const uint32_t*) checksum));
|
||||
esp_rom_printf(DRAM_STR("'\r\n"));
|
||||
ESP_COREDUMP_PRINT("%08x", *((const uint32_t*) checksum));
|
||||
ESP_COREDUMP_PRINT("'\r\n");
|
||||
#elif CONFIG_ESP_COREDUMP_CHECKSUM_SHA256
|
||||
esp_core_dump_print_sha256(msg, (const uint8_t*) checksum);
|
||||
#endif
|
||||
|
@ -15,7 +15,7 @@
|
||||
#include "core_dump_elf.h"
|
||||
#include "core_dump_binary.h"
|
||||
|
||||
const static DRAM_ATTR char TAG[] __attribute__((unused)) = "esp_core_dump_common";
|
||||
const static char TAG[] __attribute__((unused)) = "esp_core_dump_common";
|
||||
|
||||
#if CONFIG_ESP_COREDUMP_ENABLE
|
||||
|
||||
|
@ -69,7 +69,7 @@ typedef struct
|
||||
uint8_t app_elf_sha256[ELF_APP_SHA256_SIZE]; // sha256 of elf file
|
||||
} core_dump_elf_version_info_t;
|
||||
|
||||
const static DRAM_ATTR char TAG[] __attribute__((unused)) = "esp_core_dump_elf";
|
||||
const static char TAG[] __attribute__((unused)) = "esp_core_dump_elf";
|
||||
|
||||
// Main ELF handle type
|
||||
typedef struct _core_dump_elf_t
|
||||
|
@ -15,7 +15,7 @@
|
||||
|
||||
#define BLANK_COREDUMP_SIZE 0xFFFFFFFF
|
||||
|
||||
const static DRAM_ATTR char TAG[] __attribute__((unused)) = "esp_core_dump_flash";
|
||||
const static char TAG[] __attribute__((unused)) = "esp_core_dump_flash";
|
||||
|
||||
#if CONFIG_ESP_COREDUMP_ENABLE_TO_FLASH
|
||||
|
||||
|
@ -13,7 +13,7 @@
|
||||
#include "esp_core_dump_common.h"
|
||||
#include "esp_rom_sys.h"
|
||||
|
||||
const static DRAM_ATTR char TAG[] __attribute__((unused)) = "esp_core_dump_uart";
|
||||
const static char TAG[] __attribute__((unused)) = "esp_core_dump_uart";
|
||||
|
||||
#if CONFIG_ESP_COREDUMP_ENABLE_TO_UART
|
||||
|
||||
@ -22,7 +22,7 @@ const static DRAM_ATTR char TAG[] __attribute__((unused)) = "esp_core_dump_uart"
|
||||
int esp_clk_cpu_freq(void);
|
||||
|
||||
static void esp_core_dump_b64_encode(const uint8_t *src, uint32_t src_len, uint8_t *dst) {
|
||||
const static DRAM_ATTR char b64[] =
|
||||
const static char b64[] =
|
||||
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
||||
int i, j, a, b, c;
|
||||
|
||||
@ -53,7 +53,7 @@ static esp_err_t esp_core_dump_uart_write_start(core_dump_write_data_t *priv)
|
||||
|
||||
ESP_COREDUMP_ASSERT(priv != NULL);
|
||||
esp_core_dump_checksum_init(&wr_data->checksum_ctx);
|
||||
esp_rom_printf(DRAM_STR("================= CORE DUMP START =================\r\n"));
|
||||
ESP_COREDUMP_PRINT("================= CORE DUMP START =================\r\n");
|
||||
return err;
|
||||
}
|
||||
|
||||
@ -74,12 +74,12 @@ static esp_err_t esp_core_dump_uart_write_end(core_dump_write_data_t *priv)
|
||||
size_t cs_len = esp_core_dump_checksum_finish(wr_data->checksum_ctx, &cs_addr);
|
||||
wr_data->off += cs_len;
|
||||
esp_core_dump_b64_encode((const uint8_t *)cs_addr, cs_len, (uint8_t*)&buf[0]);
|
||||
esp_rom_printf(DRAM_STR("%s\r\n"), buf);
|
||||
ESP_COREDUMP_PRINT("%s\r\n", buf);
|
||||
}
|
||||
esp_rom_printf(DRAM_STR("================= CORE DUMP END =================\r\n"));
|
||||
ESP_COREDUMP_PRINT("================= CORE DUMP END =================\r\n");
|
||||
|
||||
if (cs_addr) {
|
||||
esp_core_dump_print_checksum(DRAM_STR("Coredump checksum"), cs_addr);
|
||||
esp_core_dump_print_checksum("Coredump checksum", cs_addr);
|
||||
}
|
||||
|
||||
return err;
|
||||
@ -103,7 +103,7 @@ static esp_err_t esp_core_dump_uart_write_data(core_dump_write_data_t *priv, voi
|
||||
memcpy(tmp, addr, len);
|
||||
esp_core_dump_b64_encode((const uint8_t *)tmp, len, (uint8_t *)buf);
|
||||
addr += len;
|
||||
esp_rom_printf(DRAM_STR("%s\r\n"), buf);
|
||||
ESP_COREDUMP_PRINT("%s\r\n", buf);
|
||||
}
|
||||
|
||||
if (wr_data) {
|
||||
|
@ -20,7 +20,7 @@
|
||||
#include "esp_core_dump_port.h"
|
||||
|
||||
/* TAG used for logs */
|
||||
const static DRAM_ATTR char TAG[] __attribute__((unused)) = "esp_core_dump_port";
|
||||
const static char TAG[] __attribute__((unused)) = "esp_core_dump_port";
|
||||
|
||||
/* Code associated to RISC-V in ELF format */
|
||||
#define COREDUMP_EM_RISCV 0xF3
|
||||
|
@ -21,7 +21,7 @@
|
||||
#include "esp_debug_helpers.h"
|
||||
#include "esp_cpu_utils.h"
|
||||
|
||||
const static DRAM_ATTR char TAG[] __attribute__((unused)) = "esp_core_dump_port";
|
||||
const static char TAG[] __attribute__((unused)) = "esp_core_dump_port";
|
||||
|
||||
#define min(a,b) ((a) < (b) ? (a) : (b))
|
||||
#define max(a,b) ((a) < (b) ? (b) : (a))
|
||||
|
Loading…
Reference in New Issue
Block a user