public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: zzs <zzs213@126.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] eldk5.0 generate illegal instruction for at91rm9200
Date: Sat, 16 Jul 2011 00:15:31 +0800	[thread overview]
Message-ID: <20110715161531.GA5221@greatfirst.com> (raw)
In-Reply-To: <20110713105743.0C2C116F12CE@gemini.denx.de>

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

  parent reply	other threads:[~2011-07-15 16:15 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-13  6:13 [U-Boot] at91rm9200 undef runtime error with eldk 5.0 zzs
2011-07-13  8:40 ` Wolfgang Denk
2011-07-13 10:46   ` zzs
2011-07-13 10:57     ` Wolfgang Denk
2011-07-13 11:20       ` zzs
2011-07-15 16:15       ` zzs [this message]
2011-07-15 17:22         ` [U-Boot] eldk5.0 generate illegal instruction for at91rm9200 Wolfgang Denk
2011-07-15 18:00         ` Wolfgang Denk
2011-07-16  8:05           ` zzs
2011-07-16  8:30             ` Andreas Bießmann
2011-07-16  8:33             ` Wolfgang Denk
2011-07-16  8:10           ` Albert ARIBAUD
2011-07-16  8:34             ` Wolfgang Denk

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20110715161531.GA5221@greatfirst.com \
    --to=zzs213@126.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox