2022-03-03 03:18:52 +01:00
|
|
|
[env]
|
|
|
|
MCU = "atmega328p"
|
|
|
|
PROGRAMMER = "usbasp"
|
|
|
|
EXTENDED_FUSE = "0xFF"
|
|
|
|
HIGH_FUSE = "0xD6"
|
|
|
|
LOW_FUSE = "0xE2"
|
|
|
|
|
|
|
|
[tasks.size]
|
|
|
|
description = "Print usage of memory segments"
|
|
|
|
dependencies = ["build"]
|
|
|
|
command = "avr-size"
|
|
|
|
args = ["--format=avr", "--mcu=${MCU}", "target/avr-atmega328p/debug/clock-generator.elf"]
|
|
|
|
|
|
|
|
[tasks.copy_flash]
|
2022-03-08 14:42:04 +01:00
|
|
|
description = "Extract the flash"
|
2022-03-03 03:18:52 +01:00
|
|
|
dependencies = ["build"]
|
|
|
|
command = "avr-objcopy"
|
|
|
|
args = ["-O", "ihex", "-j", ".text", "-j", ".data", "target/avr-atmega328p/debug/clock-generator.elf", "target/avr-atmega328p/debug/clock-generator.hex"]
|
|
|
|
|
|
|
|
[tasks.flash]
|
|
|
|
description = "Flash the firmware"
|
|
|
|
dependencies = ["copy_flash", "size"]
|
|
|
|
command = "avrdude"
|
|
|
|
args = ["-p", "${MCU}", "-c", "${PROGRAMMER}", "-U", "flash:w:target/avr-atmega328p/debug/clock-generator.hex:a"]
|
|
|
|
|
2022-03-08 14:42:04 +01:00
|
|
|
[tasks.copy_eeprom]
|
|
|
|
description = "Extract the EEPROM"
|
|
|
|
dependencies = ["build"]
|
|
|
|
command = "avr-objcopy"
|
|
|
|
args = ["--change-section-lma", ".eeprom=0", "-O", "ihex", "-j", ".eeprom", "target/avr-atmega328p/debug/clock-generator.elf", "target/avr-atmega328p/debug/clock-generator.eep"]
|
|
|
|
|
|
|
|
[tasks.eeprom]
|
|
|
|
description = "Flash the eeprom"
|
|
|
|
dependencies = ["copy_eeprom", "size"]
|
|
|
|
command = "avrdude"
|
|
|
|
args = ["-p", "${MCU}", "-c", "${PROGRAMMER}", "-U", "eeprom:w:target/avr-atmega328p/debug/clock-generator.eep:a"]
|
|
|
|
|
2022-03-03 03:18:52 +01:00
|
|
|
[tasks.fuses]
|
|
|
|
description = "Burn the fuses"
|
|
|
|
command = "avrdude"
|
|
|
|
args = ["-p", "${MCU}", "-c", "${PROGRAMMER}", "-U", "efuse:w:${EXTENDED_FUSE}:m", "-U", "hfuse:w:${HIGH_FUSE}:m", "-U", "lfuse:w:${LOW_FUSE}:m"]
|