Root/prod/atusb-flash

1#!/bin/sh
2
3. ./Common
4
5
6USB_ID=20b7:1540
7FW_BOOT_FILE=boot.hex
8FW_APP_FILE=atusb.bin
9
10
11#
12# This invocation of avrdude is derived from ben-wpan/atusb/fw/Makefile,
13# target "prog".
14#
15
16flash()
17{
18    step "Flash boot loader"
19    cmd "$REF_EXEC avrdude -F -p atmega32u2 -c nanonote_atusb -e \
20                  -U flash:w:$FW_BOOT_FILE:i \
21                  -U lfuse:w:0x60:m \
22                  -U hfuse:w:0xd8:m \
23                  -U lock:w:0x2f:m"
24    LIVE=true
25    expect "lock verified"
26    LIVE=false
27}
28
29
30enumerate()
31{
32    step "Enumeration"
33    cmd "$LOCAL_EXEC usbwait -i 0.1 -t 30 $USB_ID"
34    doit
35}
36
37
38dfu()
39{
40    step "DFU application"
41    cmd "$LOCAL_EXEC dfu-util -d $USB_ID -D $FW_APP_FILE"
42    expect "No error"
43}
44
45
46begin
47flash
48enumerate
49dfu
50

Archive Download this file



interactive