mirror of
https://github.com/apache/nuttx.git
synced 2026-05-25 01:39:44 +08:00
[arch|board]/risc-v: Allow BSS segments on PSRAM for ESP32-P4
This commits enables moving BSS data segments to the external PSRAM on ESP32-P4. This is controlled by a Kconfig option. Signed-off-by: Tiago Medicci Serrano <tiago.medicci@espressif.com>
This commit is contained in:
committed by
Xiang Xiao
parent
1076cb933d
commit
e05292f9da
@@ -213,7 +213,7 @@ if(DEFINED ENV{ESP_HAL_3RDPARTY_VERSION})
|
||||
CACHE STRING "ESP HAL 3rdparty version")
|
||||
else()
|
||||
set(ESP_HAL_3RDPARTY_VERSION
|
||||
e10e44f52e41aee7a617b4d144982a1998a17fc5
|
||||
627f38f94c1084b6b2d90ce09c0ce5517e8eaed7
|
||||
CACHE STRING "ESP HAL 3rdparty version")
|
||||
endif()
|
||||
|
||||
|
||||
@@ -61,6 +61,7 @@ config ESPRESSIF_SPIRAM_BOOT_INIT
|
||||
|
||||
config ESPRESSIF_SPIRAM_IGNORE_NOTFOUND
|
||||
bool "Ignore SPIRAM not found"
|
||||
depends on !ESPRESSIF_SPIRAM_ALLOW_BSS_SEG_EXTERNAL_MEMORY
|
||||
default n
|
||||
---help---
|
||||
Keep booting even if PSRAM detection fails.
|
||||
@@ -118,6 +119,19 @@ config ESPRESSIF_SPIRAM_USER_HEAP
|
||||
---help---
|
||||
Add SPIRAM as an additional NuttX heap region.
|
||||
|
||||
config ESPRESSIF_SPIRAM_ALLOW_BSS_SEG_EXTERNAL_MEMORY
|
||||
bool "Allow .bss segment placed in external memory"
|
||||
default n
|
||||
---help---
|
||||
If enabled, variables with EXT_RAM_BSS_ATTR attribute will be
|
||||
placed in SPIRAM instead of internal DRAM.
|
||||
|
||||
BSS sections from esp-hal-3rdparty components can also be placed
|
||||
in SPIRAM through linker fragment mappings when enabled.
|
||||
|
||||
Note that variables placed in SPIRAM this way are still
|
||||
zero-initialized at startup.
|
||||
|
||||
endif # ESPRESSIF_SPIRAM
|
||||
|
||||
config ESPRESSIF_IDF_ENV_FPGA
|
||||
|
||||
@@ -221,7 +221,7 @@ endif
|
||||
|
||||
ESP_HAL_3RDPARTY_REPO = esp-hal-3rdparty
|
||||
ifndef ESP_HAL_3RDPARTY_VERSION
|
||||
ESP_HAL_3RDPARTY_VERSION = e10e44f52e41aee7a617b4d144982a1998a17fc5
|
||||
ESP_HAL_3RDPARTY_VERSION = 627f38f94c1084b6b2d90ce09c0ce5517e8eaed7
|
||||
endif
|
||||
|
||||
ifndef ESP_HAL_3RDPARTY_URL
|
||||
|
||||
@@ -506,6 +506,7 @@ void __esp_start(void)
|
||||
#else
|
||||
bootloader_clear_bss_section();
|
||||
#endif
|
||||
|
||||
/* Initialize the per CPU areas */
|
||||
|
||||
#ifdef CONFIG_RISCV_PERCPU_SCRATCH
|
||||
@@ -605,6 +606,10 @@ void __esp_start(void)
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_ESPRESSIF_SPIRAM_ALLOW_BSS_SEG_EXTERNAL_MEMORY
|
||||
esp_psram_bss_init();
|
||||
#endif
|
||||
|
||||
/* Disable clock of unused peripherals */
|
||||
|
||||
esp_perip_clk_init();
|
||||
|
||||
@@ -20,6 +20,8 @@
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
/* Default entry point: */
|
||||
|
||||
ENTRY(__start);
|
||||
@@ -683,13 +685,26 @@ SECTIONS
|
||||
*/
|
||||
*(.bss .bss.*)
|
||||
*(.dynbss .dynsbss .gnu.linkonce.b .gnu.linkonce.b.* .gnu.linkonce.sb .gnu.linkonce.sb.* .gnu.linkonce.sb2 .gnu.linkonce.sb2.* .sbss .sbss.* .sbss2 .sbss2.* .scommon .share.mem)
|
||||
#ifndef CONFIG_ESPRESSIF_SPIRAM_ALLOW_BSS_SEG_EXTERNAL_MEMORY
|
||||
*(.ext_ram.bss .ext_ram.bss.*)
|
||||
#endif
|
||||
*(COMMON)
|
||||
|
||||
. = ALIGN(4);
|
||||
_bss_end_high = ABSOLUTE(.);
|
||||
} > sram_high
|
||||
|
||||
#ifdef CONFIG_ESPRESSIF_SPIRAM_ALLOW_BSS_SEG_EXTERNAL_MEMORY
|
||||
/* This section holds .ext_ram.bss data and places it in external RAM. */
|
||||
.ext_ram.bss (NOLOAD) :
|
||||
{
|
||||
_ext_ram_bss_start = ABSOLUTE(.);
|
||||
*(.ext_ram.bss .ext_ram.bss.*)
|
||||
. = ALIGN(4);
|
||||
_ext_ram_bss_end = ABSOLUTE(.);
|
||||
} > ext_ram_seg
|
||||
#endif
|
||||
|
||||
/* Heap region for sram_high: from end of bss to end of sram_high segment */
|
||||
_sram_high_heap_start = _bss_end_high;
|
||||
_sram_high_heap_end = ORIGIN(sram_high) + LENGTH(sram_high);
|
||||
|
||||
@@ -20,6 +20,8 @@
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
/* Default entry point: */
|
||||
|
||||
ENTRY(__start);
|
||||
@@ -526,7 +528,9 @@ SECTIONS
|
||||
*(COMMON)
|
||||
|
||||
*(.dynbss .dynsbss .gnu.linkonce.b .gnu.linkonce.b.* .gnu.linkonce.sb .gnu.linkonce.sb.* .gnu.linkonce.sb2 .gnu.linkonce.sb2.* .sbss .sbss.* .sbss2 .sbss2.* .scommon .share.mem)
|
||||
#ifndef CONFIG_ESPRESSIF_SPIRAM_ALLOW_BSS_SEG_EXTERNAL_MEMORY
|
||||
*(.ext_ram.bss .ext_ram.bss.*)
|
||||
#endif
|
||||
|
||||
. = ALIGN(4);
|
||||
_ebss = ABSOLUTE(.);
|
||||
@@ -538,6 +542,17 @@ SECTIONS
|
||||
_bss_end = ABSOLUTE(.);
|
||||
} > sram_seg
|
||||
|
||||
#ifdef CONFIG_ESPRESSIF_SPIRAM_ALLOW_BSS_SEG_EXTERNAL_MEMORY
|
||||
/* This section holds .ext_ram.bss data and places it in external RAM. */
|
||||
.ext_ram.bss (NOLOAD) :
|
||||
{
|
||||
_ext_ram_bss_start = ABSOLUTE(.);
|
||||
*(.ext_ram.bss .ext_ram.bss.*)
|
||||
. = ALIGN(4);
|
||||
_ext_ram_bss_end = ABSOLUTE(.);
|
||||
} > ext_ram_seg
|
||||
#endif
|
||||
|
||||
.flash.text :
|
||||
{
|
||||
_stext = .;
|
||||
|
||||
Reference in New Issue
Block a user