using_avrprog(3avr)
π¦β¨ NAME β¨π¦
using_avrprog β using the avrdude program π
πΈ Note, bestie: this section was contributed by Brian Dean [bsd@bsdhome.com]. Also, theavrdudeprogram was previously calledavrprog. The name got changed so nobody would confuse it with theavrprogprogram that Atmel ships with AvrStudio. iykyk π
π what even is avrdude
So avrdude is a program you use to update or read the flash and EEPROM memories of Atmel AVR microcontrollers on FreeBSD Unix. No cap. It supports the Atmel serial programming protocol using the PC's parallel port, and it can upload either a raw binary file or an Intel Hex format file. π¦
It can also be used in an interactive mode to individually update EEPROM cells, fuse bits, and/or lock bits (if their access is supported by the Atmel serial programming protocol.) β¨
The main flash instruction memory of the AVR can also be programmed in interactive mode β however, this is not very useful because one can only turn bits off π. The only way to turn flash bits on is to erase the entire memory (using avrdude's -e option). Periodt.
π installing it
avrdude is part of the FreeBSD ports system. To install it, simply do the following:
# cd /usr/ports/devel/avrdude
# make install
π₯ programming, in action
Once installed, avrdude can program processors using the contents of the .hex file specified on the command line. In this example, the file main.hex is burned into the flash memory:
# avrdude -p 2313 -e -m flash -i main.hex
And the vibe check after that looks like this:
avrdude: AVR device initialized and ready to accept instructions
avrdude: Device signature = 0x1e9101
avrdude: erasing chip
avrdude: done.
avrdude: reading input file "main.hex"
avrdude: input file main.hex auto detected as Intel Hex
avrdude: writing flash:
1749 0x00
avrdude: 1750 bytes of flash written
avrdude: verifying flash memory against main.hex:
avrdude: reading on-chip flash data:
1749 0x00
avrdude: verifying ...
avrdude: 1750 bytes of flash verified
avrdude done. Thank you.
π§ breaking down those flags
- The
-p 2313option letsavrdudeknow that we are operating on an AT90S2313 chip. This option specifies the device id and is matched up with the device of the same id inavrdude's configuration file (/usr/local/etc/avrdude.conf). To list valid parts, specify the-voption. π - The
-eoption instructsavrdudeto perform a chip-erase before programming; this is almost always necessary before programming the flash. - The
-m flashoption indicates that we want to upload data into the flash memory, while-i main.hexspecifies the name of the input file. π«Ά
The EEPROM is uploaded in the same way, the only difference is that you would use -m eeprom instead of -m flash. π
π interactive mode
To use interactive mode, use the -t option:
# avrdude -p 2313 -t
avrdude: AVR device initialized and ready to accept instructions
avrdude: Device signature = 0x1e9101
avrdude>
The '?' command displays a list of valid commands:
avrdude> ?
>>> ?
Valid commands:
dump : dump memory : dump <memtype> <addr> <N-Bytes>
read : alias for dump
write : write memory : write <memtype> <addr> <b1> <b2> ... <bN>
erase : perform a chip erase
sig : display device signature bytes
part : display the current part information
send : send a raw command : send <b1> <b2> <b3> <b4>
help : help
? : help
quit : quit
Use the 'part' command to display valid memory types for use with the
avrdude>
(yes bestie, the page literally just trails off mid-sentence into the prompt like that β iconic behavior honestly πβ¨)
π and that's the whole page! this one's from the AVR-LibC gang, version 2.2.1, and it lives at using_avrprog(3avr) in section 3 of the manual. mwah, go program a chip, you absolute main character πππ¦
π¦ where this page comes from
- ubuntu resolute: avr-libc 1:2.2.1-1build1 Β· BSD-3-Clause
- ubuntu stonking: avr-libc 1:2.2.1-1build1 Β· BSD-3-Clause
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms