1
0
mirror of git://projects.qi-hardware.com/ben-wpan.git synced 2024-12-29 03:24:36 +02:00
ben-wpan/prod/atusb-flash
Werner Almesberger cbd0fe54b7 atusb-flash: show avrdude progress output
- Common (doit): if the environment variable LIVE is set to "true",
  run the command in "script" instead of using "eval"
- Common (LIVE): unset this variable on initialization
- atusb-flash (flash): set LIVE, to obtain progress output from avrdude
2011-05-31 03:30:57 -03:00

50 lines
720 B
Bash
Executable File

#!/bin/sh
. ./Common
USB_ID=20b7:1540
FW_BOOT_FILE=boot.hex
FW_APP_FILE=atusb.bin
#
# This invocation of avrdude is derived from ben-wpan/atusb/fw/Makefile,
# target "prog".
#
flash()
{
step "Flash boot loader"
cmd "$REF_EXEC avrdude -F -p atmega32u2 -c nanonote_atusb -e \
-U flash:w:$FW_BOOT_FILE:i \
-U lfuse:w:0x60:m \
-U hfuse:w:0xd8:m \
-U lock:w:0x2f:m"
LIVE=true
expect "lock verified"
LIVE=false
}
enumerate()
{
step "Enumeration"
cmd "$LOCAL_EXEC usbwait -i 0.1 -t 30 $USB_ID"
doit
}
dfu()
{
step "DFU application"
cmd "$LOCAL_EXEC dfu-util -d $USB_ID -D $FW_APP_FILE"
expect "No error"
}
begin
flash
enumerate
dfu