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

Woodruff, Richard r-woodruff2 at ti.com
Thu Jun 10 23:53:13 CEST 2004


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));




More information about the U-Boot mailing list