aboutsummaryrefslogtreecommitdiff
path: root/zumo/makefile
diff options
context:
space:
mode:
authorlonkaars <loek@pipeframe.xyz>2023-04-25 19:48:52 +0200
committerlonkaars <loek@pipeframe.xyz>2023-04-25 19:48:52 +0200
commit3a5c0f9bc2f9049114228e472826e31423dc5263 (patch)
treefe659f30cb5da82497e46184b837abafdb72cad4 /zumo/makefile
pololu blink build system working
Diffstat (limited to 'zumo/makefile')
-rw-r--r--zumo/makefile40
1 files changed, 40 insertions, 0 deletions
diff --git a/zumo/makefile b/zumo/makefile
new file mode 100644
index 0000000..aac11f4
--- /dev/null
+++ b/zumo/makefile
@@ -0,0 +1,40 @@
+PORT = /dev/ttyUSB0
+
+CC = avr-gcc
+LD = avr-ld
+RM = rm -f
+
+MCU=atmega32u4
+
+CFLAGS += -mcall-prologues
+CFLAGS += -mmcu=$(MCU)
+CFLAGS += -Os
+CFLAGS += -g
+CFLAGS += -Wl,-gc-sections
+CFLAGS += -Wl,-relax
+
+TARGET = main
+SRCS += main.c
+OBJS := $(patsubst %.c,%.o, $(SRCS))
+
+.PHONY: all clean flash
+
+all: $(TARGET).hex
+
+%.o: %.c
+ $(CC) -c $(CFLAGS) $< -o $@
+
+$(TARGET): $(OBJS)
+ $(LD) $^ $(LFLAGS) -o $@
+
+$(TARGET).hex: $(TARGET)
+ avr-objcopy -R .eeprom -O ihex $< $@
+
+flash: $(TARGET).hex
+ avrdude -p $(MCU) -c avr109 -P $(PORT) -U flash:w:$(TARGET).hex
+
+clean:
+ $(RM) $(TARGET) $(TARGET).hex $(OBJS)
+
+compile_commands.json: makefile
+ compiledb make -Bn