Skip to contentSkip to conversation

include: configs: am65x_evm: Optimize size of SPL BSS

PATCH New Lokesh Vutla 1 participant 2 messages Mar 9, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 include: configs: am65x_evm: Optimize size of SPL BSS

Current BSS allocation of SPL is as below:

$ size spl/u-boot-spl
   text	   data	    bss	    dec	    hex	filename
 132369	   7852	   1496	 141717	  22995	spl/u-boot-spl

But 20KB is allocated currently for BSS. Reduce it to 3KB and save some space for stack.

---
 include/configs/am65x_evm.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/configs/am65x_evm.h +1 -1
index b39a5b4ca4..76d73086fb 100644
@@ -30,7 +30,7 @@
  * our memory footprint. The less we use for BSS the more we have available
  * for everything else.
  */
-#define CONFIG_SPL_BSS_MAX_SIZE		0x5000
+#define CONFIG_SPL_BSS_MAX_SIZE		0xc00
 /*
  * Link BSS to be within SPL in a dedicated region located near the top of
  * the MCU SRAM, this way making it available also before relocation. Note
Signature · 1 line
2.30.0
#1 lore raw

PATCH 2/2 configs: am65x_evm_r5: Enable checks for spl and stack sizes

Enable relevant configs that checks for the size of image and stack:

BSS: 3KB
Initial MALLOC: ~22KB
Initial Stack: 8K
SPL Image size can be: ~215KB

---
 configs/am65x_evm_r5_defconfig | 5 +++++
 1 file changed, 5 insertions(+)
configs/am65x_evm_r5_defconfig +5 -0
index b9b11010a1..57f3300380 100644
@@ -17,6 +17,8 @@ CONFIG_SPL_MMC_SUPPORT=y
 CONFIG_SPL_SERIAL_SUPPORT=y
 CONFIG_SPL_DRIVERS_MISC_SUPPORT=y
 CONFIG_SPL_STACK_R_ADDR=0x82000000
+CONFIG_SPL_SIZE_LIMIT=0x7ec00
+CONFIG_SPL_SIZE_LIMIT_PROVIDE_STACK=0x2000
 CONFIG_SPL_FS_FAT=y
 CONFIG_SPL_LIBDISK_SUPPORT=y
 CONFIG_SPL_SPI_FLASH_SUPPORT=y
@@ -27,6 +29,9 @@ CONFIG_SPL_LOAD_FIT=y
 # CONFIG_USE_SPL_FIT_GENERATOR is not set
 CONFIG_USE_BOOTCOMMAND=y
 # CONFIG_DISPLAY_CPUINFO is not set
+CONFIG_SPL_SIZE_LIMIT_SUBTRACT_GD=y
+CONFIG_SPL_SIZE_LIMIT_SUBTRACT_MALLOC=y
+CONFIG_SPL_SYS_REPORT_STACK_F_USAGE=y
 CONFIG_SPL_STACK_R=y
 CONFIG_SPL_SEPARATE_BSS=y
 CONFIG_SPL_EARLY_BSS=y
Signature · 1 line
2.30.0