105 lines
3.8 KiB
TOML
105 lines
3.8 KiB
TOML
[env]
|
|
MCU = "atmega328p"
|
|
PROGRAMMER = "usbasp"
|
|
EXTENDED_FUSE = "0xFF"
|
|
HIGH_FUSE = "0xD6"
|
|
LOW_FUSE = "0xE2"
|
|
|
|
[tasks.size]
|
|
run_task = [
|
|
{ name = "size-development", condition = { profiles = [ "development" ] } },
|
|
{ name = "size-release", condition = { profiles = [ "release" ] } },
|
|
]
|
|
|
|
[tasks.size-development]
|
|
description = "Print usage of memory segments"
|
|
dependencies = ["build"]
|
|
command = "avr-size"
|
|
args = ["--format=avr", "--mcu=${MCU}", "target/avr-atmega328p/debug/clock-generator.elf"]
|
|
|
|
[tasks.size-release]
|
|
description = "Print usage of memory segments"
|
|
dependencies = ["build"]
|
|
command = "avr-size"
|
|
args = ["--format=avr", "--mcu=${MCU}", "target/avr-atmega328p/release/clock-generator.elf"]
|
|
|
|
[tasks.copy_flash]
|
|
run_task = [
|
|
{ name = "copy_flash-development", condition = { profiles = [ "development" ] } },
|
|
{ name = "copy_flash-release", condition = { profiles = [ "release" ] } },
|
|
]
|
|
|
|
[tasks.copy_flash-development]
|
|
description = "Extract the flash"
|
|
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.copy_flash-release]
|
|
description = "Extract the flash"
|
|
dependencies = ["build"]
|
|
command = "avr-objcopy"
|
|
args = ["-O", "ihex", "-j", ".text", "-j", ".data", "target/avr-atmega328p/release/clock-generator.elf", "target/avr-atmega328p/release/clock-generator.hex"]
|
|
|
|
[tasks.flash]
|
|
run_task = [
|
|
{ name = "flash-development", condition = { profiles = [ "development" ] } },
|
|
{ name = "flash-release", condition = { profiles = [ "release" ] } },
|
|
]
|
|
|
|
[tasks.flash-development]
|
|
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"]
|
|
|
|
[tasks.flash-release]
|
|
description = "Flash the firmware"
|
|
dependencies = ["copy_flash", "size-release"]
|
|
command = "avrdude"
|
|
args = ["-p", "${MCU}", "-c", "${PROGRAMMER}", "-U", "flash:w:target/avr-atmega328p/release/clock-generator.hex:a"]
|
|
|
|
[tasks.copy_eeprom]
|
|
run_task = [
|
|
{ name = "copy_eeprom-development", condition = { profiles = [ "development" ] } },
|
|
{ name = "copy_eeprom-release", condition = { profiles = [ "release" ] } },
|
|
]
|
|
|
|
[tasks.copy_eeprom-development]
|
|
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.copy_eeprom-release]
|
|
description = "Extract the EEPROM"
|
|
dependencies = ["build"]
|
|
command = "avr-objcopy"
|
|
args = ["--change-section-lma", ".eeprom=0", "-O", "ihex", "-j", ".eeprom", "target/avr-atmega328p/release/clock-generator.elf", "target/avr-atmega328p/release/clock-generator.eep"]
|
|
|
|
[tasks.eeprom]
|
|
run_task = [
|
|
{ name = "eeprom-development", condition = { profiles = [ "development" ] } },
|
|
{ name = "eeprom-release", condition = { profiles = [ "release" ] } },
|
|
]
|
|
|
|
[tasks.eeprom-development]
|
|
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"]
|
|
|
|
[tasks.eeprom-release]
|
|
description = "Flash the eeprom"
|
|
dependencies = ["copy_eeprom", "size"]
|
|
command = "avrdude"
|
|
args = ["-p", "${MCU}", "-c", "${PROGRAMMER}", "-U", "eeprom:w:target/avr-atmega328p/release/clock-generator.eep:a"]
|
|
|
|
[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"]
|
|
|
|
[tasks.all]
|
|
description = "Execute all tasks"
|
|
run_task = { name = ["fuses", "eeprom", "flash"] }
|