|
| 1 | +# This file was automagically generated by mbed.org. For more information, |
| 2 | +# see http://mbed.org/handbook/Exporting-to-GCC-ARM-Embedded |
| 3 | + |
| 4 | +GCC_BIN = |
| 5 | +PROJECT = {{name}} |
| 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}} |
| 12 | + |
| 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 | + |
| 20 | +CPU = -mcpu=cortex-m0plus -mthumb |
| 21 | +CC_FLAGS = $(CPU) -c -Os -fno-common -fmessage-length=0 -Wall -fno-exceptions -ffunction-sections -fdata-sections |
| 22 | +CC_SYMBOLS = {% for s in symbols %}-D{{s}} {% endfor %} |
| 23 | + |
| 24 | +LD_FLAGS = -mcpu=cortex-m0plus -mthumb -Wl,--gc-sections --specs=nano.specs -u _printf_float -u _scanf_float |
| 25 | +LD_SYS_LIBS = -lstdc++ -lsupc++ -lm -lc -lgcc -lnosys |
| 26 | + |
| 27 | +all: $(PROJECT).bin |
| 28 | + |
| 29 | +clean: |
| 30 | + rm -f $(PROJECT).bin $(PROJECT).elf $(OBJECTS) |
| 31 | + |
| 32 | +.s.o: |
| 33 | + $(AS) $(CPU) -o $@ $< |
| 34 | + |
| 35 | +.c.o: |
| 36 | + $(CC) $(CC_FLAGS) $(CC_SYMBOLS) -std=gnu99 $(INCLUDE_PATHS) -o $@ $< |
| 37 | + |
| 38 | +.cpp.o: |
| 39 | + $(CPP) $(CC_FLAGS) $(CC_SYMBOLS) -std=gnu++98 $(INCLUDE_PATHS) -o $@ $< |
| 40 | + |
| 41 | + |
| 42 | +$(PROJECT).elf: $(OBJECTS) $(SYS_OBJECTS) |
| 43 | + $(LD) $(LD_FLAGS) -T$(LINKER_SCRIPT) $(LIBRARY_PATHS) -o $@ $^ $(LIBRARIES) $(LD_SYS_LIBS) $(LIBRARIES) $(LD_SYS_LIBS) |
| 44 | + |
| 45 | +$(PROJECT).bin: $(PROJECT).elf |
| 46 | + $(OBJCOPY) -O binary $< $@ |
0 commit comments