Merge branch 'bugfix/static_ram_size' into 'master'

system: fixed USE_FIXED_STATIC_RAM_SIZE option

See merge request espressif/esp-idf!21368
This commit is contained in:
Jiang Jiang Jian 2023-03-20 13:57:38 +08:00
commit fdea5289a2
13 changed files with 34 additions and 85 deletions

View File

@ -114,9 +114,9 @@ MEMORY
#if defined(CONFIG_ESP32_USE_FIXED_STATIC_RAM_SIZE)
/* static data ends at defined address */
_static_data_end = 0x3FFB0000 + DRAM0_0_SEG_LEN;
_heap_start = 0x3FFB0000 + DRAM0_0_SEG_LEN;
#else
_static_data_end = _bss_end;
_heap_start = _heap_low_start;
#endif
/* Heap ends at top of dram0_0_seg */

View File

@ -404,7 +404,8 @@ SECTIONS
.dram0.heap_start (NOLOAD) :
{
. = ALIGN (8);
_heap_start = ABSOLUTE(.);
/* Lowest possible start address for the heap */
_heap_low_start = ABSOLUTE(.);
} > dram0_0_seg
/** This section will be used by the debugger and disassembler to get more information
@ -430,5 +431,5 @@ SECTIONS
ASSERT(((_iram_end - ORIGIN(iram0_0_seg)) <= LENGTH(iram0_0_seg)),
"IRAM0 segment data does not fit.")
ASSERT(((_heap_start - ORIGIN(dram0_0_seg)) <= LENGTH(dram0_0_seg)),
ASSERT(((_heap_low_start - ORIGIN(dram0_0_seg)) <= LENGTH(dram0_0_seg)),
"DRAM segment data does not fit.")

View File

@ -20,12 +20,8 @@
#define I_D_SRAM_SIZE SRAM_DRAM_END - SRAM_DRAM_ORG
#if CONFIG_ESP32C2_USE_FIXED_STATIC_RAM_SIZE
ASSERT((CONFIG_ESP32C2_FIXED_STATIC_RAM_SIZE <= I_D_SRAM_SIZE), "Fixed static ram data does not fit.")
#define DRAM0_0_SEG_LEN CONFIG_ESP32C2_FIXED_STATIC_RAM_SIZE
#else
#define DRAM0_0_SEG_LEN I_D_SRAM_SIZE
#endif // CONFIG_ESP32C2_USE_FIXED_STATIC_RAM_SIZE
MEMORY
{
/**
@ -65,13 +61,6 @@ MEMORY
}
#if CONFIG_ESP32C2_USE_FIXED_STATIC_RAM_SIZE
/* static data ends at defined address */
_static_data_end = 0x3FCA0000 + DRAM0_0_SEG_LEN;
#else
_static_data_end = _bss_end;
#endif // CONFIG_ESP32C2_USE_FIXED_STATIC_RAM_SIZE
/* Heap ends at top of dram0_0_seg */
_heap_end = 0x40000000;

View File

@ -38,12 +38,8 @@
#define I_D_SRAM_SIZE SRAM_DRAM_END - SRAM_DRAM_ORG
#if CONFIG_ESP32C3_USE_FIXED_STATIC_RAM_SIZE
ASSERT((CONFIG_ESP32C3_FIXED_STATIC_RAM_SIZE <= I_D_SRAM_SIZE), "Fixed static ram data does not fit.")
#define DRAM0_0_SEG_LEN CONFIG_ESP3C3_FIXED_STATIC_RAM_SIZE
#else
#define DRAM0_0_SEG_LEN I_D_SRAM_SIZE
#endif // CONFIG_ESP32C3_USE_FIXED_STATIC_RAM_SIZE
MEMORY
{
/**
@ -87,13 +83,6 @@ MEMORY
rtc_iram_seg(RWX) : org = 0x50000000, len = 0x2000 - ESP_BOOTLOADER_RESERVE_RTC
}
#if CONFIG_ESP32C3_USE_FIXED_STATIC_RAM_SIZE
/* static data ends at defined address */
_static_data_end = 0x3FCA0000 + DRAM0_0_SEG_LEN;
#else
_static_data_end = _bss_end;
#endif // CONFIG_ESP32C3_USE_FIXED_STATIC_RAM_SIZE
/* Heap ends at top of dram0_0_seg */
_heap_end = 0x40000000;

View File

@ -45,12 +45,8 @@
#define IDRAM0_2_SEG_SIZE (CONFIG_MMU_PAGE_SIZE << 8)
#endif
#if CONFIG_ESP32C6_USE_FIXED_STATIC_RAM_SIZE
ASSERT((CONFIG_ESP32C6_FIXED_STATIC_RAM_SIZE <= I_D_SRAM_SIZE), "Fixed static ram data does not fit.")
#define DRAM0_0_SEG_LEN CONFIG_ESP3C6_FIXED_STATIC_RAM_SIZE
#else
#define DRAM0_0_SEG_LEN I_D_SRAM_SIZE
#endif // CONFIG_ESP32C6_USE_FIXED_STATIC_RAM_SIZE
MEMORY
{
/**
@ -100,13 +96,6 @@ MEMORY
}
#if CONFIG_ESP32C6_USE_FIXED_STATIC_RAM_SIZE
/* static data ends at defined address */
_static_data_end = 0x40820000 + DRAM0_0_SEG_LEN;
#else
_static_data_end = _bss_end;
#endif // CONFIG_ESP32C6_USE_FIXED_STATIC_RAM_SIZE
/* Heap ends at top of dram0_0_seg */
_heap_end = 0x40000000;

View File

@ -45,12 +45,8 @@
#define IDRAM0_2_SEG_SIZE (CONFIG_MMU_PAGE_SIZE << 8)
#endif
#if CONFIG_ESP32H2_USE_FIXED_STATIC_RAM_SIZE
ASSERT((CONFIG_ESP32H2_FIXED_STATIC_RAM_SIZE <= I_D_SRAM_SIZE), "Fixed static ram data does not fit.")
#define DRAM0_0_SEG_LEN CONFIG_ESP32H2_FIXED_STATIC_RAM_SIZE
#else
#define DRAM0_0_SEG_LEN I_D_SRAM_SIZE
#endif // CONFIG_ESP32H2_USE_FIXED_STATIC_RAM_SIZE
MEMORY
{
/**
@ -95,13 +91,6 @@ MEMORY
}
#if CONFIG_ESP32H2_USE_FIXED_STATIC_RAM_SIZE
/* static data ends at defined address */
_static_data_end = 0x40820000 + DRAM0_0_SEG_LEN;
#else
_static_data_end = _bss_end;
#endif // CONFIG_ESP32H2_USE_FIXED_STATIC_RAM_SIZE
/* Heap ends at top of dram0_0_seg */
_heap_end = 0x40000000;

View File

@ -34,12 +34,8 @@
#define I_D_SRAM_SIZE SRAM_DRAM_END - SRAM_DRAM_ORG
#if CONFIG_ESP32H4_USE_FIXED_STATIC_RAM_SIZE
ASSERT((CONFIG_ESP32H4_FIXED_STATIC_RAM_SIZE <= I_D_SRAM_SIZE), "Fixed static ram data does not fit.")
#define DRAM0_0_SEG_LEN CONFIG_ESP3C3_FIXED_STATIC_RAM_SIZE
#else
#define DRAM0_0_SEG_LEN I_D_SRAM_SIZE
#endif // CONFIG_ESP32H4_USE_FIXED_STATIC_RAM_SIZE
MEMORY
{
/**
@ -83,13 +79,6 @@ MEMORY
rtc_iram_seg(RWX) : org = 0x50000000, len = 0x2000 - ESP_BOOTLOADER_RESERVE_RTC
}
#if CONFIG_ESP32H4_USE_FIXED_STATIC_RAM_SIZE
/* static data ends at defined address */
_static_data_end = 0x3FCA0000 + DRAM0_0_SEG_LEN;
#else
_static_data_end = _bss_end;
#endif // CONFIG_ESP32H4_USE_FIXED_STATIC_RAM_SIZE
/* Heap ends at top of dram0_0_seg */
_heap_end = 0x40000000;

View File

@ -50,17 +50,12 @@
#define I_D_RAM_SIZE DATA_RAM_END - DRAM_ORG
#if defined(CONFIG_ESP32S2_USE_FIXED_STATIC_RAM_SIZE)
ASSERT((CONFIG_ESP32S2_FIXED_STATIC_RAM_SIZE <= I_D_RAM_SIZE),
"Fixed static ram data does not fit.")
#define STATIC_RAM_SIZE CONFIG_ESP32S2_FIXED_STATIC_RAM_SIZE
#if CONFIG_ESP32S2_USE_FIXED_STATIC_RAM_SIZE
ASSERT((CONFIG_ESP32S2_FIXED_STATIC_RAM_SIZE <= I_D_RAM_SIZE), "Fixed static ram data does not fit.")
#define DRAM0_0_SEG_LEN CONFIG_ESP32S2_FIXED_STATIC_RAM_SIZE
#else
#define STATIC_RAM_SIZE 0
#endif
#define DRAM0_0_SEG_LEN I_D_RAM_SIZE
#endif // CONFIG_ESP32S2_USE_FIXED_STATIC_RAM_SIZE
MEMORY
{
/* All these values assume the flash cache is on, and have the blocks this uses subtracted from the length
@ -86,7 +81,7 @@ MEMORY
/* Shared data RAM, excluding memory reserved for bootloader and ROM bss/data/stack. */
dram0_0_seg (RW) : org = DRAM_ORG, len = I_D_RAM_SIZE - STATIC_RAM_SIZE
dram0_0_seg (RW) : org = DRAM_ORG, len = DRAM0_0_SEG_LEN
#ifdef CONFIG_APP_BUILD_USE_FLASH_SECTIONS
/* Flash mapped constant data */
@ -120,9 +115,9 @@ MEMORY
#if defined(CONFIG_ESP32S2_USE_FIXED_STATIC_RAM_SIZE)
/* static data ends at defined address */
_static_data_end = DRAM_ORG + STATIC_RAM_SIZE;
_heap_start = DRAM_ORG + DRAM0_0_SEG_LEN;
#else
_static_data_end = _bss_end;
_heap_start = _heap_low_start;
#endif
_heap_end = 0x40000000;

View File

@ -398,7 +398,8 @@ SECTIONS
.dram0.heap_start (NOLOAD) :
{
. = ALIGN (8);
_heap_start = ABSOLUTE(.);
/* Lowest possible start address for the heap */
_heap_low_start = ABSOLUTE(.);
} > dram0_0_seg
/** This section will be used by the debugger and disassembler to get more information
@ -424,5 +425,5 @@ SECTIONS
ASSERT(((_iram_text_end - ORIGIN(iram0_0_seg)) <= LENGTH(iram0_0_seg)),
"IRAM0 segment data does not fit.")
ASSERT(((_heap_start - _data_start) <= LENGTH(dram0_0_seg)),
ASSERT(((_heap_low_start - _data_start) <= LENGTH(dram0_0_seg)),
"DRAM segment data does not fit.")

View File

@ -119,9 +119,9 @@ MEMORY
#if CONFIG_ESP32S3_USE_FIXED_STATIC_RAM_SIZE
/* static data ends at defined address */
_static_data_end = 0x3FCA0000 + DRAM0_0_SEG_LEN;
_heap_start = SRAM_DRAM_ORG + DRAM0_0_SEG_LEN;
#else
_static_data_end = _bss_end;
_heap_start = _heap_low_start;
#endif // CONFIG_ESP32S3_USE_FIXED_STATIC_RAM_SIZE
/* Heap ends at top of dram0_0_seg */

View File

@ -437,7 +437,8 @@ SECTIONS
.dram0.heap_start (NOLOAD) :
{
. = ALIGN (8);
_heap_start = ABSOLUTE(.);
/* Lowest possible start address for the heap */
_heap_low_start = ABSOLUTE(.);
} > dram0_0_seg
/** This section will be used by the debugger and disassembler to get more information
@ -463,5 +464,5 @@ SECTIONS
ASSERT(((_iram_end - ORIGIN(iram0_0_seg)) <= LENGTH(iram0_0_seg)),
"IRAM0 segment data does not fit.")
ASSERT(((_heap_start - ORIGIN(dram0_0_seg)) <= LENGTH(dram0_0_seg)),
ASSERT(((_heap_low_start - ORIGIN(dram0_0_seg)) <= LENGTH(dram0_0_seg)),
"DRAM segment data does not fit.")

View File

@ -21,9 +21,12 @@ menu "Memory"
config ESP32S2_FIXED_STATIC_RAM_SIZE
hex "Fixed Static RAM size"
default 0x10000
range 0 0x34000
range 0 0x34000 # Equal to I_D_SRAM_SIZE in linkerscript
depends on ESP32S2_USE_FIXED_STATIC_RAM_SIZE
help
RAM size dedicated for static variables (.data & .bss sections).
This value is less than the chips total memory, as not all of it can be used for this purpose.
E.g. parts are used by the software bootloader, and will only be available
as heap memory after app startup.
endmenu # Memory

View File

@ -21,9 +21,12 @@ menu "Memory"
config ESP32S3_FIXED_STATIC_RAM_SIZE
hex "Fixed Static RAM size"
default 0x10000
range 0 0x34000
range 0 0x54700 # Equal to I_D_SRAM_SIZE in linkerscript
depends on ESP32S3_USE_FIXED_STATIC_RAM_SIZE
help
RAM size dedicated for static variables (.data & .bss sections).
This value is less than the chips total memory, as not all of it can be used for this purpose.
E.g. parts are used by the software bootloader, and will only be available
as heap memory after app startup.
endmenu # Memory