1
0
mirror of git://projects.qi-hardware.com/xburst-tools.git synced 2024-12-23 13:47:44 +02:00

blink led

This commit is contained in:
xiangfu 2008-06-12 18:22:49 -04:00
commit 39d58838d9
6 changed files with 112 additions and 0 deletions

25
qiboot/Makefile Normal file
View File

@ -0,0 +1,25 @@
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 2 of
# the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
# MA 02111-1307 USA
#
include ./config.mk
all :
cd src ; make all
clean:
cd src ; make clean

0
qiboot/README Normal file
View File

11
qiboot/config.mk Normal file
View File

@ -0,0 +1,11 @@
#
# Include the make variables (CC, etc...)
#
CROSS_COMPILE=arm-angstrom-linux-gnueabi-
AS = $(CROSS_COMPILE)as
LD = $(CROSS_COMPILE)ld
CC = $(CROSS_COMPILE)gcc
OBJCOPY = $(CROSS_COMPILE)objcopy
export CROSS_COMPILE AD LD CC OBJCOPY

35
qiboot/src/Makefile Normal file
View File

@ -0,0 +1,35 @@
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 2 of
# the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
# MA 02111-1307 USA
#
TEXT_BASE =0x0000000
INCLUDE =../include
IMAGE =../image
CFLAGS =-I $(INCLUDE) -g -c -o
all:led.S led.c
$(CC) $(CFLAGS) led_S.o led.S
$(CC) $(CFLAGS) led_C.o led.c
$(LD) -Ttext $(TEXT_BASE) -g led_S.o led_C.o -o led.o
$(OBJCOPY) -O binary -S led.o $(IMAGE)/led_on
clean:
rm -f *.o
rm -f led_on
rm -f $(IMAGE)/*

12
qiboot/src/led.S Normal file
View File

@ -0,0 +1,12 @@
.global _start
_start:
ldr sp,=1024*4
.extern main
bl main
.global delay
delay:
subs r0,r0,#0x1
bne delay
mov pc,lr

29
qiboot/src/led.c Normal file
View File

@ -0,0 +1,29 @@
#define GPBCON (*(volatile unsigned *)0x56000010)
#define GPBDAT (*(volatile unsigned *)0x56000014)
#define GPBDW (*(volatile unsigned *)0x56000018)
#define LED3_ON() (GPBDAT &= ~(0x1))
#define LED4_ON() (GPBDAT &= ~(0x2))
#define LED3_OFF() (GPBDAT |= (0x1))
#define LED4_OFF() (GPBDAT |= (0x2))
extern void delay(int time);
int main()
{
GPBCON = 0x5;
GPBDW = 0xffff;
while(1)
{
LED3_ON();
delay(0xffff);
LED3_OFF() ;
delay(0xffff);
LED4_ON();
delay(0xffff);
LED4_OFF();
delay(0xffff);
}
return 1;
}