mirror of
https://github.com/espressif/esp-idf.git
synced 2025-08-26 10:06:51 +00:00
150 lines
7.6 KiB
Plaintext
150 lines
7.6 KiB
Plaintext
# Common (non-chip-specific) SPIRAM options
|
|
#
|
|
# sourced into the "SPIRAM config" submenu for a specific chip.
|
|
|
|
config SPIRAM_BOOT_HW_INIT
|
|
bool "Initialise the PSRAM related hardware"
|
|
depends on SPIRAM
|
|
default "y" if SPIRAM
|
|
help
|
|
If this is enabled, the PSRAM hardware will be initialized during startup.
|
|
Enabling this config does not ensure make sure the availability of the PSRAM for usage,
|
|
but just initialises the PSRAM hardware.
|
|
This is necessary to configure PSRAM memory protection during the boot up.
|
|
|
|
config SPIRAM_BOOT_INIT
|
|
bool "Initialize PSRAM during startup, including the hardware and memory related configurations"
|
|
default "y"
|
|
depends on SPIRAM_BOOT_HW_INIT
|
|
help
|
|
If this is enabled, the PSRAM will be enabled during initial boot. Unless you
|
|
have specific requirements, you'll want to leave this enabled so memory allocated
|
|
during boot-up can also be placed in PSRAM.
|
|
|
|
config SPIRAM_PRE_CONFIGURE_MEMORY_PROTECTION
|
|
bool "Pre-configure memory protection for PSRAM"
|
|
default y if SPIRAM_BOOT_INIT
|
|
default n
|
|
depends on SPIRAM
|
|
help
|
|
If this is enabled, the PSRAM will be pre-configured for memory protection during initial boot.
|
|
This configuration takes into consideration the PSRAM memory configurations that are performed
|
|
by ESP-IDF's default PSRAM initialization function, esp_psram_init().
|
|
Thus, the config is enabled by default when SPIRAM_BOOT_INIT is enabled,
|
|
because the function esp_psram_init() would be called in the startup code.
|
|
|
|
In case you wish to disable SPIRAM_BOOT_INIT just for delaying the PSRAM initialization and plan
|
|
to use the ESP-IDF's default PSRAM initialization function, esp_psram_init() in the application code,
|
|
you should still enable this config to enable memory protection for the PSRAM.
|
|
|
|
Note that enabling this config also considers that the rest of the PSRAM memory that is left after
|
|
the memory configurations are performed by esp_psram_init(), can be allocated to the heap using the function
|
|
esp_psram_extram_add_to_heap_allocator(), thus configures this region with heap memory protection (RW).
|
|
|
|
As an advanced usage, if you plan to initialize the PSRAM memory regions manually by yourself without
|
|
using the function esp_psram_init(), you should disable this config to avoid any memory protection and
|
|
usage conflicts.
|
|
|
|
config SPIRAM_IGNORE_NOTFOUND
|
|
bool "Ignore PSRAM when not found"
|
|
default "n"
|
|
depends on SPIRAM_BOOT_HW_INIT && !SPIRAM_ALLOW_BSS_SEG_EXTERNAL_MEMORY && !SPIRAM_ALLOW_NOINIT_SEG_EXTERNAL_MEMORY
|
|
help
|
|
Normally, if psram initialization is enabled during compile time but not found at runtime, it
|
|
is seen as an error making the CPU panic. If this is enabled, booting will complete
|
|
but no PSRAM will be available. In particular, it is important to note that when SPIRAM_IGNORE_NOTFOUND
|
|
is enabled, some WIFI related configs will be set to the default value used when SPIRAM is disabled.
|
|
It can be assumed that by enabling this config, WIFI and LWIP will assume that the current chip does not
|
|
have SPIRAM. SPIRAM_TRY_ALLOCATE_WIFI_LWIP will not work, buffers in WIFI and LWIP will be set to smaller
|
|
ranges and default values. WIFI_CACHE_TX_BUFFER_NUM and ESP_WIFI_AMSDU_TX_ENABLED will be disabled,
|
|
ESP_WIFI_TX_BUFFER will be set to ESP_WIFI_DYNAMIC_TX_BUFFER.
|
|
|
|
choice SPIRAM_USE
|
|
prompt "SPI RAM access method"
|
|
default SPIRAM_USE_MALLOC
|
|
help
|
|
The SPI RAM can be accessed in multiple methods: by just having it available as an unmanaged
|
|
memory region in the CPU's memory map, by integrating it in the heap as 'special' memory
|
|
needing heap_caps_malloc to allocate, or by fully integrating it making malloc() also able to
|
|
return SPI RAM pointers.
|
|
|
|
config SPIRAM_USE_MEMMAP
|
|
bool "Integrate RAM into memory map"
|
|
config SPIRAM_USE_CAPS_ALLOC
|
|
bool "Make RAM allocatable using heap_caps_malloc(..., MALLOC_CAP_SPIRAM)"
|
|
config SPIRAM_USE_MALLOC
|
|
bool "Make RAM allocatable using malloc() as well"
|
|
select FREERTOS_SUPPORT_STATIC_ALLOCATION
|
|
endchoice
|
|
|
|
config SPIRAM_MEMTEST
|
|
bool "Run memory test on SPI RAM initialization"
|
|
default "y"
|
|
depends on SPIRAM_BOOT_INIT
|
|
help
|
|
Runs a rudimentary memory test on initialization. Aborts when memory test fails. Disable this for
|
|
slightly faster startup.
|
|
|
|
config SPIRAM_MALLOC_ALWAYSINTERNAL
|
|
int "Maximum malloc() size, in bytes, to always put in internal memory"
|
|
depends on SPIRAM_USE_MALLOC
|
|
default 16384
|
|
range 0 131072
|
|
help
|
|
If malloc() is capable of also allocating SPI-connected ram, its allocation strategy will prefer to
|
|
allocate chunks less than this size in internal memory, while allocations larger than this will be
|
|
done from external RAM. If allocation from the preferred region fails, an attempt is made to allocate
|
|
from the non-preferred region instead, so malloc() will not suddenly fail when either internal or
|
|
external memory is full.
|
|
|
|
config SPIRAM_TRY_ALLOCATE_WIFI_LWIP
|
|
bool "Try to allocate memories of WiFi and LWIP in SPIRAM firstly. If failed, allocate internal memory"
|
|
depends on SPIRAM_USE_CAPS_ALLOC || SPIRAM_USE_MALLOC
|
|
default "n"
|
|
help
|
|
Try to allocate memories of WiFi and LWIP in SPIRAM firstly. If failed, try to allocate internal
|
|
memory then.
|
|
|
|
config SPIRAM_MALLOC_RESERVE_INTERNAL
|
|
int "Reserve this amount of bytes for data that specifically needs to be in DMA or internal memory"
|
|
depends on SPIRAM_USE_MALLOC
|
|
default 32768
|
|
range 0 262144
|
|
help
|
|
Because the external/internal RAM allocation strategy is not always perfect, it sometimes may happen
|
|
that the internal memory is entirely filled up. This causes allocations that are specifically done in
|
|
internal memory, for example the stack for new tasks or memory to service DMA or have memory that's
|
|
also available when SPI cache is down, to fail. This option reserves a pool specifically for requests
|
|
like that; the memory in this pool is not given out when a normal malloc() is called.
|
|
|
|
Set this to 0 to disable this feature.
|
|
|
|
Note that because FreeRTOS stacks are forced to internal memory, they will also use this memory pool;
|
|
be sure to keep this in mind when adjusting this value.
|
|
|
|
Note also that the DMA reserved pool may not be one single contiguous memory region, depending on the
|
|
configured size and the static memory usage of the app.
|
|
|
|
config SPIRAM_ALLOW_BSS_SEG_EXTERNAL_MEMORY
|
|
bool "Allow .bss segment placed in external memory"
|
|
default n
|
|
depends on SPIRAM
|
|
select ESP_ALLOW_BSS_SEG_EXTERNAL_MEMORY
|
|
help
|
|
If enabled, variables with EXT_RAM_BSS_ATTR attribute will be placed in SPIRAM instead of internal DRAM.
|
|
BSS section of `lwip`, `net80211`, `pp`, `bt` libraries will be automatically placed
|
|
in SPIRAM. BSS sections from other object files and libraries can also be placed in SPIRAM through
|
|
linker fragment scheme `extram_bss`.
|
|
|
|
Note that the variables placed in SPIRAM using EXT_RAM_BSS_ATTR will be zero initialized.
|
|
|
|
config SPIRAM_ALLOW_NOINIT_SEG_EXTERNAL_MEMORY
|
|
bool "Allow .noinit segment placed in external memory"
|
|
default n
|
|
depends on SPIRAM
|
|
help
|
|
If enabled, noinit variables can be placed in PSRAM using EXT_RAM_NOINIT_ATTR.
|
|
|
|
Note the values placed into this section will not be initialized at startup and should keep its value
|
|
after software restart.
|