summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPixel <pixel@nobis-crew.org>2011-01-25 07:09:44 -0800
committerPixel <pixel@nobis-crew.org>2011-01-25 07:09:44 -0800
commita1f6f3f277f7e79bf10e196494a8d6dfa6123cfa (patch)
tree7a4ef9a0fbae765a91b95f9a4840a8382829a81f
parentd6205d3578e89b5e20757b152d3d7ad46b5c236b (diff)
More consistent makefiles includes. Adding BoardConsole for basic console output general API. Starting up console from the boot sequence.
-rw-r--r--FreeRTOS/Makefile1
-rw-r--r--FreeRTOS/config.mk2
-rw-r--r--arch/Makefile2
-rw-r--r--arch/arm/lpc17xx/mbed/BoardConsole.c31
-rw-r--r--arch/arm/lpc17xx/mbed/BoardConsole.h12
-rw-r--r--arch/config.mk2
-rw-r--r--demo.c4
-rw-r--r--os/Makefile1
8 files changed, 50 insertions, 5 deletions
diff --git a/FreeRTOS/Makefile b/FreeRTOS/Makefile
index 63760c5..90a54da 100644
--- a/FreeRTOS/Makefile
+++ b/FreeRTOS/Makefile
@@ -4,6 +4,7 @@ all: $(TARGET_LIB)
include $(ROOTDIR)/common.mk
include config.mk
+include $(ROOTDIR)/arch/config.mk
TARGET_SRCS = Source/croutine.c Source/list.c Source/queue.c Source/tasks.c
diff --git a/FreeRTOS/config.mk b/FreeRTOS/config.mk
index d45722a..ca7bd93 100644
--- a/FreeRTOS/config.mk
+++ b/FreeRTOS/config.mk
@@ -6,7 +6,7 @@ endif
ifeq ($(CPU),arm)
ifeq ($(CPU_FLAVOR),lpc1768)
-TARGET_INCLUDES += $(ROOTDIR)/config/arm/lpc1768 $(ROOTDIR)/arch/arm/lpc17xx/Core/CM3/DeviceSupport/NXP/LPC17xx $(ROOTDIR)/arch/arm/lpc17xx/Core/CM3/CoreSupport
+TARGET_INCLUDES += $(ROOTDIR)/config/arm/lpc1768
ifeq ($(USE_MPU),true)
TARGET_INCLUDES += $(ROOTDIR)/FreeRTOS/Source/portable/GCC/ARM_CM3_MPU
else
diff --git a/arch/Makefile b/arch/Makefile
index 0ce1809..f8e69d4 100644
--- a/arch/Makefile
+++ b/arch/Makefile
@@ -10,7 +10,7 @@ ifeq ($(CPU),arm)
ifeq ($(CPU_FLAVOR),lpc1768)
TARGET_SRCS += arm/lpc17xx/Core/CM3/DeviceSupport/NXP/LPC17xx/system_LPC17xx.c arm/lpc17xx/Core/CM3/CoreSupport/core_cm3.c
TARGET_SRCS += $(addprefix arm/lpc17xx/Drivers/source/lpc17xx_, spi.c rit.c exti.c wdt.c uart.c dac.c rtc.c i2s.c pwm.c mcpwm.c pinsel.c nvic.c emac.c systick.c ssp.c can.c gpio.c libcfg_default.c i2c.c timer.c gpdma.c clkpwr.c qei.c adc.c)
-TARGET_SRCS += arm/lpc17xx/startup.s arm/lpc17xx/hooks.c arm/lpc17xx/Drivers/source/debug_frmwrk.c
+TARGET_SRCS += arm/lpc17xx/startup.s arm/lpc17xx/hooks.c arm/lpc17xx/Drivers/source/debug_frmwrk.c arm/lpc17xx/mbed/BoardConsole.c
endif
endif
diff --git a/arch/arm/lpc17xx/mbed/BoardConsole.c b/arch/arm/lpc17xx/mbed/BoardConsole.c
new file mode 100644
index 0000000..3f00c08
--- /dev/null
+++ b/arch/arm/lpc17xx/mbed/BoardConsole.c
@@ -0,0 +1,31 @@
+#include <stdio.h>
+#include <malloc.h>
+#include <stdarg.h>
+#include "BoardConsole.h"
+#include <debug_frmwrk.h>
+
+void BoardConsoleInit() {
+ debug_frmwrk_init();
+}
+
+void BoardConsolePuts(const char * str) {
+ _DBG_(str);
+}
+
+void BoardConsolePutc(int c) {
+ _DBC(c);
+}
+
+void BoardConsolePrintf(const char * fmt, ...) {
+ va_list ap;
+ va_start(ap, fmt);
+ BoardConsoleVPrintf(fmt, ap);
+ va_end(ap);
+}
+
+void BoardConsoleVPrintf(const char * fmt, va_list ap) {
+ char * str = NULL;
+ vasprintf(&str, fmt, ap);
+ _DBG(str);
+ free(str);
+}
diff --git a/arch/arm/lpc17xx/mbed/BoardConsole.h b/arch/arm/lpc17xx/mbed/BoardConsole.h
new file mode 100644
index 0000000..75b970f
--- /dev/null
+++ b/arch/arm/lpc17xx/mbed/BoardConsole.h
@@ -0,0 +1,12 @@
+#ifndef __MBED_CONSOLE_H__
+#define __MBED_CONSOLE_H__
+
+#include <stdarg.h>
+
+void BoardConsoleInit();
+void BoardConsolePuts(const char * str);
+void BoardConsolePutc(int);
+void BoardConsolePrintf(const char * fmt, ...) __attribute__ ((format(printf, 1, 2)));
+void BoardConsoleVPrintf(const char * fmt, va_list ap);
+
+#endif
diff --git a/arch/config.mk b/arch/config.mk
index f182a95..4ec1d04 100644
--- a/arch/config.mk
+++ b/arch/config.mk
@@ -1,6 +1,6 @@
ifeq ($(CPU),arm)
ifeq ($(CPU_FLAVOR),lpc1768)
-TARGET_INCLUDES += $(ROOTDIR)/arch/arm/lpc17xx/Core/CM3/DeviceSupport/NXP/LPC17xx $(ROOTDIR)/arch/arm/lpc17xx/Core/CM3/CoreSupport $(ROOTDIR)/arch/arm/lpc17xx/Drivers/include
+TARGET_INCLUDES += $(ROOTDIR)/arch/arm/lpc17xx/Core/CM3/DeviceSupport/NXP/LPC17xx $(ROOTDIR)/arch/arm/lpc17xx/Core/CM3/CoreSupport $(ROOTDIR)/arch/arm/lpc17xx/Drivers/include $(ROOTDIR)/arch/arm/lpc17xx/mbed
ifeq ($(USE_MPU),true)
LDSCRIPT = $(ROOTDIR)/arch/arm/lpc17xx/ldscript-mpu
else
diff --git a/demo.c b/demo.c
index c9eb8eb..c3df762 100644
--- a/demo.c
+++ b/demo.c
@@ -1,7 +1,7 @@
#include <FreeRTOS.h>
#include <task.h>
-#include <debug_frmwrk.h>
#include <lpc17xx_gpio.h>
+#include <BoardConsole.h>
#define LED1_wire 18
#define LED2_wire 20
@@ -31,12 +31,12 @@ void litLED(int led, int value) {
}
int main() {
- debug_frmwrk_init();
setupLEDs();
litLED(1, 1);
litLED(2, 0);
litLED(3, 1);
litLED(4, 0);
+ BoardConsolePuts("Hello World.");
vTaskStartScheduler();
return 0;
}
diff --git a/os/Makefile b/os/Makefile
index c19d685..42a553c 100644
--- a/os/Makefile
+++ b/os/Makefile
@@ -5,6 +5,7 @@ all: $(TARGET_LIB)
include $(ROOTDIR)/common.mk
include config.mk
include $(ROOTDIR)/FreeRTOS/config.mk
+include $(ROOTDIR)/arch/config.mk
TARGET_SRCS = src/init.c src/sbrk.c src/sprintf.c src/malloc.c src/free.c src/fclose.c src/read.c src/lseek.c src/write.c src/close.c