2016-06-14 21:27:30 +03:00
|
|
|
# Additional sam3x8e build rules
|
|
|
|
|
|
|
|
# Setup the toolchain
|
|
|
|
CROSS_PREFIX=arm-none-eabi-
|
|
|
|
|
|
|
|
dirs-y += src/sam3x8e src/generic
|
2018-07-31 17:58:57 +03:00
|
|
|
dirs-y += lib/sam3x/gcc/gcc
|
2016-06-14 21:27:30 +03:00
|
|
|
|
2017-05-07 23:51:46 +03:00
|
|
|
CFLAGS += -mthumb -mcpu=cortex-m3
|
2018-07-31 17:58:57 +03:00
|
|
|
CFLAGS += -Ilib/sam3x/include -Ilib/cmsis-core
|
2017-05-07 23:51:46 +03:00
|
|
|
CFLAGS += -D__SAM3X8E__
|
2016-06-14 21:27:30 +03:00
|
|
|
|
2018-07-31 17:58:57 +03:00
|
|
|
CFLAGS_klipper.elf += -Llib/sam3x/gcc/gcc
|
|
|
|
CFLAGS_klipper.elf += -T lib/sam3x/gcc/gcc/sam3x8e_flash.ld
|
2017-05-07 23:51:46 +03:00
|
|
|
CFLAGS_klipper.elf += --specs=nano.specs --specs=nosys.specs
|
2016-06-14 21:27:30 +03:00
|
|
|
|
|
|
|
# Add source files
|
2018-05-04 19:47:26 +03:00
|
|
|
src-y += sam3x8e/main.c sam3x8e/timer.c sam3x8e/gpio.c sam3x8e/spi.c
|
2017-05-07 05:29:08 +03:00
|
|
|
src-y += generic/crc16_ccitt.c generic/alloc.c
|
|
|
|
src-y += generic/armcm_irq.c generic/timer_irq.c
|
2018-07-31 17:58:57 +03:00
|
|
|
src-y += ../lib/sam3x/gcc/system_sam3xa.c
|
|
|
|
src-y += ../lib/sam3x/gcc/gcc/startup_sam3xa.c
|
2018-04-13 01:04:00 +03:00
|
|
|
src-$(CONFIG_SERIAL) += sam3x8e/serial.c generic/serial_irq.c
|
2016-06-14 21:27:30 +03:00
|
|
|
|
|
|
|
# Build the additional hex output file
|
|
|
|
target-y += $(OUT)klipper.bin
|
|
|
|
|
|
|
|
$(OUT)klipper.bin: $(OUT)klipper.elf
|
|
|
|
@echo " Creating hex file $@"
|
|
|
|
$(Q)$(OBJCOPY) -O binary $< $@
|
2017-04-21 18:01:07 +03:00
|
|
|
|
|
|
|
flash: $(OUT)klipper.bin
|
2017-12-12 01:28:59 +03:00
|
|
|
@echo " Flashing $^ to $(FLASH_DEVICE) via bossac"
|
2017-04-21 18:01:07 +03:00
|
|
|
$(Q)stty -F "$(FLASH_DEVICE)" 1200
|
|
|
|
$(Q)bossac -i -p "$(FLASH_DEVICE:/dev/%=%)" -R -e -w -v -b $(OUT)klipper.bin
|