From eb1c72b72bc663239ae229eae8c5c05ca4846a1d Mon Sep 17 00:00:00 2001 From: Selene ToyKeeper Date: Thu, 1 Apr 2021 23:16:58 -0600 Subject: added attiny1616 flashing instructions, and made flash-tiny1616.sh configurable via environment variables --- README | 35 +++++++++++++++++++++++++++++++++-- bin/flash-tiny1616.sh | 13 ++++++++++++- 2 files changed, 45 insertions(+), 3 deletions(-) diff --git a/README b/README index 324e489..816475b 100644 --- a/README +++ b/README @@ -131,10 +131,41 @@ working. - Set ATTINY_DFP=/path/to/where/you/unzipped/the/pack (either in your shell, or in this repo's bin/build.sh script) - + + export ATTINY_DFP=$HOME/src/torches/atmel/attiny-dfp + - Make sure you're using gcc-avr 1:5.4.0+Atmel3.6.2 or newer. 3.6.1 will not work. It gives errors like: /usr/lib/gcc/avr/5.4.0/../../../avr/bin/ld: address 0x80381e of anduril.elf section `.data' is not within region `data' This requires debian/bullseye or newer; buster has 3.6.1. - + This should at least allow the code to compile. + +Some extra steps are also needed to make flashing (avrdude) work: + + - Get an AVR jtag2 device. + The one I'm using is: "HWAYEH AVR JTAG ICE Version 2.0" + Connect the cables: + - GND = - + - Vtref = + + - nSRST = R (reset/UPDI) + + - Flash the jtag2 device with the relevant firmware: + https://github.com/ElTangas/jtag2updi/tree/master/tools/avrjtagicev2 + + - Get an avrdude.conf which supports jtag2updi: + + - Download avrdude.conf from https://github.com/ElTangas/jtag2updi + and put it in /etc + + - Or grab the source and set an environment variable: + + cd ~/src/torches/avrdude + git clone https://github.com/ElTangas/jtag2updi + export AVRDUDE_CONF="-C$HOME/src/torches/avrdude/jtag2updi/avrdude.conf" + + - Maybe configure which USB serial port to use too: + export AVRDUDE_TTYUSB="/dev/ttyUSB2" + +Afterward, flashing should work. You may need to unplug and replug the jtag2 +USB device between uses though, since it may stop responding after each use. diff --git a/bin/flash-tiny1616.sh b/bin/flash-tiny1616.sh index 31c8406..44d716c 100755 --- a/bin/flash-tiny1616.sh +++ b/bin/flash-tiny1616.sh @@ -1,3 +1,14 @@ #/bin/sh FIRMWARE=$1 -avrdude -c jtag2updi -P /dev/ttyUSB0 -p t1616 -u -Uflash:w:$FIRMWARE \ No newline at end of file +if [ -z "$AVRDUDE_TTYUSB" ]; then AVRDUDE_TTYUSB=/dev/ttyUSB0 ; fi + +# In your shell config: +# from https://github.com/ElTangas/jtag2updi ... +# export AVRDUDE_CONF="-C$HOME/path/to/jtag2updi/avrdude.conf" +# export AVRDUDE_TTYUSB="/dev/ttyUSB2" + +avrdude $AVRDUDE_CONF \ + -c jtag2updi \ + -P $AVRDUDE_TTYUSB \ + -p t1616 \ + -u -Uflash:w:$FIRMWARE -- cgit v1.2.3