commit 39d58838d968b6a79bbae61380836dfbbd292b6e Author: Xiangfu Liu Date: Thu Jun 12 18:22:49 2008 -0400 blink led diff --git a/qiboot/Makefile b/qiboot/Makefile new file mode 100644 index 0000000..b49ee49 --- /dev/null +++ b/qiboot/Makefile @@ -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 + + diff --git a/qiboot/README b/qiboot/README new file mode 100644 index 0000000..e69de29 diff --git a/qiboot/config.mk b/qiboot/config.mk new file mode 100644 index 0000000..c475739 --- /dev/null +++ b/qiboot/config.mk @@ -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 diff --git a/qiboot/src/Makefile b/qiboot/src/Makefile new file mode 100644 index 0000000..39d2d0d --- /dev/null +++ b/qiboot/src/Makefile @@ -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)/* + diff --git a/qiboot/src/led.S b/qiboot/src/led.S new file mode 100644 index 0000000..8e539df --- /dev/null +++ b/qiboot/src/led.S @@ -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 + diff --git a/qiboot/src/led.c b/qiboot/src/led.c new file mode 100644 index 0000000..5e8447b --- /dev/null +++ b/qiboot/src/led.c @@ -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; +} +