[U-Boot] [PATCH v2 4/4] ARM: fix CONFIG_SPL_MAX_SIZE semantics

Albert ARIBAUD albert.u.boot at aribaud.net
Wed Apr 10 01:14:55 CEST 2013


Remove SPL-related ASSERT() in arch/arm/cpu/u-boot.lds
as this file is never used for SPL builds.

Rewrite the ASSERT() in arch/arm/cpu/u-boot-spl.lds
to separately test image (text,data,rodata...) size
and BSS size each against its own max.

Also, output section mmutable is not used in SPL builds.
Remove it.

Finally, update README regarding the (now homogeneous)
semantics of the CONFIG_SPL_MAX_SIZE and
CONFIG_SPL_BSS_MAX_SIZE macros.

Signed-off-by: Albert ARIBAUD <albert.u.boot at aribaud.net>
Reported-by: Benoît Thébaudeau <benoit.thebaudeau at advansee.com>
---
Changes in v2:
- removed mmutable in SPL linker file

 README                      |   17 +++++++++++++++--
 arch/arm/cpu/u-boot-spl.lds |   19 ++++++++-----------
 arch/arm/cpu/u-boot.lds     |    4 ----
 3 files changed, 23 insertions(+), 17 deletions(-)

diff --git a/README b/README
index 5c5cd18..f31ded0 100644
--- a/README
+++ b/README
@@ -2776,7 +2776,14 @@ FIT uImage format:
 		LDSCRIPT for linking the SPL binary.
 
 		CONFIG_SPL_MAX_SIZE
-		Maximum binary size (text, data and rodata) of the SPL binary.
+		Maximum size for the image (sum of the text, data, rodata
+		and linker lists sections) of the SPL executable.
+		When defined, linker checks that the actual image size does
+		not exceed it.
+		The total amount of memory used by the SPL when running is
+		equal CONFIG_SPL_MAX_SIZE, plus CONFIG_SPL_BSS_MAX_SIZE if
+		it exists.
+		Note: image and BSS are disjoint for some targets.
 
 		CONFIG_SPL_TEXT_BASE
 		TEXT_BASE for linking the SPL binary.
@@ -2789,7 +2796,13 @@ FIT uImage format:
 		Link address for the BSS within the SPL binary.
 
 		CONFIG_SPL_BSS_MAX_SIZE
-		Maximum binary size of the BSS section of the SPL binary.
+		Maximum size of the BSS section of the SPL executable.
+		When defined, linker checks that the actual BSS size does
+		not exceed it.
+		The total amount of memory used by the SPL when running is
+		equal CONFIG_SPL_MAX_SIZE, plus CONFIG_SPL_BSS_MAX_SIZE if
+		it exists.
+		Note: image and BSS are disjoint for some targets.
 
 		CONFIG_SPL_STACK
 		Adress of the start of the stack SPL will use
diff --git a/arch/arm/cpu/u-boot-spl.lds b/arch/arm/cpu/u-boot-spl.lds
index 3c0d99c..2e86de4 100644
--- a/arch/arm/cpu/u-boot-spl.lds
+++ b/arch/arm/cpu/u-boot-spl.lds
@@ -65,15 +65,6 @@ SECTIONS
 
 	_end = .;
 
-	/*
-	 * Deprecated: this MMU section is used by pxa at present but
-	 * should not be used by new boards/CPUs.
-	 */
-	. = ALIGN(4096);
-	.mmutable : {
-		*(.mmutable)
-	}
-
 	.bss __rel_dyn_start (OVERLAY) : {
 		__bss_start = .;
 		*(.bss*)
@@ -88,6 +79,12 @@ SECTIONS
 	/DISCARD/ : { *(.gnu*) }
 }
 
-#if defined(CONFIG_SPL_TEXT_BASE) && defined(CONFIG_SPL_MAX_SIZE)
-ASSERT(__bss_end < (CONFIG_SPL_TEXT_BASE + CONFIG_SPL_MAX_SIZE), "SPL image too big");
+#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
diff --git a/arch/arm/cpu/u-boot.lds b/arch/arm/cpu/u-boot.lds
index 3a1083d..7bbc4f5 100644
--- a/arch/arm/cpu/u-boot.lds
+++ b/arch/arm/cpu/u-boot.lds
@@ -101,7 +101,3 @@ SECTIONS
 	/DISCARD/ : { *(.interp*) }
 	/DISCARD/ : { *(.gnu*) }
 }
-
-#if defined(CONFIG_SPL_TEXT_BASE) && defined(CONFIG_SPL_MAX_SIZE)
-ASSERT(__bss_end < (CONFIG_SPL_TEXT_BASE + CONFIG_SPL_MAX_SIZE), "SPL image too big");
-#endif
-- 
1.7.10.4



More information about the U-Boot mailing list