Skip to contentSkip to conversation

how to run hello_world

U-Boot-Users Robin Getz 2 participants 2 messages Oct 8, 2004 – Oct 9, 2004

lore
Share & tools
lore

Robin Getz

author
#0 lore raw
Quoted 1 line · Wolfgang Denk

I thought the description on this page was pretty explicit...

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.

=> tftp 40000 /tftpboot/hello_world.bin
...
=> go 40004 This is another test.

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

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.

=> tftp 1000000 /tftpboot/hello_world
=> bootelf this is another test

fails, becuase U-boot trys to pass "this is another test" to bootelf, and it doesn't like it.

-Robin

#1 lore raw
Quoted 7 lines · In message <[email protected]> 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 \

Review

Quoted 3 lines

-Map hello_world.map \

(quoted diff) +0 -2
-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.

Quoted 1 line

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

Yes, it's a tolchain issue.

Quoted 3 lines

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

Signature · 3 lines
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."