
On some platform we have sufficient memory available early on to allow setting up and using a basic BSS prior to relocation. In order to be able to preserve data written to BSS during early startup add a Kconfig option allowing to skip the clearing of the BSS section during setting up of the final environment / relocation.
Signed-off-by: Andreas Dannenberg dannenberg@ti.com --- arch/arm/lib/crt0.S | 3 +++ common/spl/Kconfig | 13 +++++++++++++ 2 files changed, 16 insertions(+)
diff --git a/arch/arm/lib/crt0.S b/arch/arm/lib/crt0.S index fe312db690..17645469fc 100644 --- a/arch/arm/lib/crt0.S +++ b/arch/arm/lib/crt0.S @@ -124,6 +124,8 @@ here: movne sp, r0 movne r9, r0 # endif + +#if !CONFIG_IS_ENABLED(SKIP_CLEAR_BSS) ldr r0, =__bss_start /* this is auto-relocated! */
#ifdef CONFIG_USE_ARCH_MEMSET @@ -141,6 +143,7 @@ clbss_l:cmp r0, r1 /* while not at end of BSS */ addlo r0, r0, #4 /* move to next */ blo clbss_l #endif +#endif
#if ! defined(CONFIG_SPL_BUILD) bl coloured_LED_init diff --git a/common/spl/Kconfig b/common/spl/Kconfig index dd078fe79d..f9eb1a0e31 100644 --- a/common/spl/Kconfig +++ b/common/spl/Kconfig @@ -188,6 +188,19 @@ config TPL_BANNER_PRINT info. Disabling this option could be useful to reduce SPL boot time (e.g. approx. 6 ms faster, when output on i.MX6 with 115200 baud).
+ +config SPL_SKIP_CLEAR_BSS + depends on ARM && !ARM64 + bool "Skips clearing BSS section during environment setup / relocation" + help + On some platform we have sufficient memory available early on to + allow setting up and using a basic BSS prior to relocation. In order + to preserve data written to BSS during early startup use use this + option to skip the clearing of the BSS section. Note that activating + this option implies that you are responsible for clearing the BSS + section yourself, otherwise you will most likely end up with an + invalid post-relocation environment. + config SPL_DISPLAY_PRINT bool "Display a board-specific message in SPL" help