]> git.kernelconcepts.de Git - karo-tx-uboot.git/commitdiff
ARM: fix CONFIG_SPL_MAX_SIZE semantics
authorAlbert ARIBAUD <albert.u.boot@aribaud.net>
Fri, 12 Apr 2013 05:14:30 +0000 (05:14 +0000)
committerAlbert ARIBAUD <albert.u.boot@aribaud.net>
Sun, 14 Apr 2013 14:07:14 +0000 (16:07 +0200)
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,
BSS size, and full footprint each against its own max,
and make Tegra boards check full footprint.

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

Finally, update README regarding the (now homogeneous)
semantics of CONFIG_SPL_[BSS_]MAX_SIZE and add the new
CONFIG_SPL_MAX_FOOTPRINT macro.

Signed-off-by: Albert ARIBAUD <albert.u.boot@aribaud.net>
Reported-by: Benoît Thébaudeau <benoit.thebaudeau@advansee.com>
README
arch/arm/cpu/u-boot-spl.lds
arch/arm/cpu/u-boot.lds
include/configs/tegra-common.h

diff --git a/README b/README
index 14c83f4bb1796698e3a88b192a390395c51febeb..19da9c81eb39f50e8097886550da2f23c7f4d8bd 100644 (file)
--- a/README
+++ b/README
@@ -2831,8 +2831,18 @@ FIT uImage format:
                CONFIG_SPL_LDSCRIPT
                LDSCRIPT for linking the SPL binary.
 
+               CONFIG_SPL_MAX_FOOTPRINT
+               Maximum size in memory allocated to the SPL, BSS included.
+               When defined, the linker checks that the actual memory
+               used by SPL from _start to __bss_end does not exceed it.
+               CONFIG_SPL_MAX_FOOTPRINT and CONFIG_SPL_MAX_BSS_SIZE
+               must not be both defined at the same time.
+
                CONFIG_SPL_MAX_SIZE
-               Maximum binary size (text, data and rodata) of the SPL binary.
+               Maximum size of the SPL image (text, data, rodata, and
+               linker lists sections), BSS excluded.
+               When defined, the linker checks that the actual size does
+               not exceed it.
 
                CONFIG_SPL_TEXT_BASE
                TEXT_BASE for linking the SPL binary.
@@ -2845,7 +2855,11 @@ 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 in memory allocated to the SPL BSS.
+               When defined, the linker checks that the actual memory used
+               by SPL from __bss_start to __bss_end does not exceed it.
+               CONFIG_SPL_MAX_FOOTPRINT and CONFIG_SPL_MAX_BSS_SIZE
+               must not be both defined at the same time.
 
                CONFIG_SPL_STACK
                Adress of the start of the stack SPL will use
index 3c0d99ca3664c1021b754aa81fb23fb2a1ca70be..1408f03b2343ccb2569a9e3a7b6ad1ddf77444a2 100644 (file)
@@ -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,17 @@ 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
+
+#if defined(CONFIG_SPL_MAX_FOOTPRINT)
+ASSERT(__bss_end - _start < (CONFIG_SPL_MAX_FOOTPRINT), \
+       "SPL image plus BSS too big");
 #endif
index d5e42d3ac942a316590a56d97b3c1cddb2880f21..d9bbee3b27dd39a903ef4e1092d50e4212747f71 100644 (file)
@@ -107,7 +107,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
index 036ded0c79f485230b8bd08f1a05212722f6b6dd..e9241b8dff8ddd46a2066fba396e2711b9210da2 100644 (file)
 #define CONFIG_SPL_RAM_DEVICE
 #define CONFIG_SPL_BOARD_INIT
 #define CONFIG_SPL_NAND_SIMPLE
-#define CONFIG_SPL_MAX_SIZE            (CONFIG_SYS_TEXT_BASE - \
+#define CONFIG_SPL_MAX_FOOTPRINT       (CONFIG_SYS_TEXT_BASE - \
                                                CONFIG_SPL_TEXT_BASE)
 #define CONFIG_SYS_SPL_MALLOC_SIZE     0x00010000