From 16d73cdab362fa5df8bdf4fb2bfbd0a1d93e2592 Mon Sep 17 00:00:00 2001 From: Konstantin Kondrashov Date: Tue, 1 Jul 2025 19:22:16 +0300 Subject: [PATCH] feat(log): Adds ESP_LOG_ATTR macro to control section placement --- components/log/include/esp_log_attr.h | 2 ++ components/spi_flash/esp_flash_api.c | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/components/log/include/esp_log_attr.h b/components/log/include/esp_log_attr.h index 49f5338529..a41fd020c6 100644 --- a/components/log/include/esp_log_attr.h +++ b/components/log/include/esp_log_attr.h @@ -15,9 +15,11 @@ extern "C" { #endif #if ESP_LOG_MODE_BINARY_EN +#define ESP_LOG_ATTR NOLOAD_ATTR #define ESP_LOG_ATTR_STR(str) (__builtin_constant_p(str) ? ESP_LOG_NOLOAD_STR(str) : str) #define ESP_LOG_ATTR_DRAM_STR(str) ESP_LOG_NOLOAD_STR(str) #else +#define ESP_LOG_ATTR #define ESP_LOG_ATTR_STR(str) (str) #define ESP_LOG_ATTR_DRAM_STR(str) DRAM_STR(str) #endif diff --git a/components/spi_flash/esp_flash_api.c b/components/spi_flash/esp_flash_api.c index 63c1dba50f..2a52db0772 100644 --- a/components/spi_flash/esp_flash_api.c +++ b/components/spi_flash/esp_flash_api.c @@ -134,7 +134,9 @@ void spi_flash_dump_counters(void) #define IO_STR_LEN 10 -static const char io_mode_str[][IO_STR_LEN] = { +// Used only for logging, do not use for other purposes or remove ESP_LOG_ATTR. +// (this can be placed in noload section for bin logging mode). +static ESP_LOG_ATTR const char io_mode_str[][IO_STR_LEN] = { "slowrd", "fastrd", "dout",