[U-Boot] eldk5.0 generate illegal instruction for at91rm9200

zzs zzs213 at 126.com
Fri Jul 15 18:15:31 CEST 2011


>
> > So what compiler options should be use? I notice some u-boot compile
> > commandline has option '-march=armv4'. Why with this option it is still
> > generate wrong code
>
> Thi sis a strong statement, based on somewhat weak facts.  Why are you
> so sure that there is any "wrong code" being generated?  Please show
> which exact instructions you are talking about.
>
Today I found the  "wrong code" :

in u-boot v2011.03

drivers/serial/at91rm9200_usart.c:68:
	us->US_BRGR = (AT91C_MASTER_CLOCK >> 4) / (unsigned)baudrate;

The correspond asm code :

2010c830:	d1a01003 	movle	r1, r3
2010c834:	eb001530 	bl	20111cfc <__udivsi3>
2010c838:	e5840020 	str	r0, [r4, #32]

and the __udivsi3 contain the  "wrong code" :

20111cfc <__udivsi3>:
20111cfc:	e2512001 	subs	r2, r1, #1	; 0x1
20111d00:	012fff1e 	bxeq	lr
20111d04:	3a000023 	bcc	20111d98 <__udivsi3+0x9c>
20111d08:	e1500001 	cmp	r0, r1
20111d0c:	9a00001a 	bls	20111d7c <__udivsi3+0x80>
20111d10:	e1110002 	tst	r1, r2
20111d14:	0a00001b 	beq	20111d88 <__udivsi3+0x8c>
20111d18:	e16f3f11 	clz	r3, r1         # ***this is the  "wrong code"
20111d1c:	e16f2f10 	clz	r2, r0
20111d20:	e0432002 	sub	r2, r3, r2

I search the 'clz' instruction in ARM's manual and it says:

Usage

   The CLZ instruction counts the number of leading zeroes in the value
   in Rm and returns the result in Rd. The result value is 32 if no bits
   are set in the source register, and zero if bit 31 is set.  Condition
   flags

   This instruction does not affect the flags.

Architectures

    This instruction is available in ARM architecture versions 5 and above.


But at91rm9200 is armv4.

Does this mean I can't use eldk5.0 for at91rm9200 ? If yes, How can I
use eldk4.2 to build the newest busybox? Because eldk4.2 can't build
busybox(with ubiattach enabled) due to it's too old kernel header
files(the error message had been sent to eldk list, but no response).

help me, please.

-- 
Best Regards,
zzs




More information about the U-Boot mailing list