aboutsummaryrefslogtreecommitdiffstats
path: root/src/avr/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'src/avr/Makefile')
-rw-r--r--src/avr/Makefile19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/avr/Makefile b/src/avr/Makefile
new file mode 100644
index 00000000..758443da
--- /dev/null
+++ b/src/avr/Makefile
@@ -0,0 +1,19 @@
+# Additional avr build rules
+
+# Use the avr toolchain
+CROSS_PREFIX=avr-
+
+CFLAGS-y += -mmcu=$(CONFIG_MCU) -DF_CPU=$(CONFIG_CLOCK_FREQ)
+LDFLAGS-y += -Wl,--relax
+
+# Add avr source files
+src-y += avr/main.c avr/timer.c avr/gpio.c avr/alloc.c
+src-$(CONFIG_AVR_WATCHDOG) += avr/watchdog.c
+src-$(CONFIG_AVR_SERIAL) += avr/serial.c
+
+# Build the additional hex output file
+target-y += $(OUT)klipper.elf.hex
+
+$(OUT)klipper.elf.hex: $(OUT)klipper.elf
+ @echo " Creating hex file $@"
+ $(Q)$(OBJCOPY) -j .text -j .data -O ihex $< $@