ARM: keystone2: spl: Fix stack allocation with CONFIG_SYS_MALLOC_F_LEN
authorLokesh Vutla <lokeshvutla@ti.com>
Sat, 19 Sep 2015 09:30:17 +0000 (15:00 +0530)
committerTom Rini <trini@konsulko.com>
Thu, 22 Oct 2015 18:19:50 +0000 (14:19 -0400)
If CONFIG_SYS_MALLOC_F_LEN is enabled, the stack is moved down to the
specified size to make the malloc function available before relocation.
But on keystone platforms SYS_SPL_MALLOC is immediately preceding stack,
which is causing an overlap with this config enabled.
So leave a gap between malloc space and stack space.

Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
include/configs/ti_armv7_keystone2.h

index 58c98ce660c04ba15d3a9da76f0de99cb57220e2..acc686c033cc1cb06b421e097cec9b89caeb23fb 100644 (file)
 #define CONFIG_SYS_INIT_SP_ADDR                (CONFIG_SPL_TEXT_BASE - \
                                        GENERATED_GBL_DATA_SIZE)
 
+#ifdef CONFIG_SYS_MALLOC_F_LEN
+#define SPL_MALLOC_F_SIZE      CONFIG_SYS_MALLOC_F_LEN
+#else
+#define SPL_MALLOC_F_SIZE      0
+#endif
+
 /* SPL SPI Loader Configuration */
 #define CONFIG_SPL_PAD_TO              65536
 #define CONFIG_SPL_MAX_SIZE            (CONFIG_SPL_PAD_TO - 8)
@@ -44,6 +50,7 @@
 #define CONFIG_SPL_STACK_SIZE          (8 * 1024)
 #define CONFIG_SPL_STACK               (CONFIG_SYS_SPL_MALLOC_START + \
                                        CONFIG_SYS_SPL_MALLOC_SIZE + \
+                                       SPL_MALLOC_F_SIZE + \
                                        CONFIG_SPL_STACK_SIZE - 4)
 #define CONFIG_SPL_SPI_FLASH_SUPPORT
 #define CONFIG_SPL_SPI_SUPPORT