U-Boot example "hello_world.srec" doesn't work?

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

U-Boot example "hello_world.srec" doesn't work?

5,668 Views
RSmith
Contributor I

Hello All 

Hoping somebody can help me out here. This was suppose to have been something simple and easy.  U-Boot has an example folder and a hello_world.c as a standalone application that gets compile as part of the U-Boot build and converted into a bin and srec file. 

The U-Boot doc's said it should be as simple as issuing a "loads" and "go" command because the srec should have encoded the start and end address and entry point.  

http://www.denx.de/wiki/DULG/UBootStandalone

So all I should have to do download it over serial read off the start address and type go with that address(-4)?..

Anyway it didn't work, quick look at the build and there is a text offset on the compiler line 

-DTEXT_BASE=0xXXXXXXXX

and another offset on the linker line

arm-none-linux-gnueabi-ld -g  -Ttext 0xYYYYYYYY.

 

Using these offsets actually allow the "loads"  command to complete but it still fails to run with a go command. 

 

Has anybody ran this demo and got it to work. Could you post a cut and past of the commands from the U-Boot prompt. 

 

Thanks. 

 

 

Labels (1)
0 Kudos
Reply
8 Replies

2,610 Views
vijaykishore
Contributor III

Hi, hope this is already resolved. But here is the clear explanation if it is not resolved.

  • Compile the hello_world.c file along with U-Boot and hello_world.bin is generated.
  • Copy this to tftpboot directory.
  • Get the STANDALONE_LOADADDR for the particular architecture which is specified in the path: /U-Boot/arch/<particular_architecture>/config.mk file.
  • nm -n /U-Boot/examples/standalone/hello_world - to know the address to which we have to give go - command.
  • Give tftp <load_addr> hello_world.bin
  • go <adrs_of_function_to_execute>
0 Kudos
Reply

2,610 Views
RSmith
Contributor I

Thanks Ed  

So you have confirmed that Freescale not testing this demo when they port U-Boot to different platforms. (I'm on an ARD DDR3 board) I'll go back an try your suggestions shortly. (Freescale does a lot of good stuff, just wish they would have verified this on the boards before moving on to the Linux stuff.)

Rx. 


Ed Sutter said:

Just to add to my own self-induced confusion, it appears that either 0x77800000 or 0x77c00000 works.

This confuses me because it appears that u-boot is loaded at 0x77800000, which would seem to indicate that loading hello_world at that same location would corrupt the running u-boot image, but it doesn't seem to cause any problem.  I guess u-boot must relocate or something. 

0 Kudos
Reply

2,610 Views
RSmith
Contributor I

It was the loads command it loads an s-record over the serial port for U-Boot to run via the go command. 


H R Krishna Pavan said:

Hi RSmith

Is that loads or loadm command?

Can you please tell me?

0 Kudos
Reply

2,610 Views
EdSutter
Senior Contributor II

Just to add to my own self-induced confusion, it appears that either 0x77800000 or 0x77c00000 works.

This confuses me because it appears that u-boot is loaded at 0x77800000, which would seem to indicate that loading hello_world at that same location would corrupt the running u-boot image, but it doesn't seem to cause any problem.  I guess u-boot must relocate or something. 

0 Kudos
Reply

2,610 Views
EdSutter
Senior Contributor II

Oops!!! Use 0x77c00000, not 0x77800000.

Ed Sutter said:

It appears to me that the load address of the hello-world app is not set correctly.

Looking at a dump of the hello_world ELF file shows me that the base address is 0x1c00000.

I then found that the makefile in that directory doesn't support the specifics of the imxQSB, so it defaults to that base address.  I think all you need to do is modify examples/standalone/Makefile.  The quick change is to set LOAD_ADDR to 0x77800000.  I was then able to use tftpboot to launch hello_world successfully.

HTH

Ed

0 Kudos
Reply

2,610 Views
EdSutter
Senior Contributor II

More information...

Sorry, should have included this the first time...

To do a TFTP boot (assuming you're on a linux machine), do the following...

1. LINUX: copy hello_world.bin to /tftpboot

2. UBOOT: using 'setenv', establish your IP environment (ipaddr, serverip, gatewayip & netmask)

3. UBOOT: tftpboot 0x77c00000 hello_world.bin

4. UBOOT: go 0x77c00000

 

To do an srecord transfer

1. UBOOT: loads

2. LINUX: use whatever means your serial port interface gives you to transfer hello_world.srec to the board.

3. UBOOT: go 0x77c00000

 

If you're running on a PC and need an alternative means of doing these downloads, you can use uCon as the terminal emulator and I can show you how to do that if needed.

HTH

0 Kudos
Reply

2,610 Views
EdSutter
Senior Contributor II

It appears to me that the load address of the hello-world app is not set correctly.

Looking at a dump of the hello_world ELF file shows me that the base address is 0x1c00000.

I then found that the makefile in that directory doesn't support the specifics of the imxQSB, so it defaults to that base address.  I think all you need to do is modify examples/standalone/Makefile.  The quick change is to set LOAD_ADDR to 0x77800000.  I was then able to use tftpboot to launch hello_world successfully.

HTH

Ed

0 Kudos
Reply

2,610 Views
KrishnaPavan
Contributor II

Hi RSmith

Is that loads or loadm command?

Can you please tell me?

0 Kudos
Reply