#!/bin/bash # SPDX-License-Identifier: Apache-2.0 # Copyright (c) 2012-2024 Scott Penrose and WII5 Buoy contributors # # This file is part of WII5 Buoy firmware. # See LICENSE for full terms. # Burn application + bootloader to an ATmega2560 over an ICSP programmer # (e.g. AVRISP mkII / Atmel STK500v2). # # Configure these env vars: : "${WII5_AVRDUDE:?path to avrdude binary}" : "${WII5_AVRDUDE_CONF:?path to avrdude.conf}" : "${WII5_FULL_HEX:?path to wii5_buoy.ino.hex}" : "${WII5_BOOT_HEX:?path to optiboot bootloader hex}" "$WII5_AVRDUDE" \ -C"$WII5_AVRDUDE_CONF" -v \ -patmega2560 \ -cstk500v2 \ -Pusb \ -D \ -Uflash:w:"$WII5_FULL_HEX" \ -Uboot:w:"$WII5_BOOT_HEX" \ -Ulock:w:0x0F:m # Notes: # To set fuses on a fresh chip: # avrdude ... -e -Ulock:w:0x3F:m -Uefuse:w:0xFD:m -Uhfuse:w:0xd6:m -Ulfuse:w:0xf7:m # Then to flash bootloader + app, run this script.