mirror of
https://github.com/espressif/esp-idf.git
synced 2026-10-02 03:00:34 +03:00
fix(esp_log): add Kconfig to optionally bypass esp_rom_vprintf
In Log V2, ESP_LOG macros are using the runtime constrained-environment path in esp_log_vprintf() reference esp_rom_vprintf as the fallback formatter. On chips where ets_vprintf is not in ROM (all targets except ESP32-S2 and ESP32-C2), this pulls ~1.2 KB of printf implementation into IRAM. Add a new Kconfig option LOG_API_CONSTRAINED_ENV_SAFE (default y) that controls whether this IRAM-resident fallback is used: Also update the logging and RAM-usage documentation accordingly. Closes https://github.com/espressif/esp-idf/issues/18346
This commit is contained in:
@@ -52,6 +52,30 @@ menu "Log"
|
||||
|
||||
rsource "./Kconfig.settings"
|
||||
|
||||
config LOG_API_CONSTRAINED_ENV_SAFE
|
||||
bool "Enable safe ESP_LOGx fallback in constrained environments (ISR, cache disabled)"
|
||||
depends on LOG_VERSION_2 && !ESP_ROM_HAS_VPRINTF_FUNC && !LOG_MODE_BINARY_EN
|
||||
default y
|
||||
help
|
||||
This option is only relevant on chips where ets_vprintf is NOT in ROM
|
||||
|
||||
When enabled, Log V2 routes ESP_DRAM_LOGx, ESP_EARLY_LOGx, and runtime
|
||||
constrained-environment log calls (ISR, cache disabled) through esp_log(),
|
||||
which uses esp_rom_vprintf for formatting.
|
||||
|
||||
When disabled, ESP_DRAM_LOGx and ESP_EARLY_LOGx expand directly
|
||||
to esp_rom_printf (a true ROM function with zero IRAM cost), bypassing
|
||||
esp_log(). Normal ESP_LOGx calls that happen to run in a constrained
|
||||
environment (ISR, cache disabled) will use the standard vprintf function
|
||||
instead of esp_rom_vprintf; if the standard vprintf resides in flash,
|
||||
such calls may crash. Use ESP_DRAM_LOGx for any logging that must work
|
||||
with cache disabled or from an ISR.
|
||||
|
||||
Disable this option to save ~1.2 KB of IRAM on memory-constrained devices.
|
||||
Enable it if you need ESP_LOGx to safely fall back to ROM-based printing
|
||||
in ISRs or with cache disabled, or if you need constrained-environment
|
||||
logs in binary log format.
|
||||
|
||||
config LOG_IN_IRAM
|
||||
bool "Place logging functions in IRAM" if SPI_FLASH_AUTO_SUSPEND
|
||||
default y
|
||||
|
||||
Reference in New Issue
Block a user