1 # This file was automagically generated by mbed.org. For more information,
2 # see http://mbed.org/handbook/Exporting-to-GCC-ARM-Embedded
6 OBJECTS = {% for f in to_be_compiled %}{{f}} {% endfor %}
7 SYS_OBJECTS = {% for f in object_files %}{{f}} {% endfor %}
8 INCLUDE_PATHS = {% for p in include_paths %}-I{{p}} {% endfor %}
9 LIBRARY_PATHS = {% for p in library_paths %}-L{{p}} {% endfor %}
10 LIBRARIES = {% for lib in libraries %}-l{{lib}} {% endfor %}
11 LINKER_SCRIPT = {{linker_script}}
13 ###############################################################################
14 AS = $(GCC_BIN)arm-none-eabi-as
15 CC = $(GCC_BIN)arm-none-eabi-gcc
16 CPP = $(GCC_BIN)arm-none-eabi-g++
17 LD = $(GCC_BIN)arm-none-eabi-gcc
18 OBJCOPY = $(GCC_BIN)arm-none-eabi-objcopy
19 OBJDUMP = $(GCC_BIN)arm-none-eabi-objdump
20 SIZE = $(GCC_BIN)arm-none-eabi-size
22 CPU = -mcpu=cortex-m0plus -mthumb
23 CC_FLAGS = $(CPU) -c -g -fno-common -fmessage-length=0 -Wall -fno-exceptions -ffunction-sections -fdata-sections -fomit-frame-pointer
25 CC_SYMBOLS = {% for s in symbols %}-D{{s}} {% endfor %}
27 LD_FLAGS = $(CPU) -Wl,--gc-sections --specs=nano.specs -u _printf_float -u _scanf_float -Wl,--wrap,main
28 LD_FLAGS += -Wl,-Map=$(PROJECT).map,--cref
29 LD_SYS_LIBS = -lstdc++ -lsupc++ -lm -lc -lgcc -lnosys
32 CC_FLAGS += -DDEBUG -O0
34 CC_FLAGS += -DNDEBUG -Os
37 all: $(PROJECT).bin $(PROJECT).hex
40 rm -f $(PROJECT).bin $(PROJECT).elf $(PROJECT).hex $(PROJECT).map $(PROJECT).lst $(OBJECTS) $(DEPS)
46 $(CC) $(CC_FLAGS) $(CC_SYMBOLS) -std=gnu99 $(INCLUDE_PATHS) -o $@ $<
49 $(CPP) $(CC_FLAGS) $(CC_SYMBOLS) -std=gnu++98 -fno-rtti $(INCLUDE_PATHS) -o $@ $<
52 $(PROJECT).elf: $(OBJECTS) $(SYS_OBJECTS)
53 $(LD) $(LD_FLAGS) -T$(LINKER_SCRIPT) $(LIBRARY_PATHS) -o $@ $^ $(LIBRARIES) $(LD_SYS_LIBS) $(LIBRARIES) $(LD_SYS_LIBS)
56 $(PROJECT).bin: $(PROJECT).elf
57 @$(OBJCOPY) -O binary $< $@
59 $(PROJECT).hex: $(PROJECT).elf
60 @$(OBJCOPY) -O ihex $< $@
62 $(PROJECT).lst: $(PROJECT).elf
63 @$(OBJDUMP) -Sdh $< > $@
68 $(SIZE) $(PROJECT).elf
70 DEPS = $(OBJECTS:.o=.d) $(SYS_OBJECTS:.o=.d)