@@ -469,6 +469,13 @@ void board_init_r (gd_t *id, ulong dest_addr)
debug ("Now running in RAM - U-Boot at: %08lx\n", dest_addr);
+ /* Check if relocation was ok, dest_addr is the relocated _TEXT_BASE */
+ if ( ! ( _bss_start_ofs + dest_addr <= (ulong)&monitor_flash_len && (ulong)&monitor_flash_len < _bss_end_ofs + dest_addr) ) {
+ printf("(relocated) BSS is from %08lx to %08lx\n", _bss_start_ofs + dest_addr, _bss_end_ofs + dest_addr);
+ printf("&monitor_flash_len: %p\n", &monitor_flash_len);
+ puts("WARNING: relocation failed (&monitor_flash_len is outside reloctated BSS)!\n");
+ }
+
#ifdef CONFIG_LOGBUFFER
logbuff_init_ptrs ();
#endif
Relocation fails here using gcc 4.3.4 or gcc 4.5.1. So it seems to be a good idea to check this on startup and print a warning if it failed. If relocation proved to be correct for ARM, this commit could just be reverted or put inside #ifdef DEBUG. Signed-off-by: Alexander Holler <holler@ahsoftware.de> --- arch/arm/lib/board.c | 7 +++++++ 1 files changed, 7 insertions(+), 0 deletions(-)