[U-Boot] [PATCH] arm/bootstage: Move the bootstage call after gd init

Vikram Narayanan vikram186 at gmail.com
Sun Dec 23 12:27:24 CET 2012


bootstage_mark_name calls timer_get_boot_us which inturn calls
the arch timer. The arch timer uses the gd pointer to save the
lastinc count. A call to bootstage_mark_name here results in a
data abort as gd is uninitialized.

Signed-off-by: Vikram Narayanan <vikram186 at gmail.com>
Cc: Simon Glass <sjg at chromium.org>
Cc: Wolfgang Denk <wd at denx.de>
Cc: Albert Aribaud <albert.u.boot at aribaud.net>
---
Though it is true that there are currently no users for this
feature, it isn't good to see an abort when someone tries to
use BOOTSTAGE. I was bugged by this error when trying to 
use this feature on i.Mx6Q based board.

 arch/arm/lib/board.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/arm/lib/board.c b/arch/arm/lib/board.c
index e0cb635..2f09ab9 100644
--- a/arch/arm/lib/board.c
+++ b/arch/arm/lib/board.c
@@ -277,13 +277,13 @@ void board_init_f(ulong bootflag)
 	void *new_fdt = NULL;
 	size_t fdt_size = 0;
 
-	bootstage_mark_name(BOOTSTAGE_ID_START_UBOOT_F, "board_init_f");
-
 	/* Pointer is writable since we allocated a register for it */
 	gd = (gd_t *) ((CONFIG_SYS_INIT_SP_ADDR) & ~0x07);
 	/* compiler optimization barrier needed for GCC >= 3.4 */
 	__asm__ __volatile__("": : :"memory");
 
+	bootstage_mark_name(BOOTSTAGE_ID_START_UBOOT_F, "board_init_f");
+
 	memset((void *)gd, 0, sizeof(gd_t));
 
 	gd->mon_len = _bss_end_ofs;
-- 
1.7.4.1



More information about the U-Boot mailing list