multiple tests work now.

added blink code for all the leds.
This commit is contained in:
Mariano Alvira 2009-03-30 10:01:14 -04:00
parent 583e00d2d9
commit b77fb10e63
5 changed files with 62 additions and 8 deletions

View File

@ -44,7 +44,9 @@ include $(TOPDIR)/config.mk
AOBJS =
COBJS = $(patsubst %.c,%.o,$(wildcard src/*.c))
TARGETS = $(patsubst %.c,%.o,$(wildcard tests/*.c))
TESTS = $(wildcard tests/*.c)
TARGETS = $(patsubst %.c,%.o,$(TESTS))
# Add GCC lib
PLATFORM_LIBS += --no-warn-mismatch -L $(shell dirname `$(CC) $(CFLAGS) -print-libgcc-file-name`) -lgcc
@ -52,9 +54,9 @@ PLATFORM_LIBS += --no-warn-mismatch -L $(shell dirname `$(CC) $(CFLAGS) -print-l
#########################################################################
#ALL = blink.srec blink.bin blink.dis blink.System.map
ALL = $(TARGETS:.c=.srec) $(TARGETS:.c=.bin) $(TARGETS:.c=.dis)
ALL = $(TARGETS) $(TESTS:.c=.srec) $(TESTS:.c=.bin) $(TESTS:.c=.dis)
.PRECIOUS: $(COBJS) $(TARGETS)
.PRECIOUS: $(COBJS) $(TARGETS) $(TESTS:.c=.obj)
all: $(ALL)
@ -70,10 +72,10 @@ all: $(ALL)
%.dis: %.obj
$(OBJDUMP) -DS $< > $@
%.obj: $(AOBJS) $(COBJS) $(LDSCRIPT)
%.obj: $(AOBJS) $(COBJS) $(TARGETS) $(LDSCRIPT)
$(LD) $(LDFLAGS) $(AOBJS) $(COBJS) \
--start-group $(PLATFORM_LIBS) --end-group \
-Map $*.map -o $@
-Map $*.map $*.o -o $@
%.System.map: %.obj
@ -99,7 +101,7 @@ clean:
clobber: clean
find . -type f \
\( -name .depend -o -name '*.srec' -o -name '*.bin' -o -name '*.dis' -o -name '*.map' \) \
\( -name .depend -o -name '*.srec' -o -name '*.bin' -o -name '*.dis' -o -name '*.map' -o -name '*.obj' \) \
-print \
| xargs rm -f
rm -f $(OBJS) *.bak tags TAGS

View File

@ -8,13 +8,13 @@
void main(void) {
*(volatile uint32_t *)GPIO_PAD_DIR0 = 0x00000100;
*(volatile uint32_t *)GPIO_PAD_DIR0 = 0x00000400;
volatile uint32_t i;
while(1) {
*(volatile uint32_t *)GPIO_DATA0 = 0x00000100;
*(volatile uint32_t *)GPIO_DATA0 = 0x00000400;
for(i=0; i<DELAY; i++) { continue; }

26
tests/blink-green.c Normal file
View File

@ -0,0 +1,26 @@
#define MBAR_GPIO 0x80000000
#define GPIO_PAD_DIR0 0x80000000
#define GPIO_DATA0 0x80000008
#define UART1_DATA 0x80005008
#define DELAY 400000
#include "embedded_types.h"
void main(void) {
*(volatile uint32_t *)GPIO_PAD_DIR0 = 0x00000200;
volatile uint32_t i;
while(1) {
*(volatile uint32_t *)GPIO_DATA0 = 0x00000200;
for(i=0; i<DELAY; i++) { continue; }
*(volatile uint32_t *)GPIO_DATA0 = 0x00000000;
for(i=0; i<DELAY; i++) { continue; }
};
}

26
tests/blink-white.c Normal file
View File

@ -0,0 +1,26 @@
#define MBAR_GPIO 0x80000000
#define GPIO_PAD_DIR0 0x80000000
#define GPIO_DATA0 0x80000008
#define UART1_DATA 0x80005008
#define DELAY 400000
#include "embedded_types.h"
void main(void) {
*(volatile uint32_t *)GPIO_PAD_DIR0 = 0x00000700;
volatile uint32_t i;
while(1) {
*(volatile uint32_t *)GPIO_DATA0 = 0x00000700;
for(i=0; i<DELAY; i++) { continue; }
*(volatile uint32_t *)GPIO_DATA0 = 0x00000000;
for(i=0; i<DELAY; i++) { continue; }
};
}