From c437f86b84ef0a5c98a52009489313497a5086e4 Mon Sep 17 00:00:00 2001 From: "Nicolas \"Pixel\" Noble" Date: Mon, 24 Jan 2011 00:56:49 +0100 Subject: Adding a few makefiles. --- FreeRTOS/Makefile | 30 ++++++++++++++++++++++++++++++ Makefile | 21 +++++++++++++++++++++ common.mk | 12 ++++++++++++ config/general.mk | 1 + config/target.mk | 8 ++++++++ config/toolchain.mk | 14 ++++++++++++++ target-rules.mk | 14 ++++++++++++++ 7 files changed, 100 insertions(+) create mode 100644 FreeRTOS/Makefile create mode 100644 Makefile create mode 100644 common.mk create mode 100644 config/general.mk create mode 100644 config/target.mk create mode 100644 config/toolchain.mk create mode 100644 target-rules.mk diff --git a/FreeRTOS/Makefile b/FreeRTOS/Makefile new file mode 100644 index 0000000..e5df2a8 --- /dev/null +++ b/FreeRTOS/Makefile @@ -0,0 +1,30 @@ +TARGET_LIB = libFreeRTOS.a + +all: $(TARGET_LIB) + +include $(ROOTDIR)/common.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 + +include $(ROOTDIR)/target-rules.mk + +clean: clean-generic diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..4fedaf0 --- /dev/null +++ b/Makefile @@ -0,0 +1,21 @@ +export ROOTDIR = $(CURDIR) + +include $(ROOTDIR)/common.mk + +all: libs + +clean: + $(MAKE) -C FreeRTOS clean + $(MAKE) -C arch clean + + +.PHONY: libs FreeRTOS arch + +libs: FreeRTOS arch + +FreeRTOS: + $(MAKE) -C FreeRTOS + +arch: + $(MAKE) -C arch + diff --git a/common.mk b/common.mk new file mode 100644 index 0000000..94db4d1 --- /dev/null +++ b/common.mk @@ -0,0 +1,12 @@ +include $(ROOTDIR)/config/general.mk + +ifeq ($(VERBOSE),true) +E = @: +Q = +else +E = @echo +Q = @ +endif + +include $(ROOTDIR)/config/target.mk +include $(ROOTDIR)/config/toolchain.mk diff --git a/config/general.mk b/config/general.mk new file mode 100644 index 0000000..5d0ecca --- /dev/null +++ b/config/general.mk @@ -0,0 +1 @@ +VERBOSE = true diff --git a/config/target.mk b/config/target.mk new file mode 100644 index 0000000..2b3a3a2 --- /dev/null +++ b/config/target.mk @@ -0,0 +1,8 @@ +export BOARD = mbed +export USE_MPU = true + + +ifeq ($(BOARD),mbed) +export CPU = arm +export CPU_FLAVOR = lpc1768 +endif diff --git a/config/toolchain.mk b/config/toolchain.mk new file mode 100644 index 0000000..aeaee87 --- /dev/null +++ b/config/toolchain.mk @@ -0,0 +1,14 @@ +ifeq ($(CPU),arm) +TOOLCHAIN = arm-none-eabi +ifeq ($(CPU_FLAVOR),lpc1768) +TARGET_CPPFLAGS += -mcpu=cortex-m3 -mtune=cortex-m3 -D__thumb2__=1 -march=armv7-m -mfix-cortex-m3-ldrd +endif +TARGET_CPPFLAGS += -mthumb -Os -mapcs-frame -msoft-float -mno-sched-prolog -fno-hosted -ffunction-sections -fdata-sections +endif + +TARGET_CC = $(TOOLCHAIN)-gcc +TARGET_CXX = $(TOOLCHAIN)-g++ +TARGET_LD = $(TOOLCHAIN)-gcc +TARGET_RANLIB = $(TOOLCHAIN)-ranlib +TARGET_AR = $(TOOLCHAIN)-ar +TARGET_OBJCOPY = $(TOOLCHAIN)-objcopy diff --git a/target-rules.mk b/target-rules.mk new file mode 100644 index 0000000..b8311b5 --- /dev/null +++ b/target-rules.mk @@ -0,0 +1,14 @@ +%.o: %.c + $(E) [TC] Compiling $< + $(Q)$(TARGET_CC) $(addprefix -I, $(TARGET_INCLUDES)) $(TARGET_CPPFLAGS) -c -o $@ $< + +TARGET_OBJS = $(addsuffix .o, $(basename $(TARGET_SRCS))) + +$(TARGET_LIB): $(TARGET_OBJS) + $(E) [TLIB] Creating $@ + $(Q)$(TARGET_AR) rcs $@ $^ + +.PHONY: clean-generic + +clean-generic: + rm -f $(TARGET_LIB) $(TARGET_OBJS) -- cgit v1.2.3