2014-12-04 04:00:25 +00:00
|
|
|
MCU=atmega32u4
|
|
|
|
|
|
|
|
F_CPU=16000000
|
|
|
|
|
|
|
|
TARGET=menelaus
|
|
|
|
|
2019-07-03 04:43:13 +00:00
|
|
|
USB=/dev/ttyACM0
|
2014-12-04 04:00:25 +00:00
|
|
|
|
|
|
|
build: $(TARGET).hex
|
|
|
|
|
|
|
|
upload: $(TARGET).hex
|
2019-07-03 04:43:13 +00:00
|
|
|
while [ ! -r $(USB) ]; do sleep 1; done; \
|
|
|
|
avrdude -p $(MCU) -c avr109 -U flash:w:$(TARGET).hex -P $(USB)
|
2014-12-04 04:00:25 +00:00
|
|
|
|
2019-07-02 03:01:10 +00:00
|
|
|
test: ; racket test.rkt
|
|
|
|
|
2019-07-03 01:11:04 +00:00
|
|
|
clean: ; -rm -f $(TARGET){,.hex} *.o *.elf *.s
|
|
|
|
|
|
|
|
count: ; cloc *.scm
|
2014-12-04 04:00:25 +00:00
|
|
|
|
|
|
|
$(TARGET).hex: $(TARGET).elf
|
|
|
|
avr-size $(TARGET).elf
|
|
|
|
avr-objcopy --output-target=ihex $(TARGET).elf $(TARGET).hex
|
|
|
|
|
|
|
|
%.s: %.scm
|
|
|
|
microscheme -m LEO $(TARGET).scm
|
|
|
|
|
|
|
|
%.elf: %.s usb_keyboard.s
|
|
|
|
avr-gcc -mmcu=$(MCU) -o $(TARGET).elf $(TARGET).s usb_keyboard.s
|
|
|
|
|
|
|
|
usb_keyboard.s: usb_keyboard.h usb_keyboard.c
|
|
|
|
avr-gcc -std=gnu99 -S -D F_CPU=$(F_CPU)UL -mmcu=$(MCU) -c \
|
|
|
|
-o usb_keyboard.s usb_keyboard.c
|
2019-07-02 03:01:10 +00:00
|
|
|
|
2019-07-03 01:11:04 +00:00
|
|
|
.PHONY: build upload test clean count
|