118 lines
7.4 KiB
Makefile
118 lines
7.4 KiB
Makefile
|
# This file was automagically generated by mbed.org. For more information,
|
||
|
# see http://mbed.org/handbook/Exporting-to-GCC-ARM-Embedded
|
||
|
|
||
|
# cross-platform directory manipulation
|
||
|
ifeq ($(shell echo $$OS),$$OS)
|
||
|
MAKEDIR = if not exist "$(1)" mkdir "$(1)"
|
||
|
RM = rmdir /S /Q "$(1)"
|
||
|
else
|
||
|
MAKEDIR = $(SHELL) -c "mkdir -p \"$(1)\""
|
||
|
RM = $(SHELL) -c "rm -rf \"$(1)\""
|
||
|
endif
|
||
|
|
||
|
ifeq (,$(filter .build,$(notdir $(CURDIR))))
|
||
|
.SUFFIXES:
|
||
|
OBJDIR := .build
|
||
|
mkfile_path := $(abspath $(lastword $(MAKEFILE_LIST)))
|
||
|
MAKETARGET = $(MAKE) --no-print-directory -C $(OBJDIR) -f $(mkfile_path) \
|
||
|
SRCDIR=$(CURDIR) $(MAKECMDGOALS)
|
||
|
.PHONY: $(OBJDIR) clean
|
||
|
all:
|
||
|
+@$(call MAKEDIR,$(OBJDIR))
|
||
|
+@$(MAKETARGET)
|
||
|
$(OBJDIR): all
|
||
|
Makefile : ;
|
||
|
% :: $(OBJDIR) ; :
|
||
|
clean :
|
||
|
$(call RM,$(OBJDIR))
|
||
|
|
||
|
else
|
||
|
|
||
|
VPATH = ..
|
||
|
|
||
|
GCC_BIN =
|
||
|
PROJECT = mbed_blinky
|
||
|
OBJECTS = src/main.o
|
||
|
SYS_OBJECTS = mbed/TARGET_LPC1768/TOOLCHAIN_GCC_ARM/analogin_api.o mbed/TARGET_LPC1768/TOOLCHAIN_GCC_ARM/analogout_api.o mbed/TARGET_LPC1768/TOOLCHAIN_GCC_ARM/can_api.o mbed/TARGET_LPC1768/TOOLCHAIN_GCC_ARM/cmsis_nvic.o mbed/TARGET_LPC1768/TOOLCHAIN_GCC_ARM/ethernet_api.o mbed/TARGET_LPC1768/TOOLCHAIN_GCC_ARM/gpio_api.o mbed/TARGET_LPC1768/TOOLCHAIN_GCC_ARM/gpio_irq_api.o mbed/TARGET_LPC1768/TOOLCHAIN_GCC_ARM/i2c_api.o mbed/TARGET_LPC1768/TOOLCHAIN_GCC_ARM/mbed_board.o mbed/TARGET_LPC1768/TOOLCHAIN_GCC_ARM/pinmap.o mbed/TARGET_LPC1768/TOOLCHAIN_GCC_ARM/port_api.o mbed/TARGET_LPC1768/TOOLCHAIN_GCC_ARM/pwmout_api.o mbed/TARGET_LPC1768/TOOLCHAIN_GCC_ARM/retarget.o mbed/TARGET_LPC1768/TOOLCHAIN_GCC_ARM/rtc_api.o mbed/TARGET_LPC1768/TOOLCHAIN_GCC_ARM/serial_api.o mbed/TARGET_LPC1768/TOOLCHAIN_GCC_ARM/sleep.o mbed/TARGET_LPC1768/TOOLCHAIN_GCC_ARM/spi_api.o mbed/TARGET_LPC1768/TOOLCHAIN_GCC_ARM/startup_LPC17xx.o mbed/TARGET_LPC1768/TOOLCHAIN_GCC_ARM/system_LPC17xx.o mbed/TARGET_LPC1768/TOOLCHAIN_GCC_ARM/us_ticker.o
|
||
|
INCLUDE_PATHS = -I../. -I../src -I../mbed/. -I../mbed/TARGET_LPC1768 -I../mbed/TARGET_LPC1768/TARGET_NXP -I../mbed/TARGET_LPC1768/TARGET_NXP/TARGET_LPC176X -I../mbed/TARGET_LPC1768/TARGET_NXP/TARGET_LPC176X/TARGET_MBED_LPC1768 -I../mbed/TARGET_LPC1768/TARGET_NXP/TARGET_LPC176X/device -I../mbed/TARGET_LPC1768/TOOLCHAIN_GCC_ARM -I../mbed/drivers -I../mbed/hal -I../mbed/platform
|
||
|
LIBRARY_PATHS = -L../mbed/TARGET_LPC1768/TOOLCHAIN_GCC_ARM
|
||
|
LIBRARIES = -lmbed
|
||
|
LINKER_SCRIPT = ../mbed/TARGET_LPC1768/TOOLCHAIN_GCC_ARM/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
|
||
|
OBJDUMP = $(GCC_BIN)arm-none-eabi-objdump
|
||
|
SIZE = $(GCC_BIN)arm-none-eabi-size
|
||
|
|
||
|
|
||
|
CPU = -mcpu=cortex-m3 -mthumb
|
||
|
CC_FLAGS = -c -Wall -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -fmessage-length=0 -fno-exceptions -fno-builtin -ffunction-sections -fdata-sections -funsigned-char -MMD -fno-delete-null-pointer-checks -fomit-frame-pointer -mcpu=cortex-m3 -mthumb -Os -std=gnu99 -DDEVICE_ERROR_PATTERN=1 -D__MBED__=1 -DDEVICE_I2CSLAVE=1 -DTARGET_LIKE_MBED -DDEVICE_PORTOUT=1 -DTARGET_NXP -DTARGET_LPC176X -DDEVICE_PORTIN=1 -DDEVICE_RTC=1 -DTOOLCHAIN_object -D__CMSIS_RTOS -DTOOLCHAIN_GCC -DDEVICE_CAN=1 -DTARGET_LIKE_CORTEX_M3 -DTARGET_CORTEX_M -DARM_MATH_CM3 -DDEVICE_ANALOGOUT=1 -DTARGET_UVISOR_UNSUPPORTED -DTARGET_M3 -DDEVICE_PWMOUT=1 -DDEVICE_INTERRUPTIN=1 -DDEVICE_I2C=1 -DMBED_BUILD_TIMESTAMP=1483402623.08 -D__CORTEX_M3 -DDEVICE_STDIO_MESSAGES=1 -DTARGET_LPC1768 -DTARGET_RELEASE -DDEVICE_PORTINOUT=1 -DDEVICE_SERIAL_FC=1 -DTARGET_MBED_LPC1768 -D__MBED_CMSIS_RTOS_CM -DDEVICE_SLEEP=1 -DTOOLCHAIN_GCC_ARM -DDEVICE_SPI=1 -DDEVICE_ETHERNET=1 -DDEVICE_SPISLAVE=1 -DDEVICE_ANALOGIN=1 -DDEVICE_SERIAL=1 -DDEVICE_SEMIHOST=1 -DDEVICE_DEBUG_AWARENESS=1 -DDEVICE_LOCALFILESYSTEM=1 -include mbed_config.h -MMD -MP
|
||
|
CPPC_FLAGS = -c -Wall -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -fmessage-length=0 -fno-exceptions -fno-builtin -ffunction-sections -fdata-sections -funsigned-char -MMD -fno-delete-null-pointer-checks -fomit-frame-pointer -mcpu=cortex-m3 -mthumb -Os -std=gnu++98 -fno-rtti -Wvla -DDEVICE_ERROR_PATTERN=1 -D__MBED__=1 -DDEVICE_I2CSLAVE=1 -DTARGET_LIKE_MBED -DDEVICE_PORTOUT=1 -DTARGET_NXP -DTARGET_LPC176X -DDEVICE_PORTIN=1 -DDEVICE_RTC=1 -DTOOLCHAIN_object -D__CMSIS_RTOS -DTOOLCHAIN_GCC -DDEVICE_CAN=1 -DTARGET_LIKE_CORTEX_M3 -DTARGET_CORTEX_M -DARM_MATH_CM3 -DDEVICE_ANALOGOUT=1 -DTARGET_UVISOR_UNSUPPORTED -DTARGET_M3 -DDEVICE_PWMOUT=1 -DDEVICE_INTERRUPTIN=1 -DDEVICE_I2C=1 -DMBED_BUILD_TIMESTAMP=1483402623.08 -D__CORTEX_M3 -DDEVICE_STDIO_MESSAGES=1 -DTARGET_LPC1768 -DTARGET_RELEASE -DDEVICE_PORTINOUT=1 -DDEVICE_SERIAL_FC=1 -DTARGET_MBED_LPC1768 -D__MBED_CMSIS_RTOS_CM -DDEVICE_SLEEP=1 -DTOOLCHAIN_GCC_ARM -DDEVICE_SPI=1 -DDEVICE_ETHERNET=1 -DDEVICE_SPISLAVE=1 -DDEVICE_ANALOGIN=1 -DDEVICE_SERIAL=1 -DDEVICE_SEMIHOST=1 -DDEVICE_DEBUG_AWARENESS=1 -DDEVICE_LOCALFILESYSTEM=1 -include mbed_config.h -MMD -MP
|
||
|
ASM_FLAGS = -x assembler-with-cpp -D__CMSIS_RTOS -D__MBED_CMSIS_RTOS_CM -D__CORTEX_M3 -DARM_MATH_CM3 -c -Wall -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -fmessage-length=0 -fno-exceptions -fno-builtin -ffunction-sections -fdata-sections -funsigned-char -MMD -fno-delete-null-pointer-checks -fomit-frame-pointer -mcpu=cortex-m3 -mthumb -Os
|
||
|
CC_SYMBOLS = -DDEVICE_ERROR_PATTERN=1 -D__MBED__=1 -DDEVICE_I2CSLAVE=1 -DTARGET_LIKE_MBED -DDEVICE_PORTOUT=1 -DTARGET_NXP -DTARGET_LPC176X -DDEVICE_PORTIN=1 -DDEVICE_RTC=1 -DTOOLCHAIN_object -D__CMSIS_RTOS -DTOOLCHAIN_GCC -DDEVICE_CAN=1 -DTARGET_LIKE_CORTEX_M3 -DTARGET_CORTEX_M -DARM_MATH_CM3 -DDEVICE_ANALOGOUT=1 -DTARGET_UVISOR_UNSUPPORTED -DTARGET_M3 -DDEVICE_PWMOUT=1 -DDEVICE_INTERRUPTIN=1 -DDEVICE_I2C=1 -DMBED_BUILD_TIMESTAMP=1483402623.08 -D__CORTEX_M3 -DDEVICE_STDIO_MESSAGES=1 -DTARGET_LPC1768 -DTARGET_RELEASE -DDEVICE_PORTINOUT=1 -DDEVICE_SERIAL_FC=1 -DTARGET_MBED_LPC1768 -D__MBED_CMSIS_RTOS_CM -DDEVICE_SLEEP=1 -DTOOLCHAIN_GCC_ARM -DDEVICE_SPI=1 -DDEVICE_ETHERNET=1 -DDEVICE_SPISLAVE=1 -DDEVICE_ANALOGIN=1 -DDEVICE_SERIAL=1 -DDEVICE_SEMIHOST=1 -DDEVICE_DEBUG_AWARENESS=1 -DDEVICE_LOCALFILESYSTEM=1
|
||
|
|
||
|
LD_FLAGS =-Wl,--gc-sections -Wl,--wrap,main -Wl,--wrap,_malloc_r -Wl,--wrap,_free_r -Wl,--wrap,_realloc_r -Wl,--wrap,_calloc_r -mcpu=cortex-m3 -mthumb
|
||
|
LD_SYS_LIBS = -lstdc++ -lsupc++ -lm -lc -lgcc -lnosys
|
||
|
|
||
|
|
||
|
ifeq ($(DEBUG), 1)
|
||
|
CC_FLAGS += -DDEBUG -O0
|
||
|
else
|
||
|
CC_FLAGS += -DNDEBUG -Os
|
||
|
endif
|
||
|
|
||
|
|
||
|
.PHONY: all lst size
|
||
|
|
||
|
all: $(PROJECT).bin $(PROJECT).hex size
|
||
|
|
||
|
|
||
|
|
||
|
.asm.o:
|
||
|
+@$(call MAKEDIR,$(dir $@))
|
||
|
$(CC) $(CPU) -c $(ASM_FLAGS) $(CC_SYMBOLS) $(INCLUDE_PATHS) -o $@ $<
|
||
|
.s.o:
|
||
|
+@$(call MAKEDIR,$(dir $@))
|
||
|
$(CC) $(CPU) -c $(ASM_FLAGS) $(CC_SYMBOLS) $(INCLUDE_PATHS) -o $@ $<
|
||
|
.S.o:
|
||
|
+@$(call MAKEDIR,$(dir $@))
|
||
|
$(CC) $(CPU) -c $(ASM_FLAGS) $(CC_SYMBOLS) $(INCLUDE_PATHS) -o $@ $<
|
||
|
|
||
|
.c.o:
|
||
|
+@$(call MAKEDIR,$(dir $@))
|
||
|
$(CC) $(CC_FLAGS) $(CC_SYMBOLS) $(INCLUDE_PATHS) -o $@ $<
|
||
|
|
||
|
.cpp.o:
|
||
|
+@$(call MAKEDIR,$(dir $@))
|
||
|
$(CPP) $(CPPC_FLAGS) $(CC_SYMBOLS) $(INCLUDE_PATHS) -o $@ $<
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
$(PROJECT).elf: $(OBJECTS) $(SYS_OBJECTS) $(LINKER_SCRIPT)
|
||
|
$(LD) $(LD_FLAGS) -T$(filter %.ld, $^) $(LIBRARY_PATHS) -o $@ $(filter %.o, $^) -Wl,--start-group $(LIBRARIES) $(LD_SYS_LIBS) -Wl,--end-group
|
||
|
|
||
|
$(PROJECT).bin: $(PROJECT).elf
|
||
|
$(OBJCOPY) -O binary $< $@
|
||
|
|
||
|
$(PROJECT).hex: $(PROJECT).elf
|
||
|
@$(OBJCOPY) -O ihex $< $@
|
||
|
|
||
|
$(PROJECT).lst: $(PROJECT).elf
|
||
|
@$(OBJDUMP) -Sdh $< > $@
|
||
|
|
||
|
lst: $(PROJECT).lst
|
||
|
|
||
|
size: $(PROJECT).elf
|
||
|
$(SIZE) $(PROJECT).elf
|
||
|
|
||
|
DEPS = $(OBJECTS:.o=.d) $(SYS_OBJECTS:.o=.d)
|
||
|
-include $(DEPS)
|
||
|
|
||
|
|
||
|
endif
|