Просмотр исходного кода

Merge branch 'bugfix/s2_s3_stack_extmem_config' into 'master'

psram: make SPIRAM_ALLOW_STACK_EXTERNAL_MEMORY configurable on S2 and S3

See merge request espressif/esp-idf!18894
Jiang Jiang Jian 3 лет назад
Родитель
Сommit
9873d4d138

+ 11 - 4
components/esp_psram/esp32s2/Kconfig.spiram

@@ -8,10 +8,6 @@ config SPIRAM
 menu "SPI RAM config"
     depends on SPIRAM
 
-    config SPIRAM_ALLOW_STACK_EXTERNAL_MEMORY
-        bool
-        default "y"
-
     config SPIRAM_MODE_QUAD
         bool
         default "y"
@@ -33,6 +29,17 @@ menu "SPI RAM config"
             bool "ESP-PSRAM64 or LY68L6400"
     endchoice
 
+    config SPIRAM_ALLOW_STACK_EXTERNAL_MEMORY
+        bool "Allow external memory as an argument to xTaskCreateStatic"
+        default y
+        help
+            Accessing memory in SPIRAM has certain restrictions, so task stacks allocated by xTaskCreate
+            are by default allocated from internal RAM.
+
+            This option allows for passing memory allocated from SPIRAM to be passed to xTaskCreateStatic.
+            This should only be used for tasks where the stack is never accessed while the cache is disabled.
+            Cannot be used together with ESP_COREDUMP_ENABLE_TO_FLASH.
+
     menu "PSRAM clock and cs IO for ESP32S2"
         depends on SPIRAM
         config DEFAULT_PSRAM_CLK_IO

+ 11 - 4
components/esp_psram/esp32s3/Kconfig.spiram

@@ -8,10 +8,6 @@ config SPIRAM
 menu "SPI RAM config"
     depends on SPIRAM
 
-    config SPIRAM_ALLOW_STACK_EXTERNAL_MEMORY
-        bool
-        default "y"
-
     choice SPIRAM_MODE
         prompt "Mode (QUAD/OCT) of SPI RAM chip in use"
         default SPIRAM_MODE_QUAD
@@ -42,6 +38,17 @@ menu "SPI RAM config"
             bool "ESP-PSRAM64 , LY68L6400 or APS6408"
     endchoice
 
+    config SPIRAM_ALLOW_STACK_EXTERNAL_MEMORY
+        bool "Allow external memory as an argument to xTaskCreateStatic"
+        default y
+        help
+            Accessing memory in SPIRAM has certain restrictions, so task stacks allocated by xTaskCreate
+            are by default allocated from internal RAM.
+
+            This option allows for passing memory allocated from SPIRAM to be passed to xTaskCreateStatic.
+            This should only be used for tasks where the stack is never accessed while the cache is disabled.
+            Cannot be used together with ESP_COREDUMP_ENABLE_TO_FLASH.
+
     menu "PSRAM Clock and CS IO for ESP32S3"
         depends on SPIRAM
         config DEFAULT_PSRAM_CLK_IO

+ 1 - 8
docs/en/api-guides/external-ram.rst

@@ -139,14 +139,7 @@ External RAM use has the following restrictions:
 
  * In general, external RAM will not be used as task stack memory. :cpp:func:`xTaskCreate` and similar functions will always allocate internal memory for stack and task TCBs.
 
-.. only:: esp32
-
-    The option :ref:`CONFIG_SPIRAM_ALLOW_STACK_EXTERNAL_MEMORY` can be used to place task stacks into external memory. In these cases :cpp:func:`xTaskCreateStatic` must be used to specify a task stack buffer allocated from external memory, otherwise task stacks will still be allocated from internal memory.
-
-
-.. only:: not esp32
-
-    :cpp:func:`xTaskCreateStatic` can be used to explicitly place task stacks into external memory.
+The option :ref:`CONFIG_SPIRAM_ALLOW_STACK_EXTERNAL_MEMORY` can be used to allow placing task stacks into external memory. In these cases :cpp:func:`xTaskCreateStatic` must be used to specify a task stack buffer allocated from external memory, otherwise task stacks will still be allocated from internal memory.
 
 
 Failure to initialize

+ 1 - 8
docs/zh_CN/api-guides/external-ram.rst

@@ -139,15 +139,8 @@ ESP-IDF 启动过程中,片外 RAM 被映射到以 {IDF_TARGET_PSRAM_ADDR_STAR
 
  * 一般来说,片外 RAM 不会用作任务堆栈存储器。:cpp:func:`xTaskCreate` 及类似函数始终会为堆栈和任务 TCB 分配片上储存器。
 
-.. only:: esp32
-
-    可以使用 :ref:`CONFIG_SPIRAM_ALLOW_STACK_EXTERNAL_MEMORY` 选项将任务堆栈放入片外存储器。这时,必须使用 :cpp:func:`xTaskCreateStatic` 指定从片外存储器分配的任务堆栈缓冲区,否则任务堆栈将会从片上存储器分配。
-
-
-.. only:: not esp32
-
-    可以使用 :cpp:func:`xTaskCreateStatic` 显式地将任务堆栈放入片外存储器。
 
+可以使用 :ref:`CONFIG_SPIRAM_ALLOW_STACK_EXTERNAL_MEMORY` 选项将任务堆栈放入片外存储器。这时,必须使用 :cpp:func:`xTaskCreateStatic` 指定从片外存储器分配的任务堆栈缓冲区,否则任务堆栈将会从片上存储器分配。
 
 初始化失败
 =====================