public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Albert ARIBAUD <albert.aribaud@free.fr>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 2/2] [NEXT] arm926ejs: reduce code size with -msingle-pic-base
Date: Thu, 23 Sep 2010 23:30:56 +0200	[thread overview]
Message-ID: <4C9BC710.7040502@free.fr> (raw)
In-Reply-To: <AANLkTin1qG2QD5cWohv5FC-W5OfgMcXDNbT_6UT-JJ6i@mail.gmail.com>

Le 23/09/2010 23:13, Ben Gardiner a ?crit :

> On Thu, Sep 23, 2010 at 1:04 PM, Albert ARIBAUD<albert.aribaud@free.fr>  wrote:
>> Note that if I'm not mistaken, your build uses r9 as the pic base, not 10 --
>> this is a possibility, and my patches are written so as to allow either
>> register use.
>
> I don't know for sure so I did a little poking around:
>
> c1080688<board_init_f>:
> c1080688:       e59fa118        ldr     sl, [pc, #280]  ; c10807a8
> <board_init_f+0x120>
> c108068c:       e59f8118        ldr     r8, [pc, #280]  ; c10807ac
> <board_init_f+0x124>
>
> (gdb) info registers
> [...]
> r9             0xc1098564       3238626660
> r10            0xc1098564       3238626660
> [...]
> pc             0xc1080688       0xc1080688<board_init_f>
> [...]
> (gdb) ni
> 514             gd = (gd_t *) (CONFIG_SYS_INIT_SP_ADDR);
> (gdb) info registers
> [...]
> r9             0xc1098564       3238626660
> r10            0x17ecc  97996
> [...]
> pc             0xc108068c       0xc108068c<board_init_f+4>
> [...]
> (gdb) p /x $sl
> $1 = 0x17ecc
> (gdb) p /x $r10
> $2 = 0x17ecc
> (gdb) p /x $r9
> $3 = 0xc1098564
> (gdb) p *0xc10807a8
> $4 = 97996
> (gdb) p /x *0xc10807a8
> $5 = 0x17ecc
>
> I think that confirms that sl == r10 .

Watch out: 'sl' is always 'r10': those are alias names of the register; 
I specify both names because depending on the tool you use, you might 
see either name. But the pic base, i.e. the register which holds the 
address of the GOT, is not necessarily sl! It can can be r10 *or* r9, 
depending on the toolchain and options.

Here your excepts show that r9 remains constant (and, I suspect, its 
value is the address of the symbol __got_base) while r10 varies; r9 is 
the pic base. Which is lucky because r10 is trashed by the loop that 
goes through init_sequence and runs each of the functions it points to.

> There is no arch_cpu_init or board_early_init_f; timer_init is at
> 0xc1091e6c. So it is timer_init which is being called above.
>
> The call to timer_init completes successfully; the next function
> pointer dereferenced and called is 0xc1087e04 == env_init. That call
> completes successfully. The next is 0xc10804f8 == init_baudrate; it
> completes successfully. The next call is 0xc108119c == serial_init; it
> completes successfully. The next is 0xc1086550 == console_init_f; it
> completes successfully. The next is 0xc10804d0 == display_banner;  it
> completes successfully. They all did.

Ok, so all this goes fine, yet you do not see the banner displayed?

> Execution reaches the call to
> relocate_code and enters; the last instruction I am able to
> single-step is the 'ldr     r10, _got_base' in the following lines
> from your patch:

What happens when you single-step through it? Any kind of error message, 
or does the target simply not respond any more?

>> Thanks again for your help in testing my patches!
>
> My pleasure. I hope we can get them working on the da850evm.

We certainly will. For me to reproduce your SW setting and build exactly 
the same binary as you do, can you confirm that you are again using the 
2009q1 toolchain, and indicate the exact command line you use to build 
your target?

Amicalement,
-- 
Albert.

  reply	other threads:[~2010-09-23 21:30 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-09-22 13:57 [U-Boot] [PATCH 1/2] [NEXT] arm: change relocation flag from -fPIC to -fPIE Albert Aribaud
2010-09-22 13:57 ` [U-Boot] [PATCH 2/2] [NEXT] arm926ejs: reduce code size with -msingle-pic-base Albert Aribaud
2010-09-22 18:05   ` Ben Gardiner
2010-09-22 19:07     ` Albert ARIBAUD
2010-09-22 20:51       ` Ben Gardiner
2010-09-22 21:36         ` Albert ARIBAUD
2010-09-22 22:07           ` Albert ARIBAUD
2010-09-23 14:44           ` Ben Gardiner
2010-09-23 15:13             ` Albert ARIBAUD
2010-09-23 15:35               ` Ben Gardiner
2010-09-23 16:53             ` Ben Gardiner
2010-09-23 16:37       ` Ben Gardiner
2010-09-23 17:04         ` Albert ARIBAUD
2010-09-23 21:13           ` Ben Gardiner
2010-09-23 21:30             ` Albert ARIBAUD [this message]
2010-09-24 13:38               ` Ben Gardiner
2010-09-24 16:08                 ` Albert ARIBAUD
2010-09-22 20:30     ` Wolfgang Denk
2010-09-22 20:55       ` Ben Gardiner
2010-09-22 21:11         ` Wolfgang Denk
2010-09-22 21:33           ` Ben Gardiner
2010-09-23  7:12   ` Heiko Schocher
2010-09-23  8:05     ` Albert ARIBAUD
2010-09-23 10:08       ` Heiko Schocher
2010-09-23 12:45         ` Albert ARIBAUD
2010-09-24  5:11           ` Heiko Schocher
2010-09-24  5:47             ` Albert ARIBAUD
2010-09-24 16:45               ` Rogan Dawes
2010-09-24 16:58                 ` Rogan Dawes
2010-09-24 17:13                   ` Albert ARIBAUD
2010-09-22 18:05 ` [U-Boot] [PATCH 1/2] [NEXT] arm: change relocation flag from -fPIC to -fPIE Ben Gardiner

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=4C9BC710.7040502@free.fr \
    --to=albert.aribaud@free.fr \
    --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