My favorites | Sign in
Project Home Downloads Wiki Issues Source
Search
for
Flash_LED  
First external application to U-Boot --> Flash LED test.
Deprecated
Updated Feb 4, 2010 by casai...@gmail.com

I had tried to understand how to make a simple code to start, so I tried to make a flash LED code which should be launched by U-Boot.

I have the Flash LED code working, but is a very simple code: http://code.google.com/p/rockboxplayer/source/browse/flash_led-0.c?r=11

In makefile I did used: http://code.google.com/p/rockboxplayer/source/browse/Makefile?r=11

On the U-Boot shell I did: - "tftp 0x20040000 flash_LED.bin"; - "go 0x20040000" -- and the code started working :-) :-)

SDRAM starts on address 0x20000000 however looks like the first bytes are used for others things and so people at U-Boot mailing list suggested me to use 0x20040000.


In "examples" directory f U-Boot we have an "hello_world.c" which uses some files from U-Boot, I do not want to use any of them so I asked on the mailinglist of U-Boot how to do that, here is the answers:

Leon.Z to me
	
HI:)

You can use the go CMD to test your app.
Here post my used step.

Write a simple code.It's just include a function definition
       void _start()
   {
   }
Then compile it.After do that use following step:
ppc_82xx-ld -Bstatic -Ttext 0x00001000 board/bname/ttt.o -o ttt.elf

-bash-2.05b$ ppc_82xx-objdump -d ttt.elf

ttt.elf:     file format elf32-powerpc

Disassembly of section .text:

00001000 <_start>:
   1000:       94 21 ff e8     stwu    r1,-24(r1)
   1004:       38 21 00 18     addi    r1,r1,24
   1008:       4e 80 00 20     blr
-bash-2.05b$

you can see the function just call the stack operation.
then you can put your test code to the _start function's body,
and run the step above again.

finally to get a pure bin file:
ppc_82xx-objcopy --gap-fill=0xff -O binary ttt.elf ttt.bin

and then test the code in the u-boot prompt:
u-boot> tftp 0x1000 ttt.bin
u-boot> go 0x1000


======= 2008-04-14 16:33:55 您在来信中写道:=======

>Hello :-)
>
>I am looking for an example code for a Flash LED, for a stand alone
>application. I did read the examples like "hello world" and the
>/doc/standalone.
>
>I would like to know If I can build a stand alone application without
>build the u-boot -- I would appreciate if someone point me to a
>tutorial, I just find examples for load Linux...
>
>I am a newbie in 32 bits world. I am trying to port Rockbox*, the Free
>Software firmware for audio DAPs like IPods, Sansas, etc., for a
>Free/Open hardware, the Rockbox Player**.
>
>I need to use u-boot to launch that firmware, first I would like to
>start doing a flash led application. I did build u-boot, using the
>sources that came with the dev. board I am using, with success however
>the firmware I want to build don't build with arm-linux-gcc, just with
>arm-elf-gcc.
>
>I appreciate any suggestions, any guidance. Thank you.
>
>Jorge Pinto,
>
>http://www.casainho.net
>
>* http://www.rockbox.org/
>** http://www.rockbox.org/twiki/bin/view/Main/RockboxPlayer
>

Leon.Z
2008-04-14
-------------------
Detlev Zundel to me, Leon.Z, u-boot-users
	
from	Detlev Zundel
to	"J.P. Casainho",
cc	"Leon.Z",
u-boot-users@lists.sourceforge.net,
date	Thu, Apr 17, 2008 at 4:03 PM
subject	Re: [U-Boot-Users] questions about stand alone application - flash a LED
	
Hi,

>> You can use the go CMD to test your app.
>> Here post my used step.
>>
>> Write a simple code.It's just include a function definition
>>      void _start()
>>     {
>>     }
>> Then compile it.After do that use following step:
>> ppc_82xx-ld -Bstatic -Ttext 0x00001000 board/bname/ttt.o -o ttt.elf

It just occured to me that you are overwriting the InstructionTLBMiss
exception vector here.  Are you sure you want to do this?

This is one of the reasons why in examples/Makefile always 0x40000 is
chosen for the standalone apps:

ifeq ($(ARCH),ppc)
LOAD_ADDR = 0x40000
endif

Cheers
 Detlev}}}

Sign in to add a comment
Powered by Google Project Hosting