Skip to content

Commit e7e552f

Browse files
Accidenly updated the linux serial_upload instead of stlink upload, so I have re-instated its contents
1 parent 666b5b3 commit e7e552f

1 file changed

Lines changed: 1 addition & 44 deletions

File tree

tools/linux/serial_upload

Lines changed: 1 addition & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,2 @@
11
#!/bin/bash
2-
3-
# Check for leaf device.
4-
function leaf_status()
5-
{
6-
7-
this_leaf_status=$(lsusb |grep "1eaf" | awk '{ print $NF}')
8-
# Find the mode of the leaf bootloader
9-
case $this_leaf_status in
10-
"1eaf:0003")
11-
echo "dfu"
12-
;;
13-
"1eaf:0004")
14-
echo "ttyACMx"
15-
;;
16-
*)
17-
#echo "$this_leaf_status"
18-
echo "unknown"
19-
;;
20-
esac
21-
}
22-
23-
# You will need the usb-reset code, see https://github.com/rogerclarkmelbourne/Arduino_STM32/wiki/Using-a-generic-stm32-board-on-linux-with-Maple-bootloader
24-
#
25-
USBRESET=$(which usb-reset) || USBRESET="./usb-reset"
26-
27-
# Check to see if a maple compatible board is attached
28-
LEAF_STATUS=$(leaf_status)
29-
echo "USB Status [$LEAF_STATUS]"
30-
31-
$(dirname $0)/stlink/st-flash write "$4" 0x8000000
32-
33-
sleep 4
34-
# Reset the usb device to bring up the tty rather than DFU
35-
"$USBRESET" "/dev/bus/usb/$(lsusb |grep "1eaf" |awk '{print $2,$4}'|sed 's/\://g'|sed 's/ /\//g')" >/dev/null 2>&1
36-
# Check to see if a maple compatible board is attached
37-
LEAF_STATUS=$(leaf_status)
38-
echo "USB Status [$LEAF_STATUS]"
39-
# Check to see if the tty came up
40-
TTY_DEV=$(find /dev -cmin -2 |grep ttyAC)
41-
echo -e "Waiting for tty device $TTY_DEV \n"
42-
sleep 20
43-
echo -e "$TTY_DEV should now be available.\n"
44-
exit 0
45-
2+
$(dirname $0)/stm32flash/stm32flash -g 0x8000000 -b 230400 -w "$4" /dev/"$1"

0 commit comments

Comments
 (0)