diff --git a/components/esp_gdbstub/Kconfig b/components/esp_gdbstub/Kconfig index 14e7d859c2..e380c34880 100644 --- a/components/esp_gdbstub/Kconfig +++ b/components/esp_gdbstub/Kconfig @@ -4,6 +4,7 @@ menu "GDB Stub" # menu in the target component. config ESP_GDBSTUB_ENABLED bool + select FREERTOS_ENABLE_TASK_SNAPSHOT config ESP_GDBSTUB_SUPPORT_TASKS bool "Enable listing FreeRTOS tasks through GDB Stub" diff --git a/components/espcoredump/Kconfig b/components/espcoredump/Kconfig index 28a54a02a6..a9d7843e50 100644 --- a/components/espcoredump/Kconfig +++ b/components/espcoredump/Kconfig @@ -15,9 +15,11 @@ menu "Core dump" config ESP_COREDUMP_ENABLE_TO_FLASH bool "Flash" depends on !SPIRAM_ALLOW_STACK_EXTERNAL_MEMORY + select FREERTOS_ENABLE_TASK_SNAPSHOT select ESP_COREDUMP_ENABLE config ESP_COREDUMP_ENABLE_TO_UART bool "UART" + select FREERTOS_ENABLE_TASK_SNAPSHOT select ESP_COREDUMP_ENABLE config ESP_COREDUMP_ENABLE_TO_NONE bool "None" diff --git a/components/freertos/Kconfig b/components/freertos/Kconfig index 3c8b0c1951..0c66f9af8f 100644 --- a/components/freertos/Kconfig +++ b/components/freertos/Kconfig @@ -465,4 +465,18 @@ menu "FreeRTOS" When enabled, the usage of float type is allowed inside Level 1 ISRs. + config FREERTOS_ENABLE_TASK_SNAPSHOT + bool "Enable task snapshot functions" + default y + help + When enabled, the functions related to snapshots, such as vTaskGetSnapshot or uxTaskGetSnapshotAll, + are compiled and linked. + + config FREERTOS_PLACE_SNAPSHOT_FUNS_INTO_FLASH + bool "Place task snapshot functions into flash" + default n + depends on FREERTOS_ENABLE_TASK_SNAPSHOT && !ESP_PANIC_HANDLER_IRAM + help + When enabled, the functions related to snapshots, such as vTaskGetSnapshot or uxTaskGetSnapshotAll, + will be placed in flash. Note that if enabled, these functions cannot be called when cache is disabled. endmenu diff --git a/components/freertos/include/freertos/FreeRTOSConfig.h b/components/freertos/include/freertos/FreeRTOSConfig.h index 51a030d523..c1dcd1cd48 100644 --- a/components/freertos/include/freertos/FreeRTOSConfig.h +++ b/components/freertos/include/freertos/FreeRTOSConfig.h @@ -277,7 +277,7 @@ extern void vPortCleanUpTCB ( void *pxTCB ); #endif //configUSE_TICKLESS_IDLE -#if CONFIG_ESP_COREDUMP_ENABLE || CONFIG_ESP_GDBSTUB_SUPPORT_TASKS +#if CONFIG_FREERTOS_ENABLE_TASK_SNAPSHOT #define configENABLE_TASK_SNAPSHOT 1 #endif #ifndef configENABLE_TASK_SNAPSHOT diff --git a/components/freertos/linker.lf b/components/freertos/linker.lf index 23de74c1e7..ee3d8dc02b 100644 --- a/components/freertos/linker.lf +++ b/components/freertos/linker.lf @@ -2,7 +2,7 @@ archive: libfreertos.a entries: * (noflash_text) - if ESP_PANIC_HANDLER_IRAM != y: + if FREERTOS_PLACE_SNAPSHOT_FUNS_INTO_FLASH = y: task_snapshot (default) if FREERTOS_PLACE_FUNCTIONS_INTO_FLASH = y: port: pxPortInitialiseStack (default) diff --git a/docs/en/api-guides/performance/ram-usage.rst b/docs/en/api-guides/performance/ram-usage.rst index 96d3560170..b106cbf6bf 100644 --- a/docs/en/api-guides/performance/ram-usage.rst +++ b/docs/en/api-guides/performance/ram-usage.rst @@ -129,6 +129,7 @@ The following options will reduce IRAM usage of some ESP-IDF features: .. list:: - Enable :ref:`CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH`. Provided these functions are not (incorrectly) used from ISRs, this option is safe to enable in all configurations. + - Enable :ref:`CONFIG_FREERTOS_PLACE_SNAPSHOT_FUNS_INTO_FLASH`. Enabling this option will place snapshot-related functions, such as ``vTaskGetSnapshot`` or ``uxTaskGetSnapshotAll``, in flash. - Disable Wi-Fi options :ref:`CONFIG_ESP32_WIFI_IRAM_OPT` and/or :ref:`CONFIG_ESP32_WIFI_RX_IRAM_OPT`. Disabling these options will free available IRAM at the cost of Wi-Fi performance. :esp32c3 or esp32s3: - :ref:`CONFIG_SPI_FLASH_ROM_IMPL` enabling this option will free some IRAM but will mean that esp_flash bugfixes and new flash chip support is not available. :esp32: - :ref:`CONFIG_SPI_FLASH_ROM_DRIVER_PATCH` disabling this option will free some IRAM but is only available in some flash configurations (see the configuration item help text).