Closed mciantyre closed 3 years ago
This continues using the .elf
suffix in documentation, as noted in #13.
But, avrdude supports ELF files (at least as of version 6.3, from around 2016)
TIL! This will simplify some code.
The trailing
:i
indicates that the input is in Intel hex format. The trailing:e
indicates an ELF input.On second look at the
avrdude
manual, it looks like this field is optional.
Looks like (https://github.com/avr-rust/blink/issues/21) the avrdude shipped with WinAVR is old and doesn't support this.
Good to note WinAVR when the book provides Windows-specific documentation.
We could describe how to use objcopy
to support old avrdude
s:
If your
avrdude
tool does not support ELF files, first convert your Rust output to an Intel hex format:
avr-objcopy -O ihex target/avr-atmega328p/release/blink.elf target/avr-atmega328p/release/blink.hex
Then, replace
-Uflash:w:target/avr-atmega328p/release/blink.elf:e
with-Uflash:w:target/avr-atmega328p/release/blink.hex:i
in the aboveavrdude
command.
The book's Arch, Ubuntu, and macOS installation instructions should result in a system that has avr-objcopy
, or some kind of objcopy
. LLVM's objcopy
, available from cargo binutils and aliased as rust-objcopy
, also seemed to work during a quick blink test with my Uno.
The PR proposes flashing documentation. The documentation now describes how flash the blink example to an Arduino Uno.
We scatter
avrdude
installation instructions throughout the third-party tools section. Tested the two Linux installations in some VMs, and tested the macOS installation withbrew
.The
avrdude
usage is similar to how the Arduino IDE flashes a sketch. We skip one step: the IDE first usesavr-objcopy
to convert ELF -> Intel hex. But,avrdude
supports ELF files (at least as of version 6.3, from around 2016). The documentation shows how to use the ELF file directly, rather than first converting to hex. It doesn't seem to matter if I first convert to hex, then flash, vs directly flashing the ELF output;avrdude
reports that it's flashing the same number of bytes in either usage.Tested flashing on macOS. Should work on Linux, but untested.