Преглед изворни кода

freertos: add kconfig options for task snapshot functions

Task snapshots is required by other modules that don't use gdbstub
or core dump. Add a Kconfig option to manage these possibilities.
Omar Chebib пре 4 година
родитељ
комит
92cf321677

+ 1 - 0
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"

+ 2 - 0
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"

+ 14 - 0
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

+ 1 - 1
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

+ 1 - 1
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)

+ 1 - 0
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).