[U-Boot] [PATCH] ARM: zynq: Fix location of stack and malloc areas

Michal Simek michal.simek at xilinx.com
Mon Nov 23 16:41:29 CET 2015


The patch
"board_init: Change the logic to setup malloc_base"
(sha1: 9ac4fc82071ce346e3885118242ff45d22f69b82)
breaks SPL for Zynq because it puts early alloc area on the stack which
caused that stack was decreased by CONFIG_SYS_MALLOC_F_LEN (0x400)
and there was not enough space for regular stack.

This patch changes memory layout to better utilize the last 64k OCM
block.
0xffff0000 - 0xfff1000 - Full malloc space
0xffff1000 - 0xffff300 - Stack location
0xfffff300 - CONFIG_SYS_MALLOC_F_LEN - Early malloc space
0xfffffd00 - sizeof(GD) - GD
0xfffffe00 - 0xffffffff - SoC specific boot code

Signed-off-by: Michal Simek <michal.simek at xilinx.com>
---

 include/configs/zynq-common.h | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/include/configs/zynq-common.h b/include/configs/zynq-common.h
index d10f1ddacaf5..d6ff44fc2261 100644
--- a/include/configs/zynq-common.h
+++ b/include/configs/zynq-common.h
@@ -380,17 +380,17 @@
 /* The highest 64k OCM address */
 #define OCM_HIGH_ADDR	0xffff0000
 
-/* Just define any reasonable size */
-#define CONFIG_SPL_STACK_SIZE	0x1000
-
-/* SPL stack position - and stack goes down */
-#define CONFIG_SPL_STACK	(OCM_HIGH_ADDR + CONFIG_SPL_STACK_SIZE)
-
 /* On the top of OCM space */
-#define CONFIG_SYS_SPL_MALLOC_START	(CONFIG_SPL_STACK + \
-					 GENERATED_GBL_DATA_SIZE)
+#define CONFIG_SYS_SPL_MALLOC_START	OCM_HIGH_ADDR
 #define CONFIG_SYS_SPL_MALLOC_SIZE	0x1000
 
+/*
+ * SPL stack position - and stack goes down
+ * 0xfffffe00 is used for putting wfi loop.
+ * Set it up as limit for now.
+ */
+#define CONFIG_SPL_STACK	0xfffffe00
+
 /* BSS setup */
 #define CONFIG_SPL_BSS_START_ADDR	0x100000
 #define CONFIG_SPL_BSS_MAX_SIZE		0x100000
-- 
1.9.1



More information about the U-Boot mailing list