code of blink led

Werner Almesberger werner at
Thu Jun 5 21:53:54 CEST 2008

xiangfu wrote:
> I write some code. but i don't know how to download it to GTA02
> and how to run it?

You can use u-boot from NOR for this:

- press and hold AUX, then press and hold POWER until the boot menu
  comes up. Then release POWER and AUX.

  The title of the boot menu should read

  "*** BOOT MENU (NOR) ***"

- download your program into RAM (at address 0x32000000), with

  dfu-util -a 0 -R -D led_on

- connect to the u-boot console over the serial interface or over USB

- copy your program from RAM to NAND:

  nand erase u-boot
  nand write.e 0x32000000 0 0x1000

Then reboot and see what happens ...
Right, nothing. This is where the fun of debugging begins ;-)

A few hints:

- you have the on/off logic inversed: 1 means "on", 0 means "off".

- your delay loop is slower than you may expect. Try changing it
  to 0xffff.

After changing the delay loop, the LEDs should flash a few times,
then suddenly stop. Can you guess why ?

There is also a faster way for loading code than DFU: start OpenOCD,
then do this

  > reset halt
  > load_image /path/to/led_on 0
  > resume

This will load your code into SteppingStone's BootSRAM (see below)
and execute it from there. Note that if you use this approach, the
program is lost after a reset.

> another question :
>    where is the GTA02's LED? :-)

You mean physically ? There is a red LED behind the AUX button and
there are a blue and an orange LED behind the POWER button.

If you open the front cover of the Neo, you can see the red LED
behind AUX very clearly.

>    what is the best TEXT_BASE value

0 is the right choice. See also figure 6-4 on page 6-9 of the
SC32442B54 manual. The "SteppingStone" boot loader (inside the CPU)
loads the first 4kB if NAND into this buffer.

- Werner

More information about the openmoko-kernel mailing list