1
0
mirror of git://projects.qi-hardware.com/ben-wpan.git synced 2024-12-01 19:53:43 +02:00
ben-wpan/prod/atusb-flash
Werner Almesberger e9d65fbfd3 prod/: added atusb-flash script and adapted infrastructure
- atusb-flash: flash boot loader and application
- Makefile (PHONY, flash): invoke atusb-flash
- Common (REF_EXEC): execute a command on the host with the reference
  device
- Common (_doit, expect, expect_re): moved command execution to separate
  function, for better sharing
- Common (doit): new function for executing a command without grepping
  through its output
- Common (begin): make profile argument optional
2011-05-21 12:13:25 -03:00

48 lines
697 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"
expect "lock verified"
}
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