[U-Boot-Users] necessary fix for ARM u-boot 1.1.1 and GCC3.4.0.

Hey all,
I just found that lib_arm/board.c:start_armboot()'s GCC3.4.0 generated code sequence breaks ARM u-boot's. I am using the GCC3.4.0 which CodeSourcery put out.
I have found what appears to be a fix. A compiler optimization barrier needs to be inserted after gd (AKA R8) is initialized. See the below snippit.
With out this barrier gd is calculated into a temporary register, and when the gd->bd is actually attempted an unitilized R8 is used causing a fatal abort.
Regards,
Richard W.
------------------------------------- void start_armboot (void) { DECLARE_GLOBAL_DATA_PTR;
ulong size; init_fnc_t **init_fnc_ptr; char *s; #if defined(CONFIG_VFD) unsigned long addr; #endif
/* Pointer is writable since we allocated a register for it */ gd = (gd_t*)(_armboot_start - CFG_MALLOC_LEN - sizeof(gd_t));
__asm__ __volatile__("": : :"memory");/* compiler please write out gd to R8 now before using again */
memset ((void*)gd, 0, sizeof (gd_t)); gd->bd = (bd_t*)((char*)gd - sizeof(bd_t)); memset (gd->bd, 0, sizeof (bd_t));

On Thu, Jun 10, 2004 at 04:53:13PM -0500, Woodruff, Richard wrote:
I just found that lib_arm/board.c:start_armboot()'s GCC3.4.0 generated code sequence breaks ARM u-boot's. I am using the GCC3.4.0 which CodeSourcery put out.
Hmm, that suggests that you have been able to compile it at all? I just tried current CVS with the crosstool-0.28-rc23 gcc and it breaks:
----------8<----------8<----------8<----------8<----------8<---------- arm-softfloat-linux-gnu-gcc -M -g -Os -fno-strict-aliasing -fno-common -ffixed-r8 -mshort-load-bytes -msoft-float -D__KERNEL__ -DTEXT_BASE=0xa1fe0000 -I/home/robert/work/u-boot-maintainance/include -msoft-float -fno-builtin -ffreestanding -nostdinc -isystem /ptx/opt/crosstool/arm-softfloat-linux-gnu/gcc-3.4.0-glibc-2.3.2/bin/../lib/gcc/arm-softfloat-linux-gnu/3.4.0/include -pipe -DCONFIG_ARM -D__ARM__ -mapcs-32 -march=armv5 -mtune=xscale -Wall -Wstrict-prototypes hello_world.c stubs.c > .depend cc1: error: invalid option `short-load-bytes' cc1: error: invalid option `short-load-bytes' make[1]: *** [.depend] Error 1 ----------8<----------8<----------8<----------8<----------8<----------
Robert

In message 71555548814716479478431542AA5F8ADF8BAC@dlee2k04.ent.ti.com you wrote:
I just found that lib_arm/board.c:start_armboot()'s GCC3.4.0 generated code sequence breaks ARM u-boot's. I am using the GCC3.4.0 which CodeSourcery put out.
I have found what appears to be a fix. A compiler optimization barrier needs to be inserted after gd (AKA R8) is initialized. See the below snippit.
With out this barrier gd is calculated into a temporary register, and when the gd->bd is actually attempted an unitilized R8 is used causing a fatal abort.
Looks like a compiler bug to me. Anyway. Added. Thanks.
Best regards,
Wolfgang Denk
participants (3)
-
Robert Schwebel
-
Wolfgang Denk
-
Woodruff, Richard