malloc_simple: Add support for switching to DRAM heap
Subsystems (2)
cover malloc_simple: Add support for switching to DRAM heap
Hi Simon,
Here is a patch-set to add support to keep using simple-malloc after dram is available in the SPL, using the spl stack relocation function to switch to a new heap which uses a chunk of the now in DRAM stack.
I think you're the best candidate to review and merge the core patches (patches 1 - 4).
I'll merge the sunxi patches through my tree once the core patches are in place. Esp. the patch to make sunxi use CONFIG_SPL_STACK_R is likely to cause conflicts if not merged through the sunxi tree.
Regards,
Hans
p.s.
In case it is not clear, these patches are intended for the next devel cycle.
PATCH 1/7 spl: spl_relocate_stack_gd: Do not unnecessarily clear bss
spl_relocate_stack_gd only gets called from arch/arm/lib/crt0.S which clears the bss directly after calling it, so there is no need to clear it from spl_relocate_stack_gd.
--- common/spl/spl.c | 3 --- 1 file changed, 3 deletions(-)
common/spl/spl.c +0 -3
@@ -347,9 +347,6 @@ ulong spl_relocate_stack_gd(void)memcpy (new_gd, (void *)gd,sizeof (gd_t)); gd = new_gd; -/* Clear the BSS. */ -memset (__bss_start,0 , __bss_end - __bss_start); -return ptr;#else return 0 ;
Signature · 1 line
2.4.3
PATCH 1/7 spl: spl_relocate_stack_gd: Do not unnecessarily clear bss
Hi Hans,
Quoted 9 lines · Hans de Goede
spl_relocate_stack_gdonly gets called fromarch/arm/lib/crt0.Swhich clears the bss directly after calling it, so there is no need to clear it fromspl_relocate_stack_gd.Signed-off-by Hans de Goede <[email protected]>--- common/spl/spl.c | 3 --- 1 file changed, 3 deletions(-)
I think it makes sense to move the BSS clear to C, but that would be separate from your patch. Yes we should remove this duplication.
See also this:
http://patchwork.ozlabs.org/patch/512030/
Quoted 16 lines
common/spl/spl.c +0
-4@@ -347,9 +347,6 @@ ulong spl_relocate_stack_gd(void)memcpy (new_gd, (void *)gd,sizeof (gd_t)); gd = new_gd; -/* Clear the BSS. */ -memset (__bss_start,0 , __bss_end - __bss_start); -return ptr;#else return 0 ; --
Quoted 2 lines
2.4.3
Regards,
Simon
PATCH 2/7 malloc_simple: Fix malloc_ptr calculation
In reply to Hans de GoedeFrom: Philipp Rosenberger <[email protected]>
The gd->malloc_ptr and the gd->malloc_limit are offsets to gd->malloc_base. But the addr variable contains the absolute address. The new_ptr must be:
addr + bytes - gd->malloc_base.
--- common/malloc_simple.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
common/malloc_simple.c +1 -1
@@ -32,7 +32,7 @@ void *memalign_simple(size_t align, size_t bytes)void *ptr; addr =ALIGN (gd->malloc_base + gd->malloc_ptr, align); - new_ptr = addr + bytes; + new_ptr = addr + bytes - gd->malloc_base;if (new_ptr > gd->malloc_limit)return NULL ; ptr =map_sysmem (addr, bytes);
Signature · 1 line
2.4.3
PATCH 2/7 malloc_simple: Fix malloc_ptr calculation
Quoted 6 lines · Hans de Goede
From: Philipp Rosenberger <[email protected]>
The
gd->malloc_ptrand thegd->malloc_limitare offsets togd->malloc_base. But the addr variable contains the absolute address. Thenew_ptrmust be:
addr + bytes -gd->malloc_base.
Quoted 6 lines
Signed-off-by Philipp Rosenberger <[email protected]>Reviewed-by Hans de Goede <[email protected]>Signed-off-by Hans de Goede <[email protected]>--- common/malloc_simple.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Eek! Nice to find this one.
Quoted 17 lines
common/malloc_simple.c +1
-2@@ -32,7 +32,7 @@ void *memalign_simple(size_t align, size_t bytes)void *ptr; addr =ALIGN (gd->malloc_base + gd->malloc_ptr, align); - new_ptr = addr + bytes; + new_ptr = addr + bytes - gd->malloc_base;if (new_ptr > gd->malloc_limit)return NULL ; ptr =map_sysmem (addr, bytes); --2.4.3
PATCH 3/7 malloc_simple: Add Kconfig option for using only malloc_simple in the SPL
In reply to Hans de Goedecommon/dlmalloc.c is quite big, both in .text and .data usage, therefor on some boards the SPL is build to use only malloc_simple.c and not the dlmalloc.c code. This is done in various include/configs/foo.h with the following construct:
This commit introduces a SPL_MALLOC_SIMPLE Kconfig bool which allows selecting this functionality through Kconfig instead.
--- Kconfig | 10 ++++++++++ common/malloc_simple.c | 3 ++- include/_exports.h | 3 ++- include/exports.h | 3 ++- include/malloc.h | 3 ++- 5 files changed, 18 insertions(+), 4 deletions(-)
Kconfig +10 -0
@@ -114,6 +114,16 @@ config SPL help If you want to build SPL as well as the normal image, say Y. +config SPL_MALLOC_SIMPLE + bool + depends on SPL + prompt "Only use malloc_simple functions in the spl" + help + Say Y here to only use the *_simple malloc functions from + malloc_simple.c, rather then using the versions from dlmalloc.c + this will make the SPL binary smaller at the cost of more heap + usage as the *_simple malloc functions do not re-use free-ed mem. + config SPL_STACK_R depends on SPL bool "Enable SDRAM location for SPL stack"
common/malloc_simple.c +2 -1
@@ -40,7 +40,8 @@ void *memalign_simple(size_t align, size_t bytes)return ptr; } -#ifdef CONFIG_SYS_MALLOC_SIMPLE +#if (definedCONFIG_SPL_BUILD && definedCONFIG_SPL_MALLOC_SIMPLE ) || \ + (definedCONFIG_SYS_MALLOC_SIMPLE )void *calloc (size_t nmemb,size_t elem_size) {size_t size = nmemb * elem_size;
include/_exports.h +2 -1
@@ -23,7 +23,8 @@ EXPORT_FUNC(dummy, void, free_hdlr, void)#endif EXPORT_FUNC(malloc, void *, malloc, size_t) -#ifndef CONFIG_SYS_MALLOC_SIMPLE +#if !(definedCONFIG_SPL_BUILD && definedCONFIG_SPL_MALLOC_SIMPLE ) && \ + !(definedCONFIG_SYS_MALLOC_SIMPLE ) EXPORT_FUNC(free, void, free, void *) #endif EXPORT_FUNC(udelay, void, udelay, unsigned long)
include/exports.h +2 -1
@@ -19,7 +19,8 @@ int printf(const char* fmt, ...);void install_hdlr (int ,interrupt_handler_t ,void *);void free_hdlr (int );void *malloc (size_t ); -#ifndef CONFIG_SYS_MALLOC_SIMPLE +#if !(definedCONFIG_SPL_BUILD && definedCONFIG_SPL_MALLOC_SIMPLE ) && \ + !(definedCONFIG_SYS_MALLOC_SIMPLE )void free (void *);#endif void __udelay (unsigned long );
include/malloc.h +2 -1
@@ -872,7 +872,8 @@ extern Void_t* sbrk();#else -#ifdef CONFIG_SYS_MALLOC_SIMPLE +#if (definedCONFIG_SPL_BUILD && definedCONFIG_SPL_MALLOC_SIMPLE ) || \ + (definedCONFIG_SYS_MALLOC_SIMPLE )#define malloc malloc_simple#define realloc realloc_simple#define memalign memalign_simple
Signature · 1 line
2.4.3
PATCH 3/7 malloc_simple: Add Kconfig option for using only malloc_simple in the SPL
Hi Hans,
Quoted 5 lines · Hans de Goede
common/dlmalloc.cis quite big, both in .text and .data usage, therefor on some boards the SPL is build to use onlymalloc_simple.cand not thedlmalloc.ccode. This is done in variousinclude/configs/foo.hwith the following construct:
Was there a '#' at the start of this missing line?
Quoted 17 lines
This commit introduces a
SPL_MALLOC_SIMPLEKconfigbool which allows selecting this functionality throughKconfiginstead.Signed-off-by Hans de Goede <[email protected]>--- Kconfig | 10 ++++++++++ common/malloc_simple.c | 3 ++- include/_exports.h | 3 ++- include/exports.h | 3 ++- include/malloc.h | 3 ++- 5 files changed, 18 insertions(+), 4 deletions(-)Kconfig +0
-0
Kconfig config SPL · line 117
Quoted 4 lines
Kconfig +1
-0@@ -114,6 +114,16 @@ config SPL help If you want to build SPL as well as the normal image, say Y. +config SPL_MALLOC_SIMPLE
If you made it SPL_SYS_MALLOC_SIMPLE...
Quoted 17 lines
Kconfig +9
-0+ bool + depends on SPL + prompt "Only use malloc_simple functions in the spl" + help + Say Y here to only use the *_simple malloc functions from + malloc_simple.c, rather then using the versions from dlmalloc.c + this will make the SPL binary smaller at the cost of more heap + usage as the *_simple malloc functions do not re-use free-ed mem. + config SPL_STACK_R depends on SPL bool "Enable SDRAM location for SPL stack"common/malloc_simple.c +0
-0
common/malloc_simple.c void *memalign_simple(size_t align, size_t bytes) · line 44
Quoted 6 lines
common/malloc_simple.c +2
-1@@ -40,7 +40,8 @@ void *memalign_simple(size_t align, size_t bytes)return ptr; } -#ifdef CONFIG_SYS_MALLOC_SIMPLE +#if (definedCONFIG_SPL_BUILD && definedCONFIG_SPL_MALLOC_SIMPLE ) || \ + (definedCONFIG_SYS_MALLOC_SIMPLE )
then I think this could become:
#if CONFIG_IS_ENABLED(SYS_MALLOC_SIMPLE)
Quoted 46 lines
common/malloc_simple.c +0
-0void *calloc (size_t nmemb,size_t elem_size) {size_t size = nmemb * elem_size;include/_exports.h +2
-1@@ -23,7 +23,8 @@ EXPORT_FUNC(dummy, void, free_hdlr, void)#endif EXPORT_FUNC(malloc, void *, malloc, size_t) -#ifndef CONFIG_SYS_MALLOC_SIMPLE +#if !(definedCONFIG_SPL_BUILD && definedCONFIG_SPL_MALLOC_SIMPLE ) && \ + !(definedCONFIG_SYS_MALLOC_SIMPLE ) EXPORT_FUNC(free, void, free, void *) #endif EXPORT_FUNC(udelay, void, udelay, unsigned long)include/exports.h +2
-1@@ -19,7 +19,8 @@ int printf(const char* fmt, ...);void install_hdlr (int ,interrupt_handler_t ,void *);void free_hdlr (int );void *malloc (size_t ); -#ifndef CONFIG_SYS_MALLOC_SIMPLE +#if !(definedCONFIG_SPL_BUILD && definedCONFIG_SPL_MALLOC_SIMPLE ) && \ + !(definedCONFIG_SYS_MALLOC_SIMPLE )void free (void *);#endif void __udelay (unsigned long );include/malloc.h +2
-2@@ -872,7 +872,8 @@ extern Void_t* sbrk();#else -#ifdef CONFIG_SYS_MALLOC_SIMPLE +#if (definedCONFIG_SPL_BUILD && definedCONFIG_SPL_MALLOC_SIMPLE ) || \ + (definedCONFIG_SYS_MALLOC_SIMPLE )#define malloc malloc_simple#define realloc realloc_simple#define memalign memalign_simple --
Quoted 2 lines
2.4.3
Regards,
Simon
PATCH 3/7 malloc_simple: Add Kconfig option for using only malloc_simple in the SPL
Hi,
Quoted 10 lines · Simon Glass
Hi Hans,
Quoted 5 lines · Hans de Goede
common/dlmalloc.cis quite big, both in .text and .data usage, therefor on some boards the SPL is build to use onlymalloc_simple.cand not thedlmalloc.ccode. This is done in variousinclude/configs/foo.hwith the following construct:Was there a '#' at the start of this missing line?
Yep, I keep falling over git commit eating up any lines starting with a # when quoting code snippets in commit messages...
I will fix this and send a v2.
Quoted 44 lines
Quoted 17 lines
This commit introduces a
SPL_MALLOC_SIMPLEKconfigbool which allows selecting this functionality throughKconfiginstead.Signed-off-by Hans de Goede <[email protected]>--- Kconfig | 10 ++++++++++ common/malloc_simple.c | 3 ++- include/_exports.h | 3 ++- include/exports.h | 3 ++- include/malloc.h | 3 ++- 5 files changed, 18 insertions(+), 4 deletions(-)Kconfig +0
-0Kconfig config SPL · line 117
Quoted 4 lines
Kconfig +1
-0@@ -114,6 +114,16 @@ config SPL help If you want to build SPL as well as the normal image, say Y. +config SPL_MALLOC_SIMPLEIf you made it
SPL_SYS_MALLOC_SIMPLE...Quoted 20 lines
Kconfig +9
-0+ bool + depends on SPL + prompt "Only use malloc_simple functions in the spl" + help + Say Y here to only use the *_simple malloc functions from + malloc_simple.c, rather then using the versions from dlmalloc.c + this will make the SPL binary smaller at the cost of more heap + usage as the *_simple malloc functions do not re-use free-ed mem. + config SPL_STACK_R depends on SPL bool "Enable SDRAM location for SPL stack"common/malloc_simple.c +0
-0@@ -40,7 +40,8 @@ void *memalign_simple(size_t align, size_t bytes)return ptr; }
Quoted 7 lines
common/malloc_simple.c void *memalign_simple(size_t align, size_t bytes) · line 44
Quoted 3 lines
common/malloc_simple.c +2
-1-#ifdef CONFIG_SYS_MALLOC_SIMPLE +#if (definedCONFIG_SPL_BUILD && definedCONFIG_SPL_MALLOC_SIMPLE ) || \ + (definedCONFIG_SYS_MALLOC_SIMPLE )then I think this could become:
#if
CONFIG_IS_ENABLED(SYS_MALLOC_SIMPLE)
I think you're right, good one. I'll give this a spin and if it works include the change in V2.
Quoted 39 lines
Quoted 39 lines
common/malloc_simple.c +0
-0void *calloc (size_t nmemb,size_t elem_size) {size_t size = nmemb * elem_size;include/_exports.h +2
-1@@ -23,7 +23,8 @@ EXPORT_FUNC(dummy, void, free_hdlr, void)#endif EXPORT_FUNC(malloc, void *, malloc, size_t) -#ifndef CONFIG_SYS_MALLOC_SIMPLE +#if !(definedCONFIG_SPL_BUILD && definedCONFIG_SPL_MALLOC_SIMPLE ) && \ + !(definedCONFIG_SYS_MALLOC_SIMPLE ) EXPORT_FUNC(free, void, free, void *) #endif EXPORT_FUNC(udelay, void, udelay, unsigned long)include/exports.h +2
-1@@ -19,7 +19,8 @@ int printf(const char* fmt, ...);void install_hdlr (int ,interrupt_handler_t ,void *);void free_hdlr (int );void *malloc (size_t ); -#ifndef CONFIG_SYS_MALLOC_SIMPLE +#if !(definedCONFIG_SPL_BUILD && definedCONFIG_SPL_MALLOC_SIMPLE ) && \ + !(definedCONFIG_SYS_MALLOC_SIMPLE )void free (void *);#endif void __udelay (unsigned long );include/malloc.h +0
-0@@ -872,7 +872,8 @@ extern Void_t* sbrk();#else
Quoted 13 lines
Quoted 9 lines
include/malloc.h +2
-2-#ifdef CONFIG_SYS_MALLOC_SIMPLE +#if (definedCONFIG_SPL_BUILD && definedCONFIG_SPL_MALLOC_SIMPLE ) || \ + (definedCONFIG_SYS_MALLOC_SIMPLE )#define malloc malloc_simple#define realloc realloc_simple#define memalign memalign_simple --2.4.3
Regards,
Simon
Regards,
Hans
PATCH 4/7 malloc_simple: Add support for switching to DRAM heap
In reply to Hans de Goedemalloc_simple uses a part of the stack as heap, initially it uses SYS_MALLOC_F_LEN bytes which typically is quite small as the initial stacks sits in SRAM and we do not have that much SRAM to work with.
When DRAM becomes available we may switch the stack from SRAM to DRAM to give use more room. This commit adds support for also switching to a new bigger malloc_simple heap located in the new stack.
--- Kconfig | 10 ++++++++++ common/spl/spl.c | 9 +++++++++ 2 files changed, 19 insertions(+)
Kconfig +10 -0
@@ -142,6 +142,16 @@ config SPL_STACK_R_ADDR Specify the address in SDRAM for the SPL stack. This will be set up before board_init_r() is called. +config SPL_STACK_R_MALLOC_SIMPLE_LEN + depends on SPL_STACK_R && SPL_MALLOC_SIMPLE + hex "Size of malloc_simple heap after switching to DRAM SPL stack" + default 0x100000 + help + Specify the amount of the stack to use as memory pool for + malloc_simple after switching the stack to DRAM. This may be set + to give board_init_r() a larger heap then the initial heap in + SRAM which is limited to SYS_MALLOC_F_LEN bytes. + config TPL bool depends on SPL && SUPPORT_TPL
common/spl/spl.c +9 -0
@@ -347,6 +347,15 @@ ulong spl_relocate_stack_gd(void)memcpy (new_gd, (void *)gd,sizeof (gd_t)); gd = new_gd; +#ifdef CONFIG_SPL_MALLOC_SIMPLE +if (CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN ) { + ptr -=CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN ; + gd->malloc_base = ptr; + gd->malloc_limit =CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN ; + gd->malloc_ptr =0 ; + } +#endif +return ptr;#else return 0 ;
Signature · 1 line
2.4.3
PATCH 4/7 malloc_simple: Add support for switching to DRAM heap
Hi Hans,
Quoted 40 lines · Hans de Goede
malloc_simpleuses a part of the stack as heap, initially it usesSYS_MALLOC_F_LENbytes which typically is quite small as the initial stacks sits in SRAM and we do not have that much SRAM to work with.When DRAM becomes available we may switch the stack from SRAM to DRAM to give use more room. This commit adds support for also switching to a new bigger
malloc_simpleheap located in the new stack.Signed-off-by Hans de Goede <[email protected]>--- Kconfig | 10 ++++++++++ common/spl/spl.c | 9 +++++++++ 2 files changed, 19 insertions(+)Kconfig +10
-0@@ -142,6 +142,16 @@ config SPL_STACK_R_ADDR Specify the address in SDRAM for the SPL stack. This will be set up before board_init_r() is called. +config SPL_STACK_R_MALLOC_SIMPLE_LEN + depends on SPL_STACK_R && SPL_MALLOC_SIMPLE + hex "Size of malloc_simple heap after switching to DRAM SPL stack" + default 0x100000 + help + Specify the amount of the stack to use as memory pool for + malloc_simple after switching the stack to DRAM. This may be set + to give board_init_r() a larger heap then the initial heap in + SRAM which is limited to SYS_MALLOC_F_LEN bytes. + config TPL bool depends on SPL && SUPPORT_TPLcommon/spl/spl.c +0
-0
common/spl/spl.c ulong spl_relocate_stack_gd(void) · line 351
Quoted 5 lines
common/spl/spl.c +2
-0@@ -347,6 +347,15 @@ ulong spl_relocate_stack_gd(void)memcpy (new_gd, (void *)gd,sizeof (gd_t)); gd = new_gd; +#ifdef CONFIG_SPL_MALLOC_SIMPLE +if (CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN ) {
Do you think we could do:
if (IS_ENABLED(CONFIG_SPL_MALLOC_SIMPLE) &&CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN)
to avoid the #ifdef?
Quoted 11 lines
common/spl/spl.c +7
-1+ ptr -=CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN ; + gd->malloc_base = ptr; + gd->malloc_limit =CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN ; + gd->malloc_ptr = 0; + } +#endif +return ptr;#else return 0 ; --
Quoted 2 lines
2.4.3
I have to say I worry a little bit about combinatoric explosion with this series. But I can't immediately see a better way.
Regards,
Simon
PATCH 4/7 malloc_simple: Add support for switching to DRAM heap
Hi,
Thanks for all the reviews.
Quoted 51 lines · Simon Glass
Hi Hans,
Quoted 40 lines · Hans de Goede
malloc_simpleuses a part of the stack as heap, initially it usesSYS_MALLOC_F_LENbytes which typically is quite small as the initial stacks sits in SRAM and we do not have that much SRAM to work with.When DRAM becomes available we may switch the stack from SRAM to DRAM to give use more room. This commit adds support for also switching to a new bigger
malloc_simpleheap located in the new stack.Signed-off-by Hans de Goede <[email protected]>--- Kconfig | 10 ++++++++++ common/spl/spl.c | 9 +++++++++ 2 files changed, 19 insertions(+)Kconfig +10
-0@@ -142,6 +142,16 @@ config SPL_STACK_R_ADDR Specify the address in SDRAM for the SPL stack. This will be set up before board_init_r() is called. +config SPL_STACK_R_MALLOC_SIMPLE_LEN + depends on SPL_STACK_R && SPL_MALLOC_SIMPLE + hex "Size of malloc_simple heap after switching to DRAM SPL stack" + default 0x100000 + help + Specify the amount of the stack to use as memory pool for + malloc_simple after switching the stack to DRAM. This may be set + to give board_init_r() a larger heap then the initial heap in + SRAM which is limited to SYS_MALLOC_F_LEN bytes. + config TPL bool depends on SPL && SUPPORT_TPLcommon/spl/spl.c +0
-0common/spl/spl.c ulong spl_relocate_stack_gd(void) · line 351
Quoted 5 lines
common/spl/spl.c +2
-0@@ -347,6 +347,15 @@ ulong spl_relocate_stack_gd(void)memcpy (new_gd, (void *)gd,sizeof (gd_t)); gd = new_gd; +#ifdef CONFIG_SPL_MALLOC_SIMPLE +if (CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN ) {Do you think we could do:
Quoted 4 lines
if (
IS_ENABLED(CONFIG_SPL_MALLOC_SIMPLE)&&CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN)to avoid the #ifdef?
AFAIK we cannot do that because CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN will not be defined if CONFIG_SPL_MALLOC_SIMPLE is not set, so then the c compiler will end up looking for a symbol called CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN and will not find it.
Quoted 8 lines
Quoted 8 lines
common/spl/spl.c +7
-0+ ptr -=CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN ; + gd->malloc_base = ptr; + gd->malloc_limit =CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN ; + gd->malloc_ptr = 0; + } +#endif +return ptr;
Quoted 8 lines
Quoted 5 lines
common/spl/spl.c +0
-1#else return 0 ; --2.4.3
I have to say I worry a little bit about combinatoric explosion with this series. But I can't immediately see a better way.
We could simply always relocate the heap when using malloc_simple and CONFIG_SPL_STACK_R is set, code wise this would mean dropping the CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN != 0 check, simplifying the code somewhat (and allowing us to switch to using if (IS_ENABLED(CONFIG_SPL_MALLOC_SIMPLE) instead #ifdef.
This will also half the number of memory layout variants we have in the SPL, thus reducing the combinatoric explosion.
Downsides are:
1) If someone sets CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN to 0 things will break. We can add text to the Kconfig help saying not to do that, which IMHO is a good enough fix for this
2) This forces all users who use both SPL_STACK_R and SPL_SYS_MALLOC_SIMPLE to also get their malloc_simple heap relocated, and I guess this may be undesirable in some cases, although I cannot think of one.
2. is the reason why I wrote this patch as it is written, I have already considered going the suggested route while writing the patch. I'm fine either way though, if you think that making heap reloc mandatory when using both SPL_STACK_R and SPL_SYS_MALLOC_SIMPLE that is fine with me.
Regards,
Hans
PATCH 5/7 sunxi: Simplify spl board_init_f function
In reply to Hans de Goedecrt0.S will both memset the bss sectioan and call board_init_r for us, so there is no need to do either ourselves.
--- arch/arm/cpu/armv7/sunxi/board.c | 5 ----- 1 file changed, 5 deletions(-)
arch/arm/cpu/armv7/sunxi/board.c +0 -5
@@ -198,11 +198,6 @@ void board_init_f(ulong dummy)i2c_init (CONFIG_SYS_I2C_SPEED ,CONFIG_SYS_I2C_SLAVE );#endif sunxi_board_init(); - -/* Clear the BSS. */ -memset (__bss_start,0 , __bss_end - __bss_start); - - board_init_r(NULL, 0); }#endif
Signature · 1 line
2.4.3
PATCH 5/7 sunxi: Simplify spl board_init_f function
Quoted 5 lines · Hans de Goede
crt0.Swill both memset the bss sectioan and callboard_init_rfor us,
so there is no need to do either ourselves.Signed-off-by Hans de Goede <[email protected]>
PATCH 6/7 sunxi: Enable CONFIG_SPL_STACK_R
In reply to Hans de GoedeSelect CONFIG_SPL_STACK_R for sunxi boards, this gives us much more room on the stack once we've the DRAM running.
Besides being a good change to have on itself, this also paves the way for switching to using malloc_simple in the SPL which cuts of close to 4KiB of the SPL size.
--- arch/arm/Kconfig | 1 + configs/A10-OLinuXino-Lime_defconfig | 1 + configs/A10s-OLinuXino-M_defconfig | 1 + configs/A13-OLinuXinoM_defconfig | 1 + configs/A13-OLinuXino_defconfig | 1 + configs/A20-OLinuXino-Lime2_defconfig | 1 + configs/A20-OLinuXino-Lime_defconfig | 1 + configs/A20-OLinuXino_MICRO_defconfig | 1 + configs/A20-Olimex-SOM-EVB_defconfig | 1 + configs/Ainol_AW1_defconfig | 1 + configs/Ampe_A76_defconfig | 1 + configs/Auxtek-T003_defconfig | 1 + configs/Auxtek-T004_defconfig | 1 + configs/Bananapi_defconfig | 1 + configs/Bananapro_defconfig | 1 + configs/CSQ_CS908_defconfig | 1 + configs/Chuwi_V7_CW0825_defconfig | 1 + configs/Colombus_defconfig | 1 + configs/Cubieboard2_defconfig | 1 + configs/Cubieboard_defconfig | 1 + configs/Cubietruck_defconfig | 1 + configs/Et_q8_v1_6_defconfig | 1 + configs/Hummingbird_A31_defconfig | 1 + configs/Hyundai_A7HD_defconfig | 1 + configs/Ippo_q8h_v1_2_a33_1024x600_defconfig | 1 + configs/Ippo_q8h_v1_2_defconfig | 1 + configs/Ippo_q8h_v5_defconfig | 1 + configs/Linksprite_pcDuino3_Nano_defconfig | 1 + configs/Linksprite_pcDuino3_defconfig | 1 + configs/Linksprite_pcDuino_defconfig | 1 + configs/MK808C_defconfig | 1 + configs/MSI_Primo73_defconfig | 1 + configs/MSI_Primo81_defconfig | 1 + configs/Marsboard_A10_defconfig | 1 + configs/Mele_A1000G_quad_defconfig | 1 + configs/Mele_A1000_defconfig | 1 + configs/Mele_I7_defconfig | 1 + configs/Mele_M3_defconfig | 1 + configs/Mele_M5_defconfig | 1 + configs/Mele_M9_defconfig | 1 + configs/Merrii_A80_Optimus_defconfig | 1 + configs/Mini-X_defconfig | 1 + configs/Orangepi_defconfig | 1 + configs/Orangepi_mini_defconfig | 1 + configs/Sinlinx_SinA33_defconfig | 1 + configs/TZX-Q8-713B7_defconfig | 1 + configs/UTOO_P66_defconfig | 1 + configs/Wexler_TAB7200_defconfig | 1 + configs/Wits_Pro_A20_DKT_defconfig | 1 + configs/Wobo_i5_defconfig | 1 + configs/Yones_Toptech_BD1078_defconfig | 1 + configs/ba10_tv_box_defconfig | 1 + configs/forfun_q88db_defconfig | 1 + configs/ga10h_v1_1_defconfig | 1 + configs/gt90h_v4_defconfig | 1 + configs/i12-tvbox_defconfig | 1 + configs/iNet_3F_defconfig | 1 + configs/iNet_3W_defconfig | 1 + configs/iNet_86VS_defconfig | 1 + configs/inet1_defconfig | 1 + configs/inet97fv2_defconfig | 1 + configs/inet98v_rev2_defconfig | 1 + configs/inet9f_rev03_defconfig | 1 + configs/jesurun_q5_defconfig | 1 + configs/mixtile_loftq_defconfig | 1 + configs/mk802_a10s_defconfig | 1 + configs/mk802_defconfig | 1 + configs/mk802ii_defconfig | 1 + configs/pov_protab2_ips9_defconfig | 1 + configs/q8_a13_tablet_defconfig | 1 + configs/r7-tv-dongle_defconfig | 1 + configs/sunxi_Gemei_G9_defconfig | 1 + include/configs/sunxi-common.h | 6 ++++++ 73 files changed, 78 insertions(+)
arch/arm/Kconfig +1 -0
@@ -518,6 +518,7 @@ config ARCH_SUNXI select DM_USB select OF_CONTROL select OF_SEPARATE + select SPL_STACK_R select USB select USB_STORAGE select USB_KEYBOARD
configs/A10-OLinuXino-Lime_defconfig +1 -0
@@ -13,3 +13,4 @@ CONFIG_SYS_EXTRA_OPTIONS="AXP209_POWER,SUNXI_EMAC,AHCI,SATAPWR=SUNXI_GPC(3)" # CONFIG_CMD_FLASH is not set # CONFIG_CMD_FPGA is not set CONFIG_USB_EHCI_HCD=y +CONFIG_SPL_STACK_R_ADDR=0x4fe00000
configs/A10s-OLinuXino-M_defconfig +1 -0
@@ -14,3 +14,4 @@ CONFIG_SYS_EXTRA_OPTIONS="AXP152_POWER,SUNXI_EMAC" # CONFIG_CMD_FLASH is not set # CONFIG_CMD_FPGA is not set CONFIG_USB_EHCI_HCD=y +CONFIG_SPL_STACK_R_ADDR=0x4fe00000
configs/A13-OLinuXinoM_defconfig +1 -0
@@ -18,3 +18,4 @@ CONFIG_SYS_EXTRA_OPTIONS="CONS_INDEX=2" # CONFIG_CMD_FLASH is not set # CONFIG_CMD_FPGA is not set CONFIG_USB_EHCI_HCD=y +CONFIG_SPL_STACK_R_ADDR=0x4fe00000
configs/A13-OLinuXino_defconfig +1 -0
@@ -19,3 +19,4 @@ CONFIG_SYS_EXTRA_OPTIONS="CONS_INDEX=2,AXP209_POWER" # CONFIG_CMD_FLASH is not set # CONFIG_CMD_FPGA is not set CONFIG_USB_EHCI_HCD=y +CONFIG_SPL_STACK_R_ADDR=0x4fe00000
configs/A20-OLinuXino-Lime2_defconfig +1 -0
@@ -14,3 +14,4 @@ CONFIG_SYS_EXTRA_OPTIONS="AXP209_POWER,SUNXI_GMAC,RGMII,AHCI,SATAPWR=SUNXI_GPC(3 # CONFIG_CMD_FPGA is not set CONFIG_ETH_DESIGNWARE=y CONFIG_USB_EHCI_HCD=y +CONFIG_SPL_STACK_R_ADDR=0x4fe00000
configs/A20-OLinuXino-Lime_defconfig +1 -0
@@ -12,3 +12,4 @@ CONFIG_SYS_EXTRA_OPTIONS="AXP209_POWER,SUNXI_GMAC,AHCI,SATAPWR=SUNXI_GPC(3)" # CONFIG_CMD_FPGA is not set CONFIG_ETH_DESIGNWARE=y CONFIG_USB_EHCI_HCD=y +CONFIG_SPL_STACK_R_ADDR=0x4fe00000
configs/A20-OLinuXino_MICRO_defconfig +1 -0
@@ -15,3 +15,4 @@ CONFIG_SYS_EXTRA_OPTIONS="AXP209_POWER,SUNXI_GMAC,AHCI,SATAPWR=SUNXI_GPB(8)" # CONFIG_CMD_FPGA is not set CONFIG_ETH_DESIGNWARE=y CONFIG_USB_EHCI_HCD=y +CONFIG_SPL_STACK_R_ADDR=0x4fe00000
configs/A20-Olimex-SOM-EVB_defconfig +1 -0
@@ -14,3 +14,4 @@ CONFIG_SYS_EXTRA_OPTIONS="AXP209_POWER,SUNXI_GMAC,RGMII,AHCI,SATAPWR=SUNXI_GPC(3 # CONFIG_CMD_FPGA is not set CONFIG_ETH_DESIGNWARE=y CONFIG_USB_EHCI_HCD=y +CONFIG_SPL_STACK_R_ADDR=0x4fe00000
configs/Ainol_AW1_defconfig +1 -0
@@ -19,3 +19,4 @@ CONFIG_SYS_EXTRA_OPTIONS="AXP209_POWER" # CONFIG_CMD_FLASH is not set # CONFIG_CMD_FPGA is not set CONFIG_USB_MUSB_HOST=y +CONFIG_SPL_STACK_R_ADDR=0x4fe00000
configs/Ampe_A76_defconfig +1 -0
@@ -20,3 +20,4 @@ CONFIG_SYS_EXTRA_OPTIONS="CONS_INDEX=2,AXP209_POWER" # CONFIG_CMD_FLASH is not set # CONFIG_CMD_FPGA is not set CONFIG_USB_MUSB_HOST=y +CONFIG_SPL_STACK_R_ADDR=0x4fe00000
configs/Auxtek-T003_defconfig +1 -0
@@ -13,3 +13,4 @@ CONFIG_SYS_EXTRA_OPTIONS="AXP152_POWER" # CONFIG_CMD_FLASH is not set # CONFIG_CMD_FPGA is not set CONFIG_USB_EHCI_HCD=y +CONFIG_SPL_STACK_R_ADDR=0x4fe00000
configs/Auxtek-T004_defconfig +1 -0
@@ -11,3 +11,4 @@ CONFIG_SYS_EXTRA_OPTIONS="AXP152_POWER" # CONFIG_CMD_FLASH is not set # CONFIG_CMD_FPGA is not set CONFIG_USB_EHCI_HCD=y +CONFIG_SPL_STACK_R_ADDR=0x4fe00000
configs/Bananapi_defconfig +1 -0
@@ -13,3 +13,4 @@ CONFIG_SYS_EXTRA_OPTIONS="AXP209_POWER,SUNXI_GMAC,RGMII,MACPWR=SUNXI_GPH(23),AHC # CONFIG_CMD_FPGA is not set CONFIG_ETH_DESIGNWARE=y CONFIG_USB_EHCI_HCD=y +CONFIG_SPL_STACK_R_ADDR=0x4fe00000
configs/Bananapro_defconfig +1 -0
@@ -15,3 +15,4 @@ CONFIG_SYS_EXTRA_OPTIONS="AXP209_POWER,SUNXI_GMAC,RGMII,MACPWR=SUNXI_GPH(23),AHC # CONFIG_CMD_FPGA is not set CONFIG_ETH_DESIGNWARE=y CONFIG_USB_EHCI_HCD=y +CONFIG_SPL_STACK_R_ADDR=0x4fe00000
configs/CSQ_CS908_defconfig +1 -0
@@ -16,3 +16,4 @@ CONFIG_AXP221_DLDO1_VOLT=3300 CONFIG_AXP221_ALDO1_VOLT=3300 CONFIG_USB_EHCI_HCD=y CONFIG_USB_MUSB_HOST=y +CONFIG_SPL_STACK_R_ADDR=0x4fe00000
configs/Chuwi_V7_CW0825_defconfig +1 -0
@@ -22,3 +22,4 @@ CONFIG_VIDEO_LCD_SPI_CS="PA0" CONFIG_VIDEO_LCD_SPI_SCLK="PA1" CONFIG_VIDEO_LCD_SPI_MOSI="PA2" CONFIG_USB_MUSB_HOST=y +CONFIG_SPL_STACK_R_ADDR=0x4fe00000
configs/Colombus_defconfig +1 -0
@@ -25,3 +25,4 @@ CONFIG_ETH_DESIGNWARE=y CONFIG_AXP221_ALDO1_VOLT=3300 CONFIG_AXP221_ELDO3_VOLT=1800 CONFIG_USB_EHCI_HCD=y +CONFIG_SPL_STACK_R_ADDR=0x4fe00000
configs/Cubieboard2_defconfig +1 -0
@@ -12,3 +12,4 @@ CONFIG_SYS_EXTRA_OPTIONS="AXP209_POWER,SUNXI_GMAC,AHCI,SATAPWR=SUNXI_GPB(8)" # CONFIG_CMD_FPGA is not set CONFIG_ETH_DESIGNWARE=y CONFIG_USB_EHCI_HCD=y +CONFIG_SPL_STACK_R_ADDR=0x4fe00000
configs/Cubieboard_defconfig +1 -0
@@ -11,3 +11,4 @@ CONFIG_SYS_EXTRA_OPTIONS="AXP209_POWER,SUNXI_EMAC,AHCI,SATAPWR=SUNXI_GPB(8)" # CONFIG_CMD_FLASH is not set # CONFIG_CMD_FPGA is not set CONFIG_USB_EHCI_HCD=y +CONFIG_SPL_STACK_R_ADDR=0x4fe00000
configs/Cubietruck_defconfig +1 -0
@@ -14,3 +14,4 @@ CONFIG_SYS_EXTRA_OPTIONS="AXP209_POWER,SUNXI_GMAC,RGMII,AHCI,SATAPWR=SUNXI_GPH(1 # CONFIG_CMD_FPGA is not set CONFIG_ETH_DESIGNWARE=y CONFIG_USB_EHCI_HCD=y +CONFIG_SPL_STACK_R_ADDR=0x4fe00000
configs/Et_q8_v1_6_defconfig +1 -0
@@ -21,3 +21,4 @@ CONFIG_SYS_EXTRA_OPTIONS="CONS_INDEX=5" CONFIG_AXP221_DLDO1_VOLT=3300 CONFIG_AXP221_ALDO1_VOLT=3000 CONFIG_USB_MUSB_HOST=y +CONFIG_SPL_STACK_R_ADDR=0x4fe00000
configs/Hummingbird_A31_defconfig +1 -0
@@ -16,3 +16,4 @@ CONFIG_SYS_EXTRA_OPTIONS="SUNXI_GMAC,RGMII,MACPWR=SUNXI_GPA(21)" CONFIG_ETH_DESIGNWARE=y CONFIG_AXP221_ALDO1_VOLT=3300 CONFIG_USB_EHCI_HCD=y +CONFIG_SPL_STACK_R_ADDR=0x4fe00000
configs/Hyundai_A7HD_defconfig +1 -0
@@ -20,3 +20,4 @@ CONFIG_SYS_EXTRA_OPTIONS="AXP209_POWER" # CONFIG_CMD_FLASH is not set # CONFIG_CMD_FPGA is not set CONFIG_USB_MUSB_HOST=y +CONFIG_SPL_STACK_R_ADDR=0x4fe00000
configs/Ippo_q8h_v1_2_a33_1024x600_defconfig +1 -0
@@ -22,3 +22,4 @@ CONFIG_SYS_EXTRA_OPTIONS="CONS_INDEX=5" CONFIG_AXP221_DLDO1_VOLT=3300 CONFIG_AXP221_ALDO1_VOLT=3000 CONFIG_USB_MUSB_HOST=y +CONFIG_SPL_STACK_R_ADDR=0x4fe00000
configs/Ippo_q8h_v1_2_defconfig +1 -0
@@ -22,3 +22,4 @@ CONFIG_SYS_EXTRA_OPTIONS="CONS_INDEX=5" CONFIG_AXP221_DLDO1_VOLT=3300 CONFIG_AXP221_ALDO1_VOLT=3000 CONFIG_USB_MUSB_HOST=y +CONFIG_SPL_STACK_R_ADDR=0x4fe00000
configs/Ippo_q8h_v5_defconfig +1 -0
@@ -22,3 +22,4 @@ CONFIG_SYS_EXTRA_OPTIONS="CONS_INDEX=5" CONFIG_AXP221_DLDO1_VOLT=3300 CONFIG_AXP221_ALDO1_VOLT=3000 CONFIG_USB_MUSB_HOST=y +CONFIG_SPL_STACK_R_ADDR=0x4fe00000
configs/Linksprite_pcDuino3_Nano_defconfig +1 -0
@@ -14,3 +14,4 @@ CONFIG_SYS_EXTRA_OPTIONS="AXP209_POWER,SUNXI_GMAC,RGMII,AHCI,SATAPWR=SUNXI_GPH(2 # CONFIG_CMD_FPGA is not set CONFIG_ETH_DESIGNWARE=y CONFIG_USB_EHCI_HCD=y +CONFIG_SPL_STACK_R_ADDR=0x4fe00000
configs/Linksprite_pcDuino3_defconfig +1 -0
@@ -12,3 +12,4 @@ CONFIG_SYS_EXTRA_OPTIONS="AXP209_POWER,SUNXI_GMAC,AHCI,SATAPWR=SUNXI_GPH(2)" # CONFIG_CMD_FPGA is not set CONFIG_ETH_DESIGNWARE=y CONFIG_USB_EHCI_HCD=y +CONFIG_SPL_STACK_R_ADDR=0x4fe00000
configs/Linksprite_pcDuino_defconfig +1 -0
@@ -10,3 +10,4 @@ CONFIG_SYS_EXTRA_OPTIONS="AXP209_POWER,SUNXI_EMAC" # CONFIG_CMD_FLASH is not set # CONFIG_CMD_FPGA is not set CONFIG_USB_EHCI_HCD=y +CONFIG_SPL_STACK_R_ADDR=0x4fe00000
configs/MK808C_defconfig +1 -0
@@ -10,3 +10,4 @@ CONFIG_SYS_EXTRA_OPTIONS="AXP209_POWER" # CONFIG_CMD_FLASH is not set # CONFIG_CMD_FPGA is not set CONFIG_USB_EHCI_HCD=y +CONFIG_SPL_STACK_R_ADDR=0x4fe00000
configs/MSI_Primo73_defconfig +1 -0
@@ -14,3 +14,4 @@ CONFIG_SYS_EXTRA_OPTIONS="AXP209_POWER" # CONFIG_CMD_IMLS is not set # CONFIG_CMD_FLASH is not set # CONFIG_CMD_FPGA is not set +CONFIG_SPL_STACK_R_ADDR=0x4fe00000
configs/MSI_Primo81_defconfig +1 -0
@@ -24,3 +24,4 @@ CONFIG_VIDEO_LCD_SPI_SCLK="PH10" CONFIG_VIDEO_LCD_SPI_MOSI="PH11" CONFIG_VIDEO_LCD_SPI_MISO="PH12" CONFIG_USB_MUSB_HOST=y +CONFIG_SPL_STACK_R_ADDR=0x4fe00000
configs/Marsboard_A10_defconfig +1 -0
@@ -9,3 +9,4 @@ CONFIG_SYS_EXTRA_OPTIONS="SUNXI_EMAC,AHCI" # CONFIG_CMD_FLASH is not set # CONFIG_CMD_FPGA is not set CONFIG_USB_EHCI_HCD=y +CONFIG_SPL_STACK_R_ADDR=0x4fe00000
configs/Mele_A1000G_quad_defconfig +1 -0
@@ -18,3 +18,4 @@ CONFIG_AXP221_DLDO4_VOLT=3300 CONFIG_AXP221_ALDO1_VOLT=3300 CONFIG_USB_EHCI_HCD=y CONFIG_USB_MUSB_HOST=y +CONFIG_SPL_STACK_R_ADDR=0x4fe00000
configs/Mele_A1000_defconfig +1 -0
@@ -11,3 +11,4 @@ CONFIG_SYS_EXTRA_OPTIONS="AXP209_POWER,SUNXI_EMAC,MACPWR=SUNXI_GPH(15),AHCI" # CONFIG_CMD_FLASH is not set # CONFIG_CMD_FPGA is not set CONFIG_USB_EHCI_HCD=y +CONFIG_SPL_STACK_R_ADDR=0x4fe00000
configs/Mele_I7_defconfig +1 -0
@@ -17,3 +17,4 @@ CONFIG_AXP221_DLDO1_VOLT=3300 CONFIG_AXP221_DLDO4_VOLT=3300 CONFIG_AXP221_ALDO1_VOLT=3300 CONFIG_USB_EHCI_HCD=y +CONFIG_SPL_STACK_R_ADDR=0x4fe00000
configs/Mele_M3_defconfig +1 -0
@@ -15,3 +15,4 @@ CONFIG_SYS_EXTRA_OPTIONS="AXP209_POWER,SUNXI_GMAC" # CONFIG_CMD_FPGA is not set CONFIG_ETH_DESIGNWARE=y CONFIG_USB_EHCI_HCD=y +CONFIG_SPL_STACK_R_ADDR=0x4fe00000
configs/Mele_M5_defconfig +1 -0
@@ -14,3 +14,4 @@ CONFIG_SYS_EXTRA_OPTIONS="SUNXI_GMAC,AHCI,STATUSLED=234" # CONFIG_CMD_FPGA is not set CONFIG_ETH_DESIGNWARE=y CONFIG_USB_EHCI_HCD=y +CONFIG_SPL_STACK_R_ADDR=0x4fe00000
configs/Mele_M9_defconfig +1 -0
@@ -17,3 +17,4 @@ CONFIG_AXP221_DLDO1_VOLT=3300 CONFIG_AXP221_DLDO4_VOLT=3300 CONFIG_AXP221_ALDO1_VOLT=3300 CONFIG_USB_EHCI_HCD=y +CONFIG_SPL_STACK_R_ADDR=0x4fe00000
configs/Merrii_A80_Optimus_defconfig +1 -0
@@ -11,3 +11,4 @@ CONFIG_DEFAULT_DEVICE_TREE="sun9i-a80-optimus" # CONFIG_CMD_IMLS is not set # CONFIG_CMD_FLASH is not set # CONFIG_CMD_FPGA is not set +CONFIG_SPL_STACK_R_ADDR=0x2fe00000
configs/Mini-X_defconfig +1 -0
@@ -12,3 +12,4 @@ CONFIG_SYS_EXTRA_OPTIONS="AXP209_POWER" # CONFIG_CMD_FPGA is not set CONFIG_USB_EHCI_HCD=y CONFIG_USB_MUSB_HOST=y +CONFIG_SPL_STACK_R_ADDR=0x4fe00000
configs/Orangepi_defconfig +1 -0
@@ -16,3 +16,4 @@ CONFIG_SYS_EXTRA_OPTIONS="AXP209_POWER,SUNXI_GMAC,RGMII,MACPWR=SUNXI_GPH(23),AHC # CONFIG_CMD_FPGA is not set CONFIG_ETH_DESIGNWARE=y CONFIG_USB_EHCI_HCD=y +CONFIG_SPL_STACK_R_ADDR=0x4fe00000
configs/Orangepi_mini_defconfig +1 -0
@@ -18,3 +18,4 @@ CONFIG_SYS_EXTRA_OPTIONS="AXP209_POWER,SUNXI_GMAC,RGMII,MACPWR=SUNXI_GPH(23),AHC # CONFIG_CMD_FPGA is not set CONFIG_ETH_DESIGNWARE=y CONFIG_USB_EHCI_HCD=y +CONFIG_SPL_STACK_R_ADDR=0x4fe00000
configs/Sinlinx_SinA33_defconfig +1 -0
@@ -10,3 +10,4 @@ CONFIG_SPL=y # CONFIG_CMD_FLASH is not set # CONFIG_CMD_FPGA is not set CONFIG_AXP221_ALDO1_VOLT=3000 +CONFIG_SPL_STACK_R_ADDR=0x4fe00000
configs/TZX-Q8-713B7_defconfig +1 -0
@@ -19,3 +19,4 @@ CONFIG_SYS_EXTRA_OPTIONS="CONS_INDEX=2,AXP209_POWER" # CONFIG_CMD_FLASH is not set # CONFIG_CMD_FPGA is not set CONFIG_USB_MUSB_HOST=y +CONFIG_SPL_STACK_R_ADDR=0x4fe00000
configs/UTOO_P66_defconfig +1 -0
@@ -26,3 +26,4 @@ CONFIG_SYS_EXTRA_OPTIONS="AXP209_POWER" # CONFIG_CMD_FPGA is not set # CONFIG_REQUIRE_SERIAL_CONSOLE is not set CONFIG_USB_MUSB_HOST=y +CONFIG_SPL_STACK_R_ADDR=0x4fe00000
configs/Wexler_TAB7200_defconfig +1 -0
@@ -19,3 +19,4 @@ CONFIG_SYS_EXTRA_OPTIONS="AXP209_POWER" # CONFIG_CMD_FLASH is not set # CONFIG_CMD_FPGA is not set CONFIG_USB_EHCI_HCD=y +CONFIG_SPL_STACK_R_ADDR=0x4fe00000
configs/Wits_Pro_A20_DKT_defconfig +1 -0
@@ -17,3 +17,4 @@ CONFIG_SYS_EXTRA_OPTIONS="AXP209_POWER,SUNXI_GMAC,RGMII,AHCI" # CONFIG_CMD_FPGA is not set CONFIG_ETH_DESIGNWARE=y CONFIG_USB_EHCI_HCD=y +CONFIG_SPL_STACK_R_ADDR=0x4fe00000
configs/Wobo_i5_defconfig +1 -0
@@ -12,3 +12,4 @@ CONFIG_SYS_EXTRA_OPTIONS="AXP209_POWER" # CONFIG_CMD_FLASH is not set # CONFIG_CMD_FPGA is not set CONFIG_USB_EHCI_HCD=y +CONFIG_SPL_STACK_R_ADDR=0x4fe00000
configs/Yones_Toptech_BD1078_defconfig +1 -0
@@ -24,3 +24,4 @@ CONFIG_SYS_EXTRA_OPTIONS="AXP209_POWER" # CONFIG_CMD_FLASH is not set # CONFIG_CMD_FPGA is not set CONFIG_USB_MUSB_HOST=y +CONFIG_SPL_STACK_R_ADDR=0x4fe00000
configs/ba10_tv_box_defconfig +1 -0
@@ -15,3 +15,4 @@ CONFIG_SYS_EXTRA_OPTIONS="AXP209_POWER,SUNXI_EMAC" # CONFIG_CMD_FPGA is not set CONFIG_USB_EHCI_HCD=y CONFIG_USB_MUSB_HOST=y +CONFIG_SPL_STACK_R_ADDR=0x4fe00000
configs/forfun_q88db_defconfig +1 -0
@@ -18,3 +18,4 @@ CONFIG_SYS_EXTRA_OPTIONS="CONS_INDEX=2,AXP209_POWER" # CONFIG_CMD_FLASH is not set # CONFIG_CMD_FPGA is not set CONFIG_USB_MUSB_HOST=y +CONFIG_SPL_STACK_R_ADDR=0x4fe00000
configs/ga10h_v1_1_defconfig +1 -0
@@ -25,3 +25,4 @@ CONFIG_AXP221_DLDO1_VOLT=3300 CONFIG_AXP221_ALDO1_VOLT=3000 CONFIG_USB_EHCI_HCD=y CONFIG_USB_MUSB_HOST=y +CONFIG_SPL_STACK_R_ADDR=0x4fe00000
configs/gt90h_v4_defconfig +1 -0
@@ -24,3 +24,4 @@ CONFIG_SYS_EXTRA_OPTIONS="CONS_INDEX=5" CONFIG_AXP221_DCDC2_VOLT=1100 CONFIG_AXP221_DLDO1_VOLT=3300 CONFIG_AXP221_ALDO1_VOLT=3000 +CONFIG_SPL_STACK_R_ADDR=0x4fe00000
configs/i12-tvbox_defconfig +1 -0
@@ -12,3 +12,4 @@ CONFIG_SYS_EXTRA_OPTIONS="AXP209_POWER,SUNXI_GMAC,MACPWR=SUNXI_GPH(21)" # CONFIG_CMD_FPGA is not set CONFIG_ETH_DESIGNWARE=y CONFIG_USB_EHCI_HCD=y +CONFIG_SPL_STACK_R_ADDR=0x4fe00000
configs/iNet_3F_defconfig +1 -0
@@ -19,3 +19,4 @@ CONFIG_SYS_EXTRA_OPTIONS="AXP209_POWER" # CONFIG_CMD_FLASH is not set # CONFIG_CMD_FPGA is not set CONFIG_USB_MUSB_HOST=y +CONFIG_SPL_STACK_R_ADDR=0x4fe00000
configs/iNet_3W_defconfig +1 -0
@@ -19,3 +19,4 @@ CONFIG_SYS_EXTRA_OPTIONS="AXP209_POWER" # CONFIG_CMD_FLASH is not set # CONFIG_CMD_FPGA is not set CONFIG_USB_MUSB_HOST=y +CONFIG_SPL_STACK_R_ADDR=0x4fe00000
configs/iNet_86VS_defconfig +1 -0
@@ -18,3 +18,4 @@ CONFIG_SYS_EXTRA_OPTIONS="AXP209_POWER" # CONFIG_CMD_FLASH is not set # CONFIG_CMD_FPGA is not set CONFIG_USB_MUSB_HOST=y +CONFIG_SPL_STACK_R_ADDR=0x4fe00000
configs/inet1_defconfig +1 -0
@@ -20,3 +20,4 @@ CONFIG_SYS_EXTRA_OPTIONS="AXP209_POWER" # CONFIG_CMD_FPGA is not set CONFIG_USB_EHCI_HCD=y CONFIG_USB_MUSB_HOST=y +CONFIG_SPL_STACK_R_ADDR=0x4fe00000
configs/inet97fv2_defconfig +1 -0
@@ -18,3 +18,4 @@ CONFIG_SYS_EXTRA_OPTIONS="AXP209_POWER" # CONFIG_CMD_IMLS is not set # CONFIG_CMD_FLASH is not set # CONFIG_CMD_FPGA is not set +CONFIG_SPL_STACK_R_ADDR=0x4fe00000
configs/inet98v_rev2_defconfig +1 -0
@@ -20,3 +20,4 @@ CONFIG_SYS_EXTRA_OPTIONS="CONS_INDEX=2,AXP209_POWER" # CONFIG_CMD_IMLS is not set # CONFIG_CMD_FLASH is not set # CONFIG_CMD_FPGA is not set +CONFIG_SPL_STACK_R_ADDR=0x4fe00000
configs/inet9f_rev03_defconfig +1 -0
@@ -18,3 +18,4 @@ CONFIG_SYS_EXTRA_OPTIONS="AXP209_POWER" # CONFIG_CMD_IMLS is not set # CONFIG_CMD_FLASH is not set # CONFIG_CMD_FPGA is not set +CONFIG_SPL_STACK_R_ADDR=0x4fe00000
configs/jesurun_q5_defconfig +1 -0
@@ -13,3 +13,4 @@ CONFIG_SYS_EXTRA_OPTIONS="AXP209_POWER,SUNXI_EMAC,MACPWR=SUNXI_GPH(19)" CONFIG_USB_EHCI_HCD=y CONFIG_USB_MUSB_HOST=y CONFIG_USB0_VBUS_PIN="PB9" +CONFIG_SPL_STACK_R_ADDR=0x4fe00000
configs/mixtile_loftq_defconfig +1 -0
@@ -15,3 +15,4 @@ CONFIG_SYS_EXTRA_OPTIONS="SUNXI_GMAC,RGMII,MACPWR=SUNXI_GPA(21)" CONFIG_ETH_DESIGNWARE=y CONFIG_AXP221_ALDO1_VOLT=3300 CONFIG_USB_EHCI_HCD=y +CONFIG_SPL_STACK_R_ADDR=0x4fe00000
configs/mk802_a10s_defconfig +1 -0
@@ -12,3 +12,4 @@ CONFIG_SYS_EXTRA_OPTIONS="AXP152_POWER" # CONFIG_CMD_FLASH is not set # CONFIG_CMD_FPGA is not set CONFIG_USB_EHCI_HCD=y +CONFIG_SPL_STACK_R_ADDR=0x4fe00000
configs/mk802_defconfig +1 -0
@@ -10,3 +10,4 @@ CONFIG_SYS_EXTRA_OPTIONS="USB_EHCI" # CONFIG_CMD_FLASH is not set # CONFIG_CMD_FPGA is not set CONFIG_USB_EHCI_HCD=y +CONFIG_SPL_STACK_R_ADDR=0x4fe00000
configs/mk802ii_defconfig +1 -0
@@ -9,3 +9,4 @@ CONFIG_SYS_EXTRA_OPTIONS="AXP209_POWER" # CONFIG_CMD_FLASH is not set # CONFIG_CMD_FPGA is not set CONFIG_USB_EHCI_HCD=y +CONFIG_SPL_STACK_R_ADDR=0x4fe00000
configs/pov_protab2_ips9_defconfig +1 -0
@@ -19,3 +19,4 @@ CONFIG_SYS_EXTRA_OPTIONS="AXP209_POWER" # CONFIG_CMD_FLASH is not set # CONFIG_CMD_FPGA is not set CONFIG_USB_MUSB_HOST=y +CONFIG_SPL_STACK_R_ADDR=0x4fe00000
configs/q8_a13_tablet_defconfig +1 -0
@@ -20,3 +20,4 @@ CONFIG_SYS_EXTRA_OPTIONS="CONS_INDEX=2,AXP209_POWER" # CONFIG_CMD_FLASH is not set # CONFIG_CMD_FPGA is not set CONFIG_USB_MUSB_HOST=y +CONFIG_SPL_STACK_R_ADDR=0x4fe00000
configs/r7-tv-dongle_defconfig +1 -0
@@ -11,3 +11,4 @@ CONFIG_SYS_EXTRA_OPTIONS="AXP152_POWER" # CONFIG_CMD_FLASH is not set # CONFIG_CMD_FPGA is not set CONFIG_USB_EHCI_HCD=y +CONFIG_SPL_STACK_R_ADDR=0x4fe00000
configs/sunxi_Gemei_G9_defconfig +1 -0
@@ -16,3 +16,4 @@ CONFIG_SYS_EXTRA_OPTIONS="AXP209_POWER" # CONFIG_CMD_FLASH is not set # CONFIG_CMD_FPGA is not set CONFIG_USB_EHCI_HCD=y +CONFIG_SPL_STACK_R_ADDR=0x4fe00000
include/configs/sunxi-common.h +6 -0
@@ -73,6 +73,9 @@#define CONFIG_SYS_LOAD_ADDR 0x22000000/* default load address */ #define CONFIG_SYS_TEXT_BASE 0x2a000000#define CONFIG_PRE_CON_BUF_ADDR 0x2f000000 +/* Note this is primarily set through Kconfig, we redefine it here so that +* we get warnings if the Kconfig value mismatches. */ +#define CONFIG_SPL_STACK_R_ADDR 0x2fe00000#define CONFIG_SYS_SPL_MALLOC_START 0x2ff00000#define CONFIG_SPL_BSS_START_ADDR 0x2ff80000#else
@@ -81,6 +84,9 @@#define CONFIG_SYS_LOAD_ADDR 0x42000000/* default load address */ #define CONFIG_SYS_TEXT_BASE 0x4a000000#define CONFIG_PRE_CON_BUF_ADDR 0x4f000000 +/* Note this is primarily set through Kconfig, we redefine it here so that +* we get warnings if the Kconfig value mismatches. */ +#define CONFIG_SPL_STACK_R_ADDR 0x4fe00000#define CONFIG_SYS_SPL_MALLOC_START 0x4ff00000#define CONFIG_SPL_BSS_START_ADDR 0x4ff80000#endif
Signature · 1 line
2.4.3
PATCH 6/7 sunxi: Enable CONFIG_SPL_STACK_R
Quoted 10 lines · Hans de Goede
index 7c1507b..6aa1bf2 100644
include/configs/sunxi-common.h +0
-0@@ -73,6 +73,9 @@#define CONFIG_SYS_LOAD_ADDR 0x22000000/* default load address */
#defineCONFIG_SYS_TEXT_BASE0x2a000000
#defineCONFIG_PRE_CON_BUF_ADDR0x2f000000
+/* Note this is primarily set throughKconfig, we redefine it here so that
+ * we get warnings if theKconfigvalue mismatches. */
Mismatches with what? Why can't we just use the Kconfig supplied value throughout?
If there is a piece of code somewhere which cannot use the Kconfig value for some reason and is therefore hardcoded then using BUILD_BUG_ON would be best IMHO. There should also be a comment next to the B_B_ON explaining why that code cannot use the Kconfig value.
Quoted 1 line
+#define
CONFIG_SPL_STACK_R_ADDR0x2fe00000
Ian.
PATCH 6/7 sunxi: Enable CONFIG_SPL_STACK_R
Hi,
Quoted 14 lines · Ian Campbell
Quoted 10 lines · Hans de Goede
index 7c1507b..6aa1bf2 100644
include/configs/sunxi-common.h +0
-0@@ -73,6 +73,9 @@#define CONFIG_SYS_LOAD_ADDR 0x22000000/* default load address */
#defineCONFIG_SYS_TEXT_BASE0x2a000000
#defineCONFIG_PRE_CON_BUF_ADDR0x2f000000
+/* Note this is primarily set throughKconfig, we redefine it here so that
+ * we get warnings if theKconfigvalue mismatches. */Mismatches with what? Why can't we just use the
Kconfigsupplied value throughout?
Mismatches with the value defined here in sunxi-common.h, sunxi-common.h lists all other spl memory addresses right in this block, making it possible to quickly see what goes there. If someone ever decides to tweak the layout, then they will likely forget the single value which is set in the defconfig-s, but they will (presumably) update the copy in sunxi-common.h, as that is sitting there right next to the others.
If this happens then the compiler will give a warning (for each C-file) that CONFIG_SPL_STACK_R_ADDR is being redefined.
So functionality wise this does nothing, leaving it out will result in an identical build. It is just there to help us poor humans to not forger to update the value in the defconfig files if we ever decide to tweak the SPL memory layout.
Regards,
Hans
PATCH 6/7 sunxi: Enable CONFIG_SPL_STACK_R
Quoted 31 lines · Hans de Goede
Hi,
Quoted 6 lines · Ian Campbell
include/configs/sunxi-common.h line 73
Quoted 5 lines · Hans de Goede
index 7c1507b..6aa1bf2 100644
include/configs/sunxi-common.h +0
-0@@ -73,6 +73,9 @@#define CONFIG_SYS_LOAD_ADDR 0x22000000/* default
Quoted 4 lines
Quoted 4 lines
load address */
#defineCONFIG_SYS_TEXT_BASE0x2a000000
#defineCONFIG_PRE_CON_BUF_ADDR0x2f000000
+/* Note this is primarily set throughKconfig, we redefine ithere so that
Quoted 3 lines
Quoted 1 line
+ * we get warnings if the
Kconfigvalue mismatches. */Mismatches with what? Why can't we just use the
Kconfigsuppliedvalue
Quoted 1 line
throughout?
Mismatches with the value defined here in
sunxi-common.h, sunxi-common.h
lists all other spl memory addresses right in this block, making it possible to quickly see what goes there. If someone ever decides to tweak
the layout, then they will likely forget the single value which is set
in the defconfig-s, but they will (presumably) update the copy insunxi-common.h, as that is sitting there right next to the others.
Quoted 8 lines
If this happens then the compiler will give a warning (for each C -file)
thatCONFIG_SPL_STACK_R_ADDRis being redefined.So functionality wise this does nothing, leaving it out will result in an identical build. It is just there to help us poor humans to not forger to update the value in the defconfig files if we ever decide to tweak the SPL memory layout.
Got it, in which case I would drop the "primarily" from the comment, since that suggests it is defined "secondarily" here, when really it is just for documentation (with a clever trick to stop the docs getting out of date).
Maybe even:
/* Note SPL_STACK_R_ADDR is set through Kconfig, we include it here
* since it needs to fit in with the other values. By also #defining it
* we get warnings if the Kconfig value mismatches. */
???
(And presumably this all gets less mad as more and more stuff moves to Kconfig...)
Ian.
PATCH 6/7 sunxi: Enable CONFIG_SPL_STACK_R
Hi,
Quoted 46 lines · Ian Campbell
Quoted 31 lines · Hans de Goede
Hi,
Quoted 6 lines · Ian Campbell
include/configs/sunxi-common.h line 73
Quoted 5 lines · Hans de Goede
index 7c1507b..6aa1bf2 100644
include/configs/sunxi-common.h +0
-0@@ -73,6 +73,9 @@#define CONFIG_SYS_LOAD_ADDR 0x22000000/* default
Quoted 4 lines
Quoted 4 lines
load address */
#define CONFIG_SYS_TEXT_BASE 0x2a000000 #define CONFIG_PRE_CON_BUF_ADDR 0x2f000000+/* Note this is primarily set through
Kconfig, we redefine ithere so that
Quoted 3 lines
Quoted 1 line
+ * we get warnings if the
Kconfigvalue mismatches. */Mismatches with what? Why can't we just use the
Kconfigsuppliedvalue
Quoted 1 line
throughout?
Mismatches with the value defined here in
sunxi-common.h, sunxi-common.h
lists all other spl memory addresses right in this block, making it possible to quickly see what goes there. If someone ever decides to tweak
the layout, then they will likely forget the single value which is set
in the defconfig-s, but they will (presumably) update the copy insunxi-common.h, as that is sitting there right next to the others.Quoted 8 lines
If this happens then the compiler will give a warning (for each C -file)
thatCONFIG_SPL_STACK_R_ADDRis being redefined.So functionality wise this does nothing, leaving it out will result in an identical build. It is just there to help us poor humans to not forger to update the value in the defconfig files if we ever decide to tweak the SPL memory layout.
Got it, in which case I would drop the "primarily" from the comment, since that suggests it is defined "secondarily" here, when really it is just for documentation (with a clever trick to stop the docs getting out of date).
Quoted 5 lines
Maybe even:
/* Note
SPL_STACK_R_ADDRis set throughKconfig, we include it here
* since it needs to fit in with the other values. By also #defining it
* we get warnings if theKconfigvalue mismatches. */
That works for me, I'll replace my comment with the one you've suggested.
Regards,
Hans
PATCH 6/7 sunxi: Enable CONFIG_SPL_STACK_R
Quoted 11 lines · Hans de Goede
Hi,
Quoted 5 lines · Ian Campbell
Maybe even:
/* Note
SPL_STACK_R_ADDRis set throughKconfig, we include it here
* since it needs to fit in with the other values. By also #defining it
* we get warnings if theKconfigvalue mismatches. */That works for me, I'll replace my comment with the one you've suggested.
That version: Acked-by: Ian Campbell <[email protected]>
PATCH 7/7 sunxi: Switch to using malloc_simple for the spl
In reply to Hans de Goedecommon/dlmalloc.c is quite big, both in .text and .data usage. E.g. for a Mele_M9 sun6i board build this reduces .text from 0x4214 to 0x3b94 bytes, and .data from 0x54c to 0x144 bytes.
--- arch/arm/Kconfig | 1 + include/configs/sunxi-common.h | 3 --- 2 files changed, 1 insertion(+), 3 deletions(-)
arch/arm/Kconfig +1 -0
@@ -518,6 +518,7 @@ config ARCH_SUNXI select DM_USB select OF_CONTROL select OF_SEPARATE + select SPL_MALLOC_SIMPLE select SPL_STACK_R select USB select USB_STORAGE
include/configs/sunxi-common.h +0 -3
@@ -76,7 +76,6 @@/* Note this is primarily set through Kconfig, we redefine it here so that * we get warnings if the Kconfig value mismatches. */ #define CONFIG_SPL_STACK_R_ADDR 0x2fe00000 -#define CONFIG_SYS_SPL_MALLOC_START 0x2ff00000#define CONFIG_SPL_BSS_START_ADDR 0x2ff80000#else #define SDRAM_OFFSET (x) 0x4##x
@@ -87,12 +86,10 @@/* Note this is primarily set through Kconfig, we redefine it here so that * we get warnings if the Kconfig value mismatches. */ #define CONFIG_SPL_STACK_R_ADDR 0x4fe00000 -#define CONFIG_SYS_SPL_MALLOC_START 0x4ff00000#define CONFIG_SPL_BSS_START_ADDR 0x4ff80000#endif #define CONFIG_SPL_BSS_MAX_SIZE 0x00080000/* 512 KiB */ -#define CONFIG_SYS_SPL_MALLOC_SIZE 0x00080000/* 512 KiB */ #ifdef CONFIG_MACH_SUN9I /*
Signature · 1 line
2.4.3
PATCH 7/7 sunxi: Switch to using malloc_simple for the spl
Quoted 7 lines · Hans de Goede
common/dlmalloc.cis quite big, both in .text and .data usage. E.g. for aMele_M9sun6i board build this reduces .text from0x4214to0x3b94bytes,
and .data from0x54cto0x144bytes.Signed-off-by Hans de Goede <[email protected]>