[PATCH 07/22] microblaze: Fix early stack allocation

Michal Simek monstr at monstr.eu
Thu Jun 2 15:57:31 CEST 2022


CONFIG_SYS_INIT_SP_OFFSET macro place stack to TEXT_BASE - SYS_MALLOC_F_LEN
but there is no reason to do it now because board_init_f_alloc_reserve()
returns exact location where stack should be. That's why stack location is
calculated at run time and there is no need to hardcode it via macro. This
change will help with placing U-Boot to any address.

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

 arch/microblaze/cpu/start.S          | 2 +-
 include/configs/microblaze-generic.h | 4 ----
 2 files changed, 1 insertion(+), 5 deletions(-)

diff --git a/arch/microblaze/cpu/start.S b/arch/microblaze/cpu/start.S
index 715ef37b39d9..1acac5faf428 100644
--- a/arch/microblaze/cpu/start.S
+++ b/arch/microblaze/cpu/start.S
@@ -22,7 +22,7 @@ _start:
 #if defined(CONFIG_SPL_BUILD)
 	addi	r1, r0, CONFIG_SPL_STACK_ADDR
 #else
-	addi	r1, r0, CONFIG_SYS_INIT_SP_OFFSET
+	add	r1, r0, r8
 #endif
 
 	addi	r1, r1, -4	/* Decrement SP to top of memory */
diff --git a/include/configs/microblaze-generic.h b/include/configs/microblaze-generic.h
index 663837f33dc4..60ceb2c817e9 100644
--- a/include/configs/microblaze-generic.h
+++ b/include/configs/microblaze-generic.h
@@ -18,10 +18,6 @@
 # define CONFIG_SYS_BAUDRATE_TABLE \
 	{300, 600, 1200, 2400, 4800, 9600, 19200, 38400, 57600, 115200, 230400}
 
-/* Stack location before relocation */
-#define CONFIG_SYS_INIT_SP_OFFSET	(CONFIG_SYS_TEXT_BASE - \
-					 CONFIG_SYS_MALLOC_F_LEN)
-
 #ifdef CONFIG_CFI_FLASH
 /* ?empty sector */
 # define CONFIG_SYS_FLASH_EMPTY_INFO	1
-- 
2.36.0



More information about the U-Boot mailing list