This is a basic skeleton for programming the AVR128Dx series MCUs using avr-gcc. (If you use Arduino, see the comprehensive DxCore, instead).
- Install prerequisites
- Download the appropriate Microchip "ATPACK" for your MCU
make help ; make vars
ℹ️ Don't have a programmer? Neither did I! If you have a spare mcu with USB serial facilities, you can make your own with a single passive component and a handful of jumper wires in minutes! See doc/PROGRAMMER.md for more info.
I tossed this together in a rush. If you run into issues, feel free to create an issue or PR a fix. Thanks!
- Install the prerequisites (Mac:
brew install avr-gcc make ; pip3 install pymcuprog
) - Download the appropriate Microchip "ATPACK" for your MCU.
- Extract the atpack (it's a zip file), e.g.
unzip /path/to/Atmel.AVR-Dx_DFP.2.2.253.atpack -d /path/to/Atmel.AVR-Dx_DFP.2.2.253_atpack
Then:
ATPACK="/path/to/Atmel.AVR-Dx_DFP.2.2.253_atpack" \
USBDEVICE="/dev/tty.usb<whatever>" \
make upload
The ATPACK
and USBDEVICE
environment variables are required. The default
architecture is avr128da28
(because that's what I have on hand). You can
change this using the DEVICE
environment variable.
make help
for target information.make vars
for env variables.
avr-gcc
is built with avr128dx
support, skip the
atpack stuff and delete any lines that contain ATPACK
from the Makefile.
See Supporting "unsupported" Devices in the avr-gcc Wiki for more info.