diff --git a/redbee-econotag/Makefile b/redbee-econotag/Makefile new file mode 100644 index 0000000000..391c9bd42f --- /dev/null +++ b/redbee-econotag/Makefile @@ -0,0 +1,26 @@ +SRC = $(wildcard *.c) +BINDIR = $(RIOTBOARD)/$(BOARD)/bin/ +OBJ = $(SRC:%.c=$(BINDIR)%.o)## defines +DEP = $(SRC:%.c=$(BINDIR)%.d) +export ARCH = redbee-econotag_base.a + +all: $(BINDIR)$(ARCH) + $(MAKE) -C drivers + +$(BINDIR)$(ARCH): $(OBJ) + $(AR) rcs $(BINDIR)$(ARCH) $(OBJ) + +# pull in dependency info for *existing* .o files +-include $(OBJ:.o=.d) + +# compile and generate dependency info +$(BINDIR)%.o: %.c + $(CC) $(CFLAGS) $(INCLUDES) $(BOARDINCLUDE) $(PROJECTINCLUDE) $(CPUINCLUDE) -c $*.c -o $(BINDIR)$*.o + $(CC) $(CFLAGS) $(INCLUDES) $(BOARDINCLUDE) $(PROJECTINCLUDE) $(CPUINCLUDE) -MM $*.c > $(BINDIR)$*.d + @printf "$(BINDIR)"|cat - $(BINDIR)$*.d > /tmp/riot_out && mv /tmp/riot_out $(BINDIR)$*.d + +# remove compilation products +clean: + ${MAKE} -C drivers clean + rm -f $(OBJ) $(DEP) + diff --git a/redbee-econotag/Makefile.dep b/redbee-econotag/Makefile.dep new file mode 100644 index 0000000000..e69de29bb2 diff --git a/redbee-econotag/Makefile.include b/redbee-econotag/Makefile.include new file mode 100644 index 0000000000..ee087fb781 --- /dev/null +++ b/redbee-econotag/Makefile.include @@ -0,0 +1,27 @@ +## the cpu to build for +export CPU = mc1322x + +# toolchain config +export PREFIX = @arm-none-eabi- +export CC = @$(PREFIX)gcc +export AR = @$(PREFIX)ar +export CFLAGS = -std=gnu99 -march=armv4t -mtune=arm7tdmi-s -mlong-calls \ + -msoft-float -mthumb-interwork -fno-strict-aliasing -fno-common \ + -ffixed-r8 -ffunction-sections -ffreestanding -fno-builtin \ + -nodefaultlibs -Wcast-align -Wall -Wstrict-prototypes -Wextra \ + -Os -pipe +$(warning TODO add -mthumb) +export AFLAGS = -Wa,-gstabs $(CFLAGS) +export AS = $(PREFIX)as +export LINK = $(PREFIX)gcc +export SIZE = $(PREFIX)size +export OBJCOPY = $(PREFIX)objcopy +FLASHER = lpc2k_pgm +TERM = pyterm.py +LINKFLAGS = -mcpu=arm7tdmi-s -static -lgcc -nostartfiles -T$(RIOTBASE)/cpu/$(CPU)/mc1322x.lds + +ifeq ($(strip $(PORT)),) + export PORT = /dev/ttyUSB0 +endif +export HEXFILE = bin/$(PROJECT).hex +export FFLAGS = -d $(PORT) -j uif "prog $(HEXFILE)" diff --git a/redbee-econotag/board_init.c b/redbee-econotag/board_init.c new file mode 100644 index 0000000000..5a0b03177c --- /dev/null +++ b/redbee-econotag/board_init.c @@ -0,0 +1,11 @@ +/* + * board_init.c - redbee-econotag initialization code + * Copyright (C) 2013 Oliver Hahm + * + * This source code is licensed under the GNU General Public License, + * Version 3. See the file LICENSE for more details. + */ + +void board_init(void) { + asm("nop"); +} diff --git a/redbee-econotag/drivers/Makefile b/redbee-econotag/drivers/Makefile new file mode 100644 index 0000000000..8b8b6094b9 --- /dev/null +++ b/redbee-econotag/drivers/Makefile @@ -0,0 +1,26 @@ +SRC = $(wildcard *.c) +BINDIR = $(RIOTBOARD)/$(BOARD)/bin/ +OBJ = $(SRC:%.c=$(BINDIR)%.o) +DEP = $(SRC:%.c=$(BINDIR)%.d) + +INCLUDES += -I$(RIOTBASE)/sys/include/ -I$(RIOTBASE)/drivers/cc110x_ng/include/ + +.PHONY: redbee-econotag_drivers.a + +$(BINDIR)redbee-econotag_common_drivers.a: $(OBJ) + $(AR) rcs $(BINDIR)$(ARCH) $(OBJ) + +# pull in dependency info for *existing* .o files +-include $(OBJ:.o=.d) + +# compile and generate dependency info +$(BINDIR)%.o: %.c + $(CC) $(CFLAGS) $(INCLUDES) $(BOARDINCLUDE) $(PROJECTINCLUDE) $(CPUINCLUDE) -c $*.c -o $(BINDIR)$*.o + $(CC) $(CFLAGS) $(INCLUDES) $(BOARDINCLUDE) $(PROJECTINCLUDE) $(CPUINCLUDE) -MM $*.c > $(BINDIR)$*.d + @printf "$(BINDIR)" | cat - $(BINDIR)$*.d > /tmp/riot_out && mv /tmp/riot_out $(BINDIR)$*.d + +# remove compilation products + +clean: + rm -f $(OBJ) $(DEP) + diff --git a/redbee-econotag/drivers/redbee_uart1.c b/redbee-econotag/drivers/redbee_uart1.c new file mode 100644 index 0000000000..046ed26ab1 --- /dev/null +++ b/redbee-econotag/drivers/redbee_uart1.c @@ -0,0 +1,43 @@ +/* + * redbee_uart1.c - UART1 driver for redbee + * Copyright (C) 2013 Oliver Hahm + * + * This source code is licensed under the GNU General Public License, + * Version 3. See the file LICENSE for more details. + * + * This file is part of RIOT. + */ + +#include "mc1322x.h" + +static volatile unsigned int running = 0; +static volatile unsigned int fifo = 0; + +static inline int uart0_puts(char *astring, int length) +{ + int i; + for (i=0;iTXCON != 0); + UART1->DATA = astring[i]; + } + return length; +} + +int fw_puts(char *astring, int length) +{ + return uart0_puts(astring, length); +} + +void stdio_flush(void) +{ + /* disable TX interrupt */ + UART1->CONbits.MTXR = 1; + while(running) { + while(UART1->TXCON != 0); + fifo=0; + push_queue(); // dequeue to fifo + } + /* enable TX interrupt */ + UART1->CONbits.MTXR = 0; +}