EasyManuals Logo

Espressif ESP32-S2 User Manual

Espressif ESP32-S2
1695 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #984 background imageLoading...
Page #984 background image
Chapter 2. API Reference
Available Heap
DRAM At startup, the DRAM heap contains all data memory which is not statically allocated by the app. Reducing
statically allocated buffers will increase the amount of available free heap.
To find the amount of statically allocated memory, use the idf.py size command.
Note: At runtime, the available heap DRAM may be less than calculated at compile time, because at startup some
memory is allocated from the heap before the FreeRTOS scheduler is started (including memory for the stacks of
initial FreeRTOS tasks).
IRAM At startup, the IRAM heap contains all instruction memory which is not used by the app executable code.
The idf.py size command can be used to find the amount of IRAM used by the app.
D/IRAM Some memory in the ESP32-S2 is available as either DRAM or IRAM. If memory is allocated from a
D/IRAM region, the free heap size for both types of memory will decrease.
Heap Sizes At startup, all ESP-IDF apps log a summary of all heap addresses (and sizes) at level Info:
I (252) heap_init: Initializing. RAM available for dynamic allocation:
I (259) heap_init: At 3FFAE6E0 len 00001920 (6 KiB): DRAM
I (265) heap_init: At 3FFB2EC8 len 0002D138 (180 KiB): DRAM
I (272) heap_init: At 3FFE0440 len 00003AE0 (14 KiB): D/IRAM
I (278) heap_init: At 3FFE4350 len 0001BCB0 (111 KiB): D/IRAM
I (284) heap_init: At 4008944C len 00016BB4 (90 KiB): IRAM
Finding available heap See Heap Information.
Special Capabilities
DMA-Capable Memory Use the MALLOC_CAP_DMA flag to allocate memory which is suitable for use with
hardware DMA engines (for example SPI and I2S). This capability flag excludes any external PSRAM.
32-Bit Accessible Memory If a certain memory structure is only addressed in 32-bit units, for example an array
of ints or pointers, it can be useful to allocate it with the MALLOC_CAP_32BIT flag. This also allows the allocator
to give out IRAM memory; something which it cant do for a normal malloc() call. This can help to use all the
available memory in the ESP32-S2.
Memory allocated with MALLOC_CAP_32BIT can only be accessed via 32-bit reads and writes, any other type of
access will generate a fatal LoadStoreError exception.
External SPI Memory When external RAM is enabled, external SPI RAM under 4MiB in size can be allocated
using standard malloc calls, or via heap_caps_malloc(MALLOC_CAP_SPIRAM), depending on configura-
tion. See Configuring External RAM for more details.
API Reference - Heap Allocation
Header File
components/heap/include/esp_heap_caps.h
Espressif Systems 973
Submit Document Feedback
Release v4.4

Table of Contents

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the Espressif ESP32-S2 and is the answer not in the manual?

Espressif ESP32-S2 Specifications

General IconGeneral
BrandEspressif
ModelESP32-S2
CategorySingle board computers
LanguageEnglish