summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--FreeRTOS/Makefile5
-rw-r--r--FreeRTOS/config.mk12
-rw-r--r--Makefile13
-rw-r--r--arch/Makefile2
-rw-r--r--arch/config.mk12
-rw-r--r--demo.c6
-rw-r--r--target-rules.mk16
7 files changed, 56 insertions, 10 deletions
diff --git a/FreeRTOS/Makefile b/FreeRTOS/Makefile
index e5df2a8..dc19136 100644
--- a/FreeRTOS/Makefile
+++ b/FreeRTOS/Makefile
@@ -3,24 +3,21 @@ TARGET_LIB = libFreeRTOS.a
all: $(TARGET_LIB)
include $(ROOTDIR)/common.mk
+include config.mk
ifeq ($(USE_MPU),true)
TARGET_CPPFLAGS += -DportUSING_MPU_WRAPPERS=1
endif
TARGET_SRCS = Source/croutine.c Source/list.c Source/queue.c Source/tasks.c
-TARGET_INCLUDES = Source/include
ifeq ($(CPU),arm)
ifeq ($(CPU_FLAVOR),lpc1768)
TARGET_SRCS += Source/portable/MemMang/heap_3.c
-TARGET_INCLUDES += $(ROOTDIR)/config/arm/lpc1768 $(ROOTDIR)/arch/arm/lpc17xx/Core/CM3/DeviceSupport/NXP/LPC17xx $(ROOTDIR)/arch/arm/lpc17xx/Core/CM3/CoreSupport
ifeq ($(USE_MPU),true)
TARGET_SRCS += Source/portable/GCC/ARM_CM3_MPU/port.c
-TARGET_INCLUDES += Source/portable/GCC/ARM_CM3_MPU
else
TARGET_SRCS += Source/portable/GCC/ARM_CM3/port.c
-TARGET_INCLUDES += Source/portable/GCC/ARM_CM3
endif
endif
endif
diff --git a/FreeRTOS/config.mk b/FreeRTOS/config.mk
new file mode 100644
index 0000000..81248d9
--- /dev/null
+++ b/FreeRTOS/config.mk
@@ -0,0 +1,12 @@
+TARGET_INCLUDES = $(ROOTDIR)/FreeRTOS/Source/include
+
+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
+ifeq ($(USE_MPU),true)
+TARGET_INCLUDES += $(ROOTDIR)/FreeRTOS/Source/portable/GCC/ARM_CM3_MPU
+else
+TARGET_INCLUDES += $(ROOTDIR)/FreeRTOS/Source/portable/GCC/ARM_CM3
+endif
+endif
+endif
diff --git a/Makefile b/Makefile
index 4fedaf0..78a1222 100644
--- a/Makefile
+++ b/Makefile
@@ -1,14 +1,16 @@
+TARGET = demo.bin
+LIBS = -LFreeRTOS -Larch -lFreeRTOS -larch
+
export ROOTDIR = $(CURDIR)
-include $(ROOTDIR)/common.mk
+include common.mk
-all: libs
+all: libs $(TARGET)
-clean:
+clean: clean-generic
$(MAKE) -C FreeRTOS clean
$(MAKE) -C arch clean
-
.PHONY: libs FreeRTOS arch
libs: FreeRTOS arch
@@ -19,3 +21,6 @@ FreeRTOS:
arch:
$(MAKE) -C arch
+include FreeRTOS/config.mk
+include arch/config.mk
+include target-rules.mk
diff --git a/arch/Makefile b/arch/Makefile
index 89121a0..60f44bf 100644
--- a/arch/Makefile
+++ b/arch/Makefile
@@ -3,10 +3,10 @@ TARGET_LIB = libarch.a
all: $(TARGET_LIB)
include $(ROOTDIR)/common.mk
+include config.mk
ifeq ($(CPU),arm)
ifeq ($(CPU_FLAVOR),lpc1768)
-TARGET_INCLUDES += arm/lpc17xx/Core/CM3/DeviceSupport/NXP/LPC17xx arm/lpc17xx/Core/CM3/CoreSupport arm/lpc17xx/Drivers/include
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
diff --git a/arch/config.mk b/arch/config.mk
new file mode 100644
index 0000000..be2ecb9
--- /dev/null
+++ b/arch/config.mk
@@ -0,0 +1,12 @@
+include $(ROOTDIR)/common.mk
+
+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
+ifeq ($(USE_MPU),true)
+LDSCRIPT = $(ROOTDIR)/arch/arm/lpc17xx/ldscript
+else
+LDSCRIPT = $(ROOTDIR)/arch/arm/lpc17xx/ldscript-mpu
+endif
+endif
+endif
diff --git a/demo.c b/demo.c
new file mode 100644
index 0000000..7f2a174
--- /dev/null
+++ b/demo.c
@@ -0,0 +1,6 @@
+#include <FreeRTOS.h>
+#include <task.h>
+
+int main() {
+ vTaskStartScheduler();
+}
diff --git a/target-rules.mk b/target-rules.mk
index dc5a047..acb398c 100644
--- a/target-rules.mk
+++ b/target-rules.mk
@@ -8,6 +8,20 @@
TARGET_OBJS = $(addsuffix .o, $(basename $(TARGET_SRCS)))
+ifneq ($(TARGET),)
+TARGET_ELF = $(addsuffix .elf, $(basename $(TARGET)))
+TARGET_BIN = $(addsuffix .bin, $(basename $(TARGET)))
+TARGET_OBJS += $(addsuffix .o, $(basename $(TARGET)))
+endif
+
+$(TARGET_ELF): $(TARGET_OBJS)
+ $(E) [TL] Linking $@
+ $(Q)$(TARGET_LD) -o $@ $^ -T$(LDSCRIPT) $(LIBS)
+
+$(TARGET_BIN): $(TARGET_ELF)
+ $(E) [TB] Creating $@
+ $(Q)$(TARGET_OBJDUMP) $< -O binary $@
+
$(TARGET_LIB): $(TARGET_OBJS)
$(E) [TLIB] Creating $@
$(Q)$(TARGET_AR) rcs $@ $^
@@ -15,4 +29,4 @@ $(TARGET_LIB): $(TARGET_OBJS)
.PHONY: clean-generic
clean-generic:
- rm -f $(TARGET_LIB) $(TARGET_OBJS)
+ rm -f $(TARGET_LIB) $(TARGET_OBJS) $(TARGET) $(TARGET_ELF) $(TARGET_BIN)