Skip to content

Commit c437f86

Browse files
committed
Adding a few makefiles.
1 parent 598e538 commit c437f86

File tree

7 files changed

+100
-0
lines changed

7 files changed

+100
-0
lines changed

FreeRTOS/Makefile

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
TARGET_LIB = libFreeRTOS.a
2+
3+
all: $(TARGET_LIB)
4+
5+
include $(ROOTDIR)/common.mk
6+
7+
ifeq ($(USE_MPU),true)
8+
TARGET_CPPFLAGS += -DportUSING_MPU_WRAPPERS=1
9+
endif
10+
11+
TARGET_SRCS = Source/croutine.c Source/list.c Source/queue.c Source/tasks.c
12+
TARGET_INCLUDES = Source/include
13+
14+
ifeq ($(CPU),arm)
15+
ifeq ($(CPU_FLAVOR),lpc1768)
16+
TARGET_SRCS += Source/portable/MemMang/heap_3.c
17+
TARGET_INCLUDES += $(ROOTDIR)/config/arm/lpc1768 $(ROOTDIR)/arch/arm/lpc17xx/Core/CM3/DeviceSupport/NXP/LPC17xx $(ROOTDIR)/arch/arm/lpc17xx/Core/CM3/CoreSupport
18+
ifeq ($(USE_MPU),true)
19+
TARGET_SRCS += Source/portable/GCC/ARM_CM3_MPU/port.c
20+
TARGET_INCLUDES += Source/portable/GCC/ARM_CM3_MPU
21+
else
22+
TARGET_SRCS += Source/portable/GCC/ARM_CM3/port.c
23+
TARGET_INCLUDES += Source/portable/GCC/ARM_CM3
24+
endif
25+
endif
26+
endif
27+
28+
include $(ROOTDIR)/target-rules.mk
29+
30+
clean: clean-generic

Makefile

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
export ROOTDIR = $(CURDIR)
2+
3+
include $(ROOTDIR)/common.mk
4+
5+
all: libs
6+
7+
clean:
8+
$(MAKE) -C FreeRTOS clean
9+
$(MAKE) -C arch clean
10+
11+
12+
.PHONY: libs FreeRTOS arch
13+
14+
libs: FreeRTOS arch
15+
16+
FreeRTOS:
17+
$(MAKE) -C FreeRTOS
18+
19+
arch:
20+
$(MAKE) -C arch
21+

common.mk

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
include $(ROOTDIR)/config/general.mk
2+
3+
ifeq ($(VERBOSE),true)
4+
E = @:
5+
Q =
6+
else
7+
E = @echo
8+
Q = @
9+
endif
10+
11+
include $(ROOTDIR)/config/target.mk
12+
include $(ROOTDIR)/config/toolchain.mk

config/general.mk

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
VERBOSE = true

config/target.mk

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
export BOARD = mbed
2+
export USE_MPU = true
3+
4+
5+
ifeq ($(BOARD),mbed)
6+
export CPU = arm
7+
export CPU_FLAVOR = lpc1768
8+
endif

config/toolchain.mk

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
ifeq ($(CPU),arm)
2+
TOOLCHAIN = arm-none-eabi
3+
ifeq ($(CPU_FLAVOR),lpc1768)
4+
TARGET_CPPFLAGS += -mcpu=cortex-m3 -mtune=cortex-m3 -D__thumb2__=1 -march=armv7-m -mfix-cortex-m3-ldrd
5+
endif
6+
TARGET_CPPFLAGS += -mthumb -Os -mapcs-frame -msoft-float -mno-sched-prolog -fno-hosted -ffunction-sections -fdata-sections
7+
endif
8+
9+
TARGET_CC = $(TOOLCHAIN)-gcc
10+
TARGET_CXX = $(TOOLCHAIN)-g++
11+
TARGET_LD = $(TOOLCHAIN)-gcc
12+
TARGET_RANLIB = $(TOOLCHAIN)-ranlib
13+
TARGET_AR = $(TOOLCHAIN)-ar
14+
TARGET_OBJCOPY = $(TOOLCHAIN)-objcopy

target-rules.mk

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
%.o: %.c
2+
$(E) [TC] Compiling $<
3+
$(Q)$(TARGET_CC) $(addprefix -I, $(TARGET_INCLUDES)) $(TARGET_CPPFLAGS) -c -o $@ $<
4+
5+
TARGET_OBJS = $(addsuffix .o, $(basename $(TARGET_SRCS)))
6+
7+
$(TARGET_LIB): $(TARGET_OBJS)
8+
$(E) [TLIB] Creating $@
9+
$(Q)$(TARGET_AR) rcs $@ $^
10+
11+
.PHONY: clean-generic
12+
13+
clean-generic:
14+
rm -f $(TARGET_LIB) $(TARGET_OBJS)

0 commit comments

Comments
 (0)