From e340e234c6cbcc282fcddfa31da9a7f1e52b0392 Mon Sep 17 00:00:00 2001 From: Mariano Alvira Date: Wed, 4 Nov 2009 17:30:18 -0500 Subject: [PATCH] clean up --- Makefile | 22 ++++++++++++---------- config.mk | 2 +- include/isr.h | 20 -------------------- include/led.h | 13 ------------- src/isr.c | 4 ++-- tests/blink-red.c | 28 ++++++++++++++++------------ 6 files changed, 31 insertions(+), 58 deletions(-) delete mode 100644 include/isr.h delete mode 100644 include/led.h diff --git a/Makefile b/Makefile index b58848070..a6b16c300 100644 --- a/Makefile +++ b/Makefile @@ -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 \ diff --git a/config.mk b/config.mk index c45de219d..853084aa2 100644 --- a/config.mk +++ b/config.mk @@ -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) diff --git a/include/isr.h b/include/isr.h deleted file mode 100644 index ec4049b89..000000000 --- a/include/isr.h +++ /dev/null @@ -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 - diff --git a/include/led.h b/include/led.h deleted file mode 100644 index ce2798a48..000000000 --- a/include/led.h +++ /dev/null @@ -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 diff --git a/src/isr.c b/src/isr.c index de7c8e1b7..9c934f341 100644 --- a/src/isr.c +++ b/src/isr.c @@ -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(); } } diff --git a/tests/blink-red.c b/tests/blink-red.c index 93464601b..e8b77c7c5 100644 --- a/tests/blink-red.c +++ b/tests/blink-red.c @@ -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