forked from microflo/microflo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile.mbed
51 lines (38 loc) · 1.81 KB
/
Makefile.mbed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# This file was automagically generated by mbed.org. For more information,
# see http://mbed.org/handbook/Exporting-to-GCC-ARM-Embedded
ROOT_DIR:=./
SOURCE_DIR:=$(ROOT_DIR)/microflo
MBED_DIR:=$(ROOT_DIR)/thirdparty/mbed/build/mbed
MBED_OBJDIR=$(MBED_DIR)/TARGET_LPC1768/TOOLCHAIN_GCC_ARM
GCC_BIN =
PROJECT = firmware
OBJECTS = ./main.o
SYS_OBJECTS = $(MBED_OBJDIR)/cmsis_nvic.o $(MBED_OBJDIR)/system_LPC17xx.o $(MBED_OBJDIR)/startup_LPC17xx.o $(MBED_OBJDIR)/retarget.o
INCLUDE_PATHS = -I. -I$(SOURCE_DIR) -I$(MBED_DIR) -I$(MBED_DIR)/TARGET_LPC1768 -I$(MBED_OBJDIR)
LIBRARY_PATHS = -L$(MBED_OBJDIR)
LIBRARIES = -lmbed
LINKER_SCRIPT = ./$(MBED_OBJDIR)/LPC1768.ld
###############################################################################
AS = $(GCC_BIN)arm-none-eabi-as
CC = $(GCC_BIN)arm-none-eabi-gcc
CPP = $(GCC_BIN)arm-none-eabi-g++
LD = $(GCC_BIN)arm-none-eabi-gcc
OBJCOPY = $(GCC_BIN)arm-none-eabi-objcopy
CPU = -mcpu=cortex-m3 -mthumb
CC_FLAGS = $(CPU) -c -Os -fno-common -fmessage-length=0 -Wall -fno-exceptions -ffunction-sections -fdata-sections
CC_SYMBOLS = -DTARGET_LPC1768 -DTARGET_M3 -DTARGET_NXP -DTARGET_LPC176X -DTOOLCHAIN_GCC_ARM -DTOOLCHAIN_GCC -D__CORTEX_M3 -DARM_MATH_CM3
LD_FLAGS = -mcpu=cortex-m3 -mthumb -Wl,--gc-sections --specs=nano.specs -u _printf_float -u _scanf_float
LD_SYS_LIBS = -lstdc++ -lsupc++ -lm -lc -lgcc -lnosys
all: $(PROJECT).bin
clean:
rm -f $(PROJECT).bin $(PROJECT).elf $(OBJECTS)
.s.o:
$(AS) $(CPU) -o $@ $<
.c.o:
$(CC) $(CC_FLAGS) $(CC_SYMBOLS) -std=gnu99 $(INCLUDE_PATHS) -o $@ $<
.cpp.o:
$(CPP) $(CC_FLAGS) $(CC_SYMBOLS) -std=gnu++98 $(INCLUDE_PATHS) -o $@ $<
$(PROJECT).elf: $(OBJECTS) $(SYS_OBJECTS)
$(LD) $(LD_FLAGS) -T$(LINKER_SCRIPT) $(LIBRARY_PATHS) -o $@ $^ $(LIBRARIES) $(LD_SYS_LIBS)
$(PROJECT).bin: $(PROJECT).elf
$(OBJCOPY) -O binary $< $@