This commit is contained in:
hugogogo
2025-03-03 20:45:44 +01:00
parent 90c91a198e
commit 6b033a3352
5 changed files with 74 additions and 6 deletions

View File

@@ -8,12 +8,15 @@ AVRDUDE_MCU_TYPE = m328p
BAUD_RATE = 115200
SERIAL_PORT = /dev/ttyUSB0
PROGRAMMER_ID = arduino
DUMP_ORI = ../../ressources/dump_atmega328p_ori.hex
all: hex flash
hex: $(TARGET).hex
# https://gcc.gnu.org/onlinedocs/gcc/AVR-Options.html
$(TARGET).bin: $(TARGET).c
$(CC) -mmcu=$(AVRGCC_MCU_TYPE) -D F_CPU=$(F_CPU) $(TARGET).c -o $(TARGET).bin
@@ -29,12 +32,12 @@ flash:
avrdude -p $(AVRDUDE_MCU_TYPE) -c $(PROGRAMMER_ID) -b $(BAUD_RATE) -P $(SERIAL_PORT) -U flash:w:$(TARGET).hex
dump:
avrdude -p m328p -c arduino -b 115200 -P /dev/ttyUSB0 -U flash:r:dump_atmega328p.hex
restore:
avrdude -p $(AVRDUDE_MCU_TYPE) -c $(PROGRAMMER_ID) -b $(BAUD_RATE) -P $(SERIAL_PORT) -U flash:w:$(DUMP_ORI)
clean:
rm -f main.hex main.bin
.PHONY : all clean hex flash dump
.PHONY : all clean hex flash restore