This commit is contained in:
Mariano Alvira 2009-11-04 17:30:18 -05:00
parent a75f1c4437
commit e340e234c6
6 changed files with 31 additions and 58 deletions

View file

@ -39,7 +39,8 @@ include $(TOPDIR)/config.mk
AOBJS =
COBJS = $(patsubst %.c,%.o,$(wildcard src/*.c))
TESTS = $(wildcard tests/*.c)
#TESTS = $(wildcard tests/*.c)
TESTS = tests/blink-red.c
TARGETS = $(patsubst %.c,%.o,$(TESTS))
# Add GCC lib
@ -53,17 +54,17 @@ ALL = $(TESTS:.c=.srec) $(TESTS:.c=.bin) $(TESTS:.c=.dis)
all: src/start.o src/isr.o $(ALL)
tests/flasher.obj: src/maca.o src/nvm.o
tests/nvm-read.obj: src/maca.o src/nvm.o
tests/nvm-write.obj: src/maca.o src/nvm.o
tests/rftest-rx.obj: src/maca.o src/nvm.o
tests/rftest-tx.obj: src/maca.o src/nvm.o
tests/tmr-ints.obj: src/isr.o
tests/sleep.obj: src/isr.o src/maca.o src/nvm.o
#tests/flasher.obj: src/maca.o src/nvm.o
#tests/nvm-read.obj: src/maca.o src/nvm.o
#tests/nvm-write.obj: src/maca.o src/nvm.o
#tests/rftest-rx.obj: src/maca.o src/nvm.o
#tests/rftest-tx.obj: src/maca.o src/nvm.o
#tests/tmr-ints.obj: src/isr.o
#tests/sleep.obj: src/isr.o src/maca.o src/nvm.o
NOTHUMB_CPPFLAGS := $(DBGFLAGS) $(OPTFLAGS) $(RELFLAGS) \
-D__KERNEL__ -DTEXT_BASE=$(TEXT_BASE) \
-I$(TOPDIR)/include \
-I$(TOPDIR)/libmc1322x/include \
-fno-builtin -ffreestanding -nostdinc -isystem \
$(gccincdir) -pipe
NOTHUMB_CPPFLAGS_EXTRA = -march=armv4t -mlong-calls -mtune=arm7tdmi-s -DCONFIG_ARM -D__ARM__ -mthumb-interwork
@ -108,8 +109,9 @@ sinclude .depend
clean:
find . -type f \
\( -name 'core' -o -name '*.bak' -o -name '*~' \
-o -name '*.o' -o -name '*.a' \) -print \
-o -name '*.o' -o -name '*.a' -o -name '*.obj' \) -print \
| xargs rm -f
rm -f $(ALL) $(OBJS)
clobber: clean
find . -type f \

View file

@ -55,7 +55,7 @@ gccincdir := $(shell $(CC) -print-file-name=include)
CPPFLAGS := $(DBGFLAGS) $(OPTFLAGS) $(RELFLAGS) \
-D__KERNEL__ -DTEXT_BASE=$(TEXT_BASE) \
-I$(TOPDIR)/include \
-I$(TOPDIR)/libmc1322x/include \
-fno-builtin -ffreestanding -nostdinc -isystem \
$(gccincdir) -pipe $(PLATFORM_CPPFLAGS)

View file

@ -1,20 +0,0 @@
#ifndef ISR_H
#define ISR_H
#include "embedded_types.h"
#define INTBASE (0x80020000)
#define INTENNUM_OFF (0x8)
#define INTDISNUM_OFF (0xc)
#define INTSRC_OFF (0x30)
#define INTENNUM INTBASE + INTENNUM_OFF
#define INTDISNUM INTBASE + INTDISNUM_OFF
#define INTSRC INTBASE + INTSRC_OFF
#define enable_tmr_irq() *(volatile uint32_t *)(INTENNUM) = 5;
extern void tmr_isr(void) __attribute__((weak));
#endif

View file

@ -1,13 +0,0 @@
#ifndef LED_H
#define LED_H
#define LED_RED ((1 << 23) | (1 << 8))
#define LED_GREEN ((1 << 24) | (1 << 9))
#define LED_BLUE ((1 << 25) | (1 << 10))
#define LED_YELLOW (LED_RED | LED_GREEN )
#define LED_PURPLE (LED_RED | LED_BLUE)
#define LED_CYAN ( LED_GREEN | LED_BLUE)
#define LED_WHITE (LED_RED | LED_GREEN | LED_BLUE)
#endif

View file

@ -1,4 +1,4 @@
#include "embedded_types.h"
#include "types.h"
#include "isr.h"
#define reg32(x) (*(volatile uint32_t *)(x))
@ -7,7 +7,7 @@ __attribute__ ((section (".irq")))
__attribute__ ((interrupt("IRQ")))
void irq(void)
{
if(tmr_isr != NULL) {
if(tmr_isr != 0) {
tmr_isr();
}
}

View file

@ -1,29 +1,33 @@
#define MBAR_GPIO 0x80000000
#define GPIO_PAD_DIR0 0x80000000
#define GPIO_DATA0 0x80000008
#define UART1_DATA 0x80005008
#define DELAY 400000
#include "embedded_types.h"
#include "types.h"
#include "isr.h"
#include "led.h"
#define MBAR_GPIO 0x80000000
#define GPIO_PAD_DIR0 ((volatile uint32_t *) 0x80000000)
#define GPIO_DATA0 ((volatile uint32_t *) 0x80000008)
#define UART1_DATA ((volatile uint32_t *) 0x80005008)
#define DELAY 400000
#define LED_BITS LED_RED
__attribute__ ((section ("startup"))) void main(void) {
*(volatile uint32_t *)GPIO_PAD_DIR0 = LED_BITS;
__attribute__ ((section ("startup")))
void main(void) {
volatile uint32_t i;
*GPIO_PAD_DIR0 = LED_BITS;
while(1) {
*(volatile uint32_t *)GPIO_DATA0 = LED_BITS;
*GPIO_DATA0 = LED_BITS;
for(i=0; i<DELAY; i++) { continue; }
*(volatile uint32_t *)GPIO_DATA0 = 0x00000000;
*GPIO_DATA0 = 0x00000000;
for(i=0; i<DELAY; i++) { continue; }
};
}