public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Wolfgang Denk <wd@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot-Users] Re: how to run hello_world
Date: Sat, 09 Oct 2004 15:50:09 +0200	[thread overview]
Message-ID: <20041009135015.07066C1430@atlas.denx.de> (raw)
In-Reply-To: Your message of "Fri, 08 Oct 2004 16:01:39 PDT." <6.1.1.1.0.20041008155338.01e26910@wheresmymailserver.com>

In message <6.1.1.1.0.20041008155338.01e26910@wheresmymailserver.com> you wrote:
> 
> The only think I don't see (and have been looking for a standalone app that 
> I am writing, is the difference between load address and entry address.
> 
> In the hello_world.c application, it's configured to run at address 
> 0x00040004, but the load address is 0x00040000 - why in this case is there 
> a 4 byte difference.

If you create a linker map and have a look at  it  things  might  get
clearer; try for example:

bash$ ${CROSS_COMPILE}ld -g  -Ttext 0x40000 \
>  -Map hello_world.map \
> -o hello_world -e hello_world hello_world.o libstubs.a \
> -L/opt/eldk/3.0/usr/bin/../lib/gcc-lib/ppc-linux/3.2.2/m603 -lgcc

and then have a look at "hello_world.map":

...
     86  .text          0x00040000       0xd4 hello_world.o
     87                 0x00040004                hello_world
     88  .text          0x000400d4      0x154 libstubs.a(stubs.o)
...

As you can see, the code of hello_world() starts at 0x00040004.

Then check the assembler code generated for hello_world.c:

...
     55         .section        ".text"
     56         .align 2
     57         .globl hello_world
     58 .LCL0:
     59         .long .LCTOC1-.LCF0
     60         .type   hello_world, at function
     61 hello_world:
...

As you can see, GCC places a ".long"  immediately  in  front  of  the
hello_world() function.

> I assume that this is a toolchain issue, and may be offtopic for this list.

Yes, it's a tolchain issue.

> A slightly different issue - I know that you can load up an elf image as a 
> standalone app as well, but I don't seem to be able to pass it any command 
> line args.

Loading standalone programs using  the  "bootelf"  comand  was  never
tested  by  me.  It  is  easily  possible that there are bugs or even
conceptual problems on that way. Please use the simpler & faster "go"
instead.

Best regards,

Wolfgang Denk

-- 
Software Engineering:  Embedded and Realtime Systems,  Embedded Linux
Phone: (+49)-8142-4596-87  Fax: (+49)-8142-4596-88  Email: wd at denx.de
"One planet is all you get."

  reply	other threads:[~2004-10-09 13:50 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-10-08 23:01 [U-Boot-Users] Re: how to run hello_world Robin Getz
2004-10-09 13:50 ` Wolfgang Denk [this message]
  -- strict thread matches above, loose matches on Subject: below --
2004-10-08 14:22 Smith, Craig
2004-10-08 13:21 Farrukh Masood
2004-10-08 15:06 ` T Michael Turney
2004-10-08 18:11 ` 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=20041009135015.07066C1430@atlas.denx.de \
    --to=wd@denx.de \
    --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