Skip to content

Commit fab802a

Browse files
committed
1 parent 63cbe3d commit fab802a

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

program-widget

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#!/bin/bash
2+
##
3+
## program the sdr-widget under linux as of Sun May 1, 2011
4+
## accepts either a widget.elf file or a widget.hex file
5+
##
6+
echo program-widget with $1
7+
[[ -z $1 ]] && echo "no file specified to program-widget" && exit 1
8+
[[ ! -f $1 ]] && echo "no such file '$1'" && exit 1
9+
case $1 in
10+
*.elf)
11+
hex=/tmp/`basename $1 .elf`.hex
12+
objcopy -O ihex $1 $hex && \
13+
dfu-programmer at32uc3a3256 erase --debug 6 && \
14+
dfu-programmer at32uc3a3256 flash --suppress-bootloader-mem $hex --debug 6 && \
15+
dfu-programmer at32uc3a3256 reset --debug 4 && \
16+
rm $hex && \
17+
exit 0
18+
;;
19+
*.hex)
20+
dfu-programmer at32uc3a3256 erase --debug 6 && \
21+
dfu-programmer at32uc3a3256 flash --suppress-bootloader-mem $1 --debug 6 && \
22+
dfu-programmer at32uc3a3256 reset --debug 4 && \
23+
exit 0
24+
;;
25+
*)
26+
echo unrecognized file format for programming: $1
27+
exit 1
28+
esac
29+

0 commit comments

Comments
 (0)