docs: add docs to .bss and .noinit segments on spiram

This commit is contained in:
Armando
2021-07-27 16:22:56 +08:00
parent 65aa737b15
commit e0acefbb78
3 changed files with 19 additions and 6 deletions

View File

@@ -38,6 +38,7 @@ ESP-IDF fully supports the use of external memory in applications. Once the exte
* :ref:`external_ram_config_capability_allocator` * :ref:`external_ram_config_capability_allocator`
* :ref:`external_ram_config_malloc` (default) * :ref:`external_ram_config_malloc` (default)
:esp32: * :ref:`external_ram_config_bss` :esp32: * :ref:`external_ram_config_bss`
:esp32: * :ref:`external_ram_config_noinit`
.. _external_ram_config_memory_map: .. _external_ram_config_memory_map:
@@ -104,6 +105,14 @@ Because some buffers can only be allocated in internal memory, a second configur
Remaining external RAM can also be added to the capability heap allocator using the method shown above. Remaining external RAM can also be added to the capability heap allocator using the method shown above.
.. _external_ram_config_noinit:
Allow .noinit segment placed in external memory
-----------------------------------------------
Enable this option by checking :ref:`CONFIG_SPIRAM_ALLOW_NOINIT_SEG_EXTERNAL_MEMORY`. If enabled, a region of the address space provided in external RAM will be used to store non-initialized data. The values placed in this segment will not be initialized or modified even during startup or restart.
By applying the macro ``EXT_RAM_NOINIT_ATTR``, data could be moved from the internal NOINIT segment to external RAM. Remaining external RAM can still be added to the capability heap allocator using the method shown above, :ref:`external_ram_config_capability_allocator`.
Restrictions Restrictions
============ ============

View File

@@ -16,6 +16,8 @@ Non-constant static data (.data) and zero-initialized data (.bss) is placed by t
.. only:: esp32 .. only:: esp32
By applying the ``EXT_RAM_ATTR`` macro, zero-initialized data can also be placed into external RAM. To use this macro, the :ref:`CONFIG_SPIRAM_ALLOW_BSS_SEG_EXTERNAL_MEMORY` needs to be enabled. See :ref:`external_ram_config_bss`.
The available size of the internal DRAM region is reduced by 64kB (by shifting start address to ``0x3FFC0000``) if Bluetooth stack is used. Length of this region is also reduced by 16 kB or 32kB if trace memory is used. Due to some memory fragmentation issues caused by ROM, it is also not possible to use all available DRAM for static allocations - however the remaining DRAM is still available as heap at runtime. The available size of the internal DRAM region is reduced by 64kB (by shifting start address to ``0x3FFC0000``) if Bluetooth stack is used. Length of this region is also reduced by 16 kB or 32kB if trace memory is used. Due to some memory fragmentation issues caused by ROM, it is also not possible to use all available DRAM for static allocations - however the remaining DRAM is still available as heap at runtime.
.. only:: not esp32 .. only:: not esp32
@@ -31,6 +33,10 @@ Constant data may also be placed into DRAM, for example if it is used in an non-
The macro ``__NOINIT_ATTR`` can be used as attribute to place data into ``.noinit`` section. The values placed into this section will not be initialized at startup and should keep its value after software restart. The macro ``__NOINIT_ATTR`` can be used as attribute to place data into ``.noinit`` section. The values placed into this section will not be initialized at startup and should keep its value after software restart.
.. only:: esp32
By applying the ``EXT_RAM_NOINIT_ATTR`` macro, Non-initialized value could also be placed in external RAM. To do this, the :ref:`CONFIG_SPIRAM_ALLOW_NOINIT_SEG_EXTERNAL_MEMORY` needs to be enabled. See :ref:`external_ram_config_noinit`. If the :ref:`CONFIG_SPIRAM_ALLOW_NOINIT_SEG_EXTERNAL_MEMORY` is not enabled, ``EXT_RAM_NOINIT_ATTR`` will behave just as ``__NOINIT_ATTR``, it will make data to be placed into ``.noinit`` segment in internal RAM.
Example:: Example::
__NOINIT_ATTR uint32_t noinit_data; __NOINIT_ATTR uint32_t noinit_data;
@@ -209,5 +215,3 @@ Placing DMA buffers in the stack is possible but discouraged. If doing so, pay a
spi_device_transmit(spi, &temp); spi_device_transmit(spi, &temp);
// other stuff // other stuff
} }