You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/en/api-guides/performance/ram-usage.rst
+3-1Lines changed: 3 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -216,7 +216,7 @@ The following options will reduce IRAM usage of some ESP-IDF features:
216
216
Any memory that ends up unused for static IRAM will be added to the heap.
217
217
218
218
219
-
.. only:: esp32c3
219
+
.. only:: SOC_SPI_MEM_SUPPORT_AUTO_SUSPEND
220
220
221
221
Flash Suspend Feature
222
222
^^^^^^^^^^^^^^^^^^^^^
@@ -232,6 +232,8 @@ The following options will reduce IRAM usage of some ESP-IDF features:
232
232
233
233
Placing additional code into IRAM will exacerbate IRAM usage. For this reason, there is :ref:`CONFIG_SPI_FLASH_AUTO_SUSPEND`, which can alleviate the aforementioned kinds of IRAM usage. By enabling this feature, the Cache will not be disabled when SPI flash driver APIs and SPI flash driver-based APIs are used. Therefore, code and data in flash can be executed or accessed normally, but with some minor delay. See :ref:`auto-suspend` for more details about this feature.
234
234
235
+
IRAM usage for flash driver can be declined with :ref:`CONFIG_SPI_FLASH_AUTO_SUSPEND` enabled. Please refer to :ref:`internal_memory_saving_for_flash_driver` for more detailed information.
236
+
235
237
Regarding the flash suspend feature usage, and corresponding response time delay, please also see this example :example:`system/flash_suspend`.
Copy file name to clipboardExpand all lines: docs/en/api-reference/peripherals/spi_flash/index.rst
+43Lines changed: 43 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -258,6 +258,49 @@ Additionally, all API functions are protected with a mutex (``s_flash_op_mutex``
258
258
259
259
In a single core environment (:ref:`CONFIG_FREERTOS_UNICORE` enabled), you need to disable both caches, so that no inter-CPU communication can take place.
260
260
261
+
.. only:: SOC_SPI_MEM_SUPPORT_AUTO_SUSPEND
262
+
263
+
.. _internal_memory_saving_for_flash_driver:
264
+
265
+
Internal Memory Saving For Flash Driver
266
+
---------------------------------------
267
+
268
+
The ESP-IDF provides options to optimize the usage of IRAM by selectively placing certain functions into flash memory via turning off :ref:`CONFIG_SPI_FLASH_PLACE_FUNCTIONS_IN_IRAM`. It allows SPI flash operation functions to be executed from flash memory instead of IRAM. Thus it will save some IRAM memory for other significant time-critical functions or tasks.
269
+
270
+
However, this has some implications for flash itself. Functions placed into flash memory may have slightly increased execution times compared to those placed in IRAM. Applications with strict timing requirements or those heavily reliant on SPI flash operations may need to evaluate the trade-offs before enabling this option.
271
+
272
+
.. note::
273
+
274
+
:ref:`CONFIG_SPI_FLASH_PLACE_FUNCTIONS_IN_IRAM` should not be turned off when :ref:`CONFIG_SPI_FLASH_AUTO_SUSPEND` is not enabled, otherwise it will cause critical crash. As for flash suspend feature, please refer to :ref:`auto-suspend` for more information.
275
+
276
+
Resource Consumption
277
+
^^^^^^^^^^^^^^^^^^^^
278
+
279
+
Use the :doc:`/api-guides/tools/idf-size` tool to check the code and data consumption of the SPI flash driver. The following are the test conditions (using ESP32-C2 as an example):
280
+
281
+
**Note that the following data are not exact values and are for reference only; they may differ on different chip models.**
282
+
283
+
Resource consumption when :ref:`CONFIG_SPI_FLASH_PLACE_FUNCTIONS_IN_IRAM` is enabled.
0 commit comments