[U-Boot-Users] [Patch 05/17 Try 2] U-Boot-V2:ARM: Introduce capability tohavedifferent stack/malloc area

Menon, Nishanth x0nishan at ti.com
Wed Jun 4 07:04:51 CEST 2008


Sascha,
> -----Original Message-----
> From: Sascha Hauer [mailto:s.hauer at pengutronix.de]
> Sent: Tuesday, June 03, 2008 10:24 AM
> To: Menon, Nishanth
> Cc: u-boot-users at lists.sourceforge.net; Laurent Desnogues; dirk.behme at googlemail.com;
> philip.balister at gmail.com; Gopinath, Thara; Kamat, Nishant; Syed Mohammed, Khasim
> Subject: Re: [Patch 05/17] U-Boot-V2:ARM: Introduce capability tohavedifferent stack/malloc area
>
> > Instead of modifying this for one architecture I would prefer something
> > like this (currently no implementation, only kconfig).
> > Would this solve your issues?

Modification only done for ARM.

Signed-off-by: Nishanth Menon<x0nishan at ti.com>

---
 arch/arm/cpu/start-arm.S |   27 +++++++++++++++++++-
 arch/arm/lib/arm.c       |   16 ++++++++++--
 common/Kconfig           |   61 +++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 100 insertions(+), 4 deletions(-)

Index: u-boot.v2/arch/arm/lib/arm.c
===================================================================
--- u-boot.v2.orig/arch/arm/lib/arm.c   2008-06-03 20:56:27.000000000 -0500
+++ u-boot.v2/arch/arm/lib/arm.c        2008-06-03 20:56:46.000000000 -0500
@@ -4,10 +4,22 @@
 #include <asm/u-boot-arm.h>
 #include <reloc.h>

+#ifdef CONFIG_MALLOC_BASE
+#define ARM_MALLOC_START CONFIG_MALLOC_BASE
+#else
+#define ARM_MALLOC_START _u_boot_start
+#endif
+
+#ifdef CONFIG_MALLOC_SIZE
+#define ARM_MALLOC_SIZE CONFIG_MALLOC_SIZE
+#else
+#define ARM_MALLOC_SIZE CFG_MALLOC_LEN
+#endif
+
 int arm_mem_malloc_init(void)
 {
-       mem_malloc_init((void *)(_u_boot_start - CFG_MALLOC_LEN),
-                       (void *)_u_boot_start);
+       mem_malloc_init((void *)(ARM_MALLOC_START - ARM_MALLOC_SIZE),
+                       (void *)ARM_MALLOC_START);
        return 0;
 }

Index: u-boot.v2/arch/arm/cpu/start-arm.S
===================================================================
--- u-boot.v2.orig/arch/arm/cpu/start-arm.S     2008-06-03 20:56:40.000000000 -0500
+++ u-boot.v2/arch/arm/cpu/start-arm.S  2008-06-03 21:08:04.000000000 -0500
@@ -90,11 +90,34 @@
  * FIXME
  *************************************************************************/

+#ifdef CONFIG_MALLOC_BASE
+#define ARM_MALLOC_START CONFIG_MALLOC_BASE
+#else
+#define ARM_MALLOC_START _start
+#endif
+
+#ifdef CONFIG_MALLOC_SIZE
+#define ARM_MALLOC_SIZE CONFIG_MALLOC_SIZE
+#else
+#define ARM_MALLOC_SIZE CFG_MALLOC_LEN
+#endif
 _MALLOC_START:
-       .word _start - CFG_MALLOC_LEN
+       .word ARM_MALLOC_START - ARM_MALLOC_SIZE

+#ifdef CONFIG_STACK_BASE
+#define ARM_STACK_START CONFIG_STACK_BASE
+#else
+#define ARM_STACK_START (ARM_MALLOC_START - ARM_MALLOC_SIZE)
+#endif
+
+#ifdef CONFIG_STACK_SIZE
+#define ARM_STACK_SIZE CONFIG_STACK_SIZE
+#else
+#define ARM_STACK_SIZE CFG_STACK_LEN
+#endif
 _STACK_START:
-       .word _start - CFG_MALLOC_LEN - CONFIG_STACKSIZE
+       .word ARM_STACK_START - CONFIG_STACKSIZE
+

 /*
  * These are defined in the board-specific linker script.
Index: u-boot.v2/common/Kconfig
===================================================================
--- u-boot.v2.orig/common/Kconfig       2008-06-03 20:56:40.000000000 -0500
+++ u-boot.v2/common/Kconfig    2008-06-03 21:08:37.000000000 -0500
@@ -19,13 +19,74 @@
 config BOARDINFO
        string

+menu "memory layout                 "
+
+config HAVE_CONFIGURABLE_TEXT_BASE
+       bool
+
 config TEXT_BASE
+       depends on HAVE_CONFIGURABLE_TEXT_BASE
        prompt "TEXT_BASE"
        hex
        default ARCH_TEXT_BASE
        help
          The Address U-Boot gets linked at.

+config HAVE_CONFIGURABLE_STACK
+       bool
+choice
+       prompt "select stack base policy"
+       depends on HAVE_CONFIGURABLE_STACK
+       default STACK_BASE_FIXED
+
+config STACK_BASE_DEFAULT
+       bool "place stack before malloc space"
+
+config STACK_BASE_FIXED
+       bool "manually assign a stack base"
+
+endchoice
+
+config STACK_BASE
+       depends on STACK_BASE_FIXED
+       hex
+       prompt "STACK_BASE"
+
+config STACK_SIZE
+       hex
+       depends on HAVE_CONFIGURABLE_STACK
+       default 0x8000
+       prompt "Stack size"
+
+config HAVE_CONFIGURABLE_MALLOC
+       bool
+
+choice
+       prompt "select malloc base policy"
+       depends on HAVE_CONFIGURABLE_MALLOC
+
+config MALLOC_BASE_DEFAULT
+       bool
+       prompt "place malloc before U-Boot"
+
+config MALLOC_BASE_FIXED
+       bool
+       prompt "manually assign a malloc base"
+
+endchoice
+
+config MALLOC_BASE
+       depends on MALLOC_BASE_FIXED
+       hex
+       prompt "MALLOC_BASE"
+
+config MALLOC_SIZE
+       hex
+       depends on HAVE_CONFIGURABLE_MALLOC
+       default 0x400000
+       prompt "malloc area size"
+endmenu
+
 config BROKEN
        bool
        prompt "Prompt for broken or incomplete code"




More information about the U-Boot mailing list