aboutsummaryrefslogtreecommitdiffstats
path: root/src/lpc176x/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'src/lpc176x/Makefile')
-rw-r--r--src/lpc176x/Makefile15
1 files changed, 7 insertions, 8 deletions
diff --git a/src/lpc176x/Makefile b/src/lpc176x/Makefile
index 406a6d97..ae15f880 100644
--- a/src/lpc176x/Makefile
+++ b/src/lpc176x/Makefile
@@ -9,9 +9,6 @@ dirs-y += lib/lpc176x/device/TOOLCHAIN_GCC_ARM
CFLAGS += -mthumb -mcpu=cortex-m3
CFLAGS += -Ilib/lpc176x/device -Ilib/cmsis-core
-CFLAGS_klipper.elf += -T $(OUT)LPC1768.ld
-CFLAGS_klipper.elf += --specs=nano.specs --specs=nosys.specs
-
# Add source files
src-y += lpc176x/main.c lpc176x/gpio.c
src-$(CONFIG_HAVE_GPIO_ADC) += lpc176x/adc.c
@@ -23,21 +20,23 @@ src-y += ../lib/lpc176x/device/system_LPC17xx.c
src-$(CONFIG_USBSERIAL) += lpc176x/usbserial.c generic/usb_cdc.c
src-$(CONFIG_SERIAL) += lpc176x/serial.c generic/serial_irq.c
-# Add the TOOLCHAIN_GCC_ARM files to the build
+# Add assembler build rules
$(OUT)%.o: %.S
@echo " Assembling $@"
$(Q)$(AS) $< -o $@
asmsrc-y := ../lib/lpc176x/device/TOOLCHAIN_GCC_ARM/startup_LPC17xx.S
+OBJS_klipper.elf += $(patsubst %.S, $(OUT)src/%.o,$(asmsrc-y))
-$(OUT)klipper.elf: $(patsubst %.S, $(OUT)src/%.o,$(asmsrc-y))
-
-target-y := $(OUT)LPC1768.ld $(target-y)
-
+# Build the linker script
$(OUT)LPC1768.ld: lib/lpc176x/device/TOOLCHAIN_GCC_ARM/LPC1768.ld $(OUT)board-link
@echo " Preprocessing $@"
$(Q)$(CPP) -P -MD -MT $@ -DMBED_APP_START=$(CONFIG_FLASH_START) -DMBED_APP_SIZE="(512K - $(CONFIG_FLASH_START))" $< -o $@
+CFLAGS_klipper.elf += -T $(OUT)LPC1768.ld
+CFLAGS_klipper.elf += --specs=nano.specs --specs=nosys.specs
+$(OUT)klipper.elf : $(OUT)LPC1768.ld
+
# Build the additional bin output file
target-y += $(OUT)klipper.bin