code of blink led
xiangfu
xiangfu at openmoko.org
Thu Jun 5 10:03:34 CEST 2008
Hi
I write some code.
but i don't know how to download it to GTA02
and how to run it?
another question :
where is the GTA02's LED? :-)
what is the best TEXT_BASE value
::::::::::::::
led.c
::::::::::::::
extern void delay(int time);
#define GPBCON (*(volatile unsigned *)0x56000010)
#define GPBDAT (*(volatile unsigned *)0x56000014)
#define GPBUP (*(volatile unsigned *)0x56000018)
#define LED3_ON() (GPBDAT &= ~(0x1))
#define LED4_ON() (GPBDAT &= ~(0x2))
#define LED3_OFF() (GPBDAT |= (0x1))
#define LED4_OFF() (GPBDAT |= (0x2))
void main()
{
GPBCON = 0x5;
GPBUP = 0xffff;
while(1)
{
LED3_ON();
delay(0xfffff);
LED4_ON();
delay(0xfffff);
LED3_OFF() ;
delay(0xfffff);
LED4_OFF();
delay(0xfffff);
}
}
::::::::::::::
led.s
::::::::::::::
.text
.global _start
ldr sp,=1024*4
.extern main
bl main
.global delay
delay:
sub r0,r0,#1
cmp r0,#0x0
bne delay
mov pc,lr
.end
::::::::::::::
Makefile
::::::::::::::
CROSS_COMPILE=arm-angstrom-linux-gnueabi-
TEXT_BASE=0x0000000
led_on: led.s led.c
$(CROSS_COMPILE)gcc -g -c -o led.o led.s
$(CROSS_COMPILE)gcc -g -c -o led_on.o led.c
$(CROSS_COMPILE)ld -Ttext $(TEXT_BASE) -g led.o led_on.o -o led_on_c.o
$(CROSS_COMPILE)objcopy -O binary -S led_on_c.o led_on
clean:
rm -f *.o
rm -f led_on
-------------- next part --------------
A non-text attachment was scrubbed...
Name: blink-led.tar.gz
Type: application/x-gzip
Size: 690 bytes
Desc: not available
Url : http://lists.openmoko.org/pipermail/openmoko-kernel/attachments/20080605/fb5a4bdf/attachment.bin
More information about the openmoko-kernel
mailing list