[U-Boot] [PATCH 0/4] at91: SPL size check for at91 boards

This is a review of the patch [U-Boot,RFC] ARM: at91: lds: add test SPL binary size and bbs size
Commit: ARM: at91: lds: add test SPL binary size and bbs size will check for the SPL size and bss to see if it can fit the known RAM area where it's supposed to be loaded. If the size exceeds, it will print an error in build. However, some platforms already have the SPL broken: it is too big for the RAM area. These platforms would fail to build if we enable this SPL size check. So, I made the commits for these defconfigs to disable SPL before adding the actual check (for bisectability, do not break any builds in between the series commits).
In short, first three commits will prepare defconfigs for the SPL check and the last commit will implement the actual size checks.
Eugen Hristev (2): configs: corvus_defconfig: Remove SPL configs: wb45n_defconfig: Remove SPL
Wenyou Yang (2): configs: picosam9g45_defconfig: Remove SPL ARM: at91: lds: add test SPL binary size and bbs size
arch/arm/mach-at91/arm926ejs/u-boot-spl.lds | 10 ++++++++++ configs/corvus_defconfig | 8 -------- configs/picosam9g45_defconfig | 10 ---------- configs/wb45n_defconfig | 6 ------ 4 files changed, 10 insertions(+), 24 deletions(-)

From: Wenyou Yang wenyou.yang@microchip.com
Due the size of SPL being too big, remove the SPL support. ---8<--- arm-none-linux-gnueabi-ld: SPL image too big --->8---
Signed-off-by: Wenyou Yang wenyou.yang@microchip.com [eugen.hristev@microchip.com: rebased on latest u-boot] Signed-off-by: Eugen Hristev eugen.hristev@microchip.com --- configs/picosam9g45_defconfig | 10 ---------- 1 file changed, 10 deletions(-)
diff --git a/configs/picosam9g45_defconfig b/configs/picosam9g45_defconfig index 699e2e2..a7af83b 100644 --- a/configs/picosam9g45_defconfig +++ b/configs/picosam9g45_defconfig @@ -3,14 +3,6 @@ CONFIG_SYS_THUMB_BUILD=y CONFIG_ARCH_AT91=y CONFIG_SYS_TEXT_BASE=0x23f00000 CONFIG_TARGET_PICOSAM9G45=y -CONFIG_SPL_GPIO_SUPPORT=y -CONFIG_SPL_LIBCOMMON_SUPPORT=y -CONFIG_SPL_LIBGENERIC_SUPPORT=y -CONFIG_SPL_MMC_SUPPORT=y -CONFIG_SPL_SERIAL_SUPPORT=y -CONFIG_SPL=y -CONFIG_SPL_FAT_SUPPORT=y -CONFIG_SPL_LIBDISK_SUPPORT=y CONFIG_NR_DRAM_BANKS=2 CONFIG_SYS_EXTRA_OPTIONS="AT91SAM9M10G45,SYS_USE_MMC" CONFIG_BOOTDELAY=3 @@ -20,7 +12,6 @@ CONFIG_BOOTARGS="console=ttyS0,115200 root=/dev/mmcblk0p2 rw rootwait" CONFIG_SYS_CONSOLE_IS_IN_ENV=y # CONFIG_DISPLAY_BOARDINFO is not set CONFIG_BOARD_EARLY_INIT_F=y -CONFIG_SPL_WATCHDOG_SUPPORT=y CONFIG_HUSH_PARSER=y CONFIG_SYS_PROMPT="U-Boot> " # CONFIG_CMD_BDI is not set @@ -41,6 +32,5 @@ CONFIG_USB_STORAGE=y CONFIG_LCD=y CONFIG_OF_LIBFDT=y CONFIG_DM=y -CONFIG_SPL_DM=y CONFIG_WDT=y CONFIG_WDT_AT91=y

Due the size of SPL being too big, remove the SPL support. ---8<--- arm-linux-gnueabi-ld: SPL image too big --->8---
Signed-off-by: Eugen Hristev eugen.hristev@microchip.com --- configs/corvus_defconfig | 8 -------- 1 file changed, 8 deletions(-)
diff --git a/configs/corvus_defconfig b/configs/corvus_defconfig index a1af2f1..f3d68a2 100644 --- a/configs/corvus_defconfig +++ b/configs/corvus_defconfig @@ -1,16 +1,9 @@ CONFIG_ARM=y CONFIG_SYS_THUMB_BUILD=y -# CONFIG_SPL_USE_ARCH_MEMCPY is not set -# CONFIG_SPL_USE_ARCH_MEMSET is not set CONFIG_ARCH_AT91=y CONFIG_SYS_TEXT_BASE=0x72000000 CONFIG_TARGET_CORVUS=y -CONFIG_SPL_GPIO_SUPPORT=y -CONFIG_SPL_LIBCOMMON_SUPPORT=y -CONFIG_SPL_LIBGENERIC_SUPPORT=y CONFIG_SYS_MALLOC_F_LEN=0x800 -CONFIG_SPL_SERIAL_SUPPORT=y -CONFIG_SPL=y CONFIG_NR_DRAM_BANKS=1 CONFIG_SYS_EXTRA_OPTIONS="AT91SAM9M10G45,MACH_TYPE=2066,SYS_USE_NANDFLASH" CONFIG_BOOTDELAY=3 @@ -18,7 +11,6 @@ CONFIG_USE_BOOTARGS=y CONFIG_BOOTARGS="console=ttyS0,115200 earlyprintk mtdparts=atmel_nand:256k(bootstrap)ro,512k(uboot)ro,256k(env),256k(env_redundant),256k(spare),512k(dtb),6M(kernel)ro,-(rootfs) root=/dev/mtdblock7 rw rootfstype=jffs2" # CONFIG_DISPLAY_BOARDINFO is not set CONFIG_BOARD_EARLY_INIT_F=y -CONFIG_SPL_NAND_SUPPORT=y CONFIG_HUSH_PARSER=y CONFIG_SYS_PROMPT="U-Boot> " # CONFIG_CMD_BDI is not set

Due the size of SPL being too big, remove the SPL support. ---8<--- arm-linux-gnueabi-ld: SPL image too big --->8---
Signed-off-by: Eugen Hristev eugen.hristev@microchip.com --- configs/wb45n_defconfig | 6 ------ 1 file changed, 6 deletions(-)
diff --git a/configs/wb45n_defconfig b/configs/wb45n_defconfig index 9d881e5..aef4e75 100644 --- a/configs/wb45n_defconfig +++ b/configs/wb45n_defconfig @@ -3,17 +3,11 @@ CONFIG_SYS_THUMB_BUILD=y CONFIG_ARCH_AT91=y CONFIG_SYS_TEXT_BASE=0x23f00000 CONFIG_TARGET_WB45N=y -CONFIG_SPL_GPIO_SUPPORT=y -CONFIG_SPL_LIBCOMMON_SUPPORT=y -CONFIG_SPL_LIBGENERIC_SUPPORT=y -CONFIG_SPL_SERIAL_SUPPORT=y -CONFIG_SPL=y CONFIG_NR_DRAM_BANKS=1 CONFIG_FIT=y CONFIG_SYS_EXTRA_OPTIONS="AT91SAM9X5,SYS_USE_NANDFLASH" CONFIG_BOOTDELAY=3 CONFIG_BOARD_EARLY_INIT_F=y -CONFIG_SPL_NAND_SUPPORT=y CONFIG_HUSH_PARSER=y CONFIG_CMD_BOOTZ=y CONFIG_CMD_MEMTEST=y

Hi,
A shame as these boards only really need to start NAND and boot uboot proper. Out of interest how much is it over in the builder?
If SPL can't be shrunk any further then fair enough and; Acked-by: Ben Whitten ben.whitten@lairdtech.com
Thanks, Ben
-----Original Message----- From: U-Boot [mailto:u-boot-bounces@lists.denx.de] On Behalf Of Eugen.Hristev@microchip.com Sent: 19 November 2018 08:23 To: u-boot@lists.denx.de Cc: Nicolas.Ferre@microchip.com Subject: [U-Boot] [PATCH 3/4] configs: wb45n_defconfig: Remove SPL
Due the size of SPL being too big, remove the SPL support. ---8<--- arm-linux-gnueabi-ld: SPL image too big --->8---
Signed-off-by: Eugen Hristev
eugen.hristev@microchip.com
configs/wb45n_defconfig | 6 ------ 1 file changed, 6 deletions(-)
diff --git a/configs/wb45n_defconfig b/configs/wb45n_defconfig index 9d881e5..aef4e75 100644 --- a/configs/wb45n_defconfig +++ b/configs/wb45n_defconfig @@ -3,17 +3,11 @@ CONFIG_SYS_THUMB_BUILD=y CONFIG_ARCH_AT91=y CONFIG_SYS_TEXT_BASE=0x23f00000 CONFIG_TARGET_WB45N=y -CONFIG_SPL_GPIO_SUPPORT=y -CONFIG_SPL_LIBCOMMON_SUPPORT=y -CONFIG_SPL_LIBGENERIC_SUPPORT=y -CONFIG_SPL_SERIAL_SUPPORT=y -CONFIG_SPL=y CONFIG_NR_DRAM_BANKS=1 CONFIG_FIT=y
CONFIG_SYS_EXTRA_OPTIONS="AT91SAM9X5,SYS_USE_NA NDFLASH" CONFIG_BOOTDELAY=3 CONFIG_BOARD_EARLY_INIT_F=y -CONFIG_SPL_NAND_SUPPORT=y CONFIG_HUSH_PARSER=y CONFIG_CMD_BOOTZ=y CONFIG_CMD_MEMTEST=y -- 2.7.4
_ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot

Just compiled with the bootlin toolchain ' armv5-eabi--musl--stable-2018.02-2' from within buildroot and it looks like an image is produced within size. text data bss dec hex filename 17965 1180 4480 23625 5c49 u-boot-spl
It looks like the assertion calculates the assertion incorrectly, will comment on that patch.
Ben
-----Original Message----- From: U-Boot [mailto:u-boot-bounces@lists.denx.de] On Behalf Of Ben Whitten Sent: 19 November 2018 10:30 To: Eugen.Hristev@microchip.com; u-boot@lists.denx.de Cc: Nicolas.Ferre@microchip.com Subject: Re: [U-Boot] [PATCH 3/4] configs: wb45n_defconfig: Remove SPL
Hi,
A shame as these boards only really need to start NAND and boot uboot proper. Out of interest how much is it over in the builder?
If SPL can't be shrunk any further then fair enough and; Acked-by: Ben Whitten ben.whitten@lairdtech.com
Thanks, Ben
-----Original Message----- From: U-Boot [mailto:u-boot-bounces@lists.denx.de] On Behalf Of Eugen.Hristev@microchip.com Sent: 19 November 2018 08:23 To: u-boot@lists.denx.de Cc: Nicolas.Ferre@microchip.com Subject: [U-Boot] [PATCH 3/4] configs: wb45n_defconfig: Remove SPL
Due the size of SPL being too big, remove the SPL support. ---8<--- arm-linux-gnueabi-ld: SPL image too big --->8---
Signed-off-by: Eugen Hristev
eugen.hristev@microchip.com
configs/wb45n_defconfig | 6 ------ 1 file changed, 6 deletions(-)
diff --git a/configs/wb45n_defconfig b/configs/wb45n_defconfig index 9d881e5..aef4e75 100644 --- a/configs/wb45n_defconfig +++ b/configs/wb45n_defconfig @@ -3,17 +3,11 @@ CONFIG_SYS_THUMB_BUILD=y CONFIG_ARCH_AT91=y CONFIG_SYS_TEXT_BASE=0x23f00000 CONFIG_TARGET_WB45N=y -CONFIG_SPL_GPIO_SUPPORT=y -CONFIG_SPL_LIBCOMMON_SUPPORT=y -CONFIG_SPL_LIBGENERIC_SUPPORT=y -CONFIG_SPL_SERIAL_SUPPORT=y -CONFIG_SPL=y CONFIG_NR_DRAM_BANKS=1 CONFIG_FIT=y
CONFIG_SYS_EXTRA_OPTIONS="AT91SAM9X5,SYS_USE_NA
NDFLASH" CONFIG_BOOTDELAY=3 CONFIG_BOARD_EARLY_INIT_F=y -CONFIG_SPL_NAND_SUPPORT=y CONFIG_HUSH_PARSER=y CONFIG_CMD_BOOTZ=y CONFIG_CMD_MEMTEST=y -- 2.7.4
_ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
_ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot

From: Wenyou Yang wenyou.yang@atmel.com
Add the test for the SPL binary size and the bbs section size.
Signed-off-by: Wenyou Yang wenyou.yang@atmel.com --- arch/arm/mach-at91/arm926ejs/u-boot-spl.lds | 10 ++++++++++ 1 file changed, 10 insertions(+)
diff --git a/arch/arm/mach-at91/arm926ejs/u-boot-spl.lds b/arch/arm/mach-at91/arm926ejs/u-boot-spl.lds index eca78f8..82098dc 100644 --- a/arch/arm/mach-at91/arm926ejs/u-boot-spl.lds +++ b/arch/arm/mach-at91/arm926ejs/u-boot-spl.lds @@ -48,3 +48,13 @@ SECTIONS __bss_end = .; } >.sdram } + +#if defined(CONFIG_SPL_MAX_SIZE) +ASSERT(__image_copy_end - __image_copy_start < (CONFIG_SPL_MAX_SIZE), \ + "SPL image too big"); +#endif + +#if defined(CONFIG_SPL_BSS_MAX_SIZE) +ASSERT(__bss_end - __bss_start < (CONFIG_SPL_BSS_MAX_SIZE), \ + "SPL image BSS too big"); +#endif

-----Original Message----- From: U-Boot [mailto:u-boot-bounces@lists.denx.de] On Behalf Of Eugen.Hristev@microchip.com Sent: 19 November 2018 08:23 To: u-boot@lists.denx.de Cc: Nicolas.Ferre@microchip.com; wenyou.yang@atmel.com Subject: [U-Boot] [PATCH 4/4] ARM: at91: lds: add test SPL binary size and bbs size
From: Wenyou Yang wenyou.yang@atmel.com
Add the test for the SPL binary size and the bbs section size.
Signed-off-by: Wenyou Yang wenyou.yang@atmel.com
arch/arm/mach-at91/arm926ejs/u-boot-spl.lds | 10 ++++++++++ 1 file changed, 10 insertions(+)
diff --git a/arch/arm/mach-at91/arm926ejs/u-boot-spl.lds b/arch/arm/mach-at91/arm926ejs/u-boot-spl.lds index eca78f8..82098dc 100644 --- a/arch/arm/mach-at91/arm926ejs/u-boot-spl.lds +++ b/arch/arm/mach-at91/arm926ejs/u-boot-spl.lds @@ -48,3 +48,13 @@ SECTIONS __bss_end = .; } >.sdram }
+#if defined(CONFIG_SPL_MAX_SIZE) +ASSERT(__image_copy_end - __image_copy_start <
There is no __image_copy_start causing SPL size calculation to error, replacing with __start resolves it.
(CONFIG_SPL_MAX_SIZE), \
- "SPL image too big");
+#endif
+#if defined(CONFIG_SPL_BSS_MAX_SIZE) +ASSERT(__bss_end - __bss_start < (CONFIG_SPL_BSS_MAX_SIZE), \
- "SPL image BSS too big");
+#endif
2.7.4
_ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot

On 19.11.2018 16:31, Ben Whitten wrote:
-----Original Message----- From: U-Boot [mailto:u-boot-bounces@lists.denx.de] On Behalf Of Eugen.Hristev@microchip.com Sent: 19 November 2018 08:23 To: u-boot@lists.denx.de Cc: Nicolas.Ferre@microchip.com; wenyou.yang@atmel.com Subject: [U-Boot] [PATCH 4/4] ARM: at91: lds: add test SPL binary size and bbs size
From: Wenyou Yang wenyou.yang@atmel.com
Add the test for the SPL binary size and the bbs section size.
Signed-off-by: Wenyou Yang wenyou.yang@atmel.com
arch/arm/mach-at91/arm926ejs/u-boot-spl.lds | 10 ++++++++++ 1 file changed, 10 insertions(+)
diff --git a/arch/arm/mach-at91/arm926ejs/u-boot-spl.lds b/arch/arm/mach-at91/arm926ejs/u-boot-spl.lds index eca78f8..82098dc 100644 --- a/arch/arm/mach-at91/arm926ejs/u-boot-spl.lds +++ b/arch/arm/mach-at91/arm926ejs/u-boot-spl.lds @@ -48,3 +48,13 @@ SECTIONS __bss_end = .; } >.sdram }
+#if defined(CONFIG_SPL_MAX_SIZE) +ASSERT(__image_copy_end - __image_copy_start <
There is no __image_copy_start causing SPL size calculation to error, replacing with __start resolves it.
Thank you, I will modify the patch and test. This means that we can let the SPL in configuration, which is great news.
Eugen
(CONFIG_SPL_MAX_SIZE), \
- "SPL image too big");
+#endif
+#if defined(CONFIG_SPL_BSS_MAX_SIZE) +ASSERT(__bss_end - __bss_start < (CONFIG_SPL_BSS_MAX_SIZE), \
- "SPL image BSS too big");
+#endif
2.7.4
_ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
participants (2)
-
Ben Whitten
-
Eugen.Hristev@microchip.com