From e7e552fef6d8bfe000254860e39d42f776c0fc79 Mon Sep 17 00:00:00 2001 From: Roger Clark Date: Tue, 5 May 2015 10:05:22 +1000 Subject: [PATCH] Accidenly updated the linux serial_upload instead of stlink upload, so I have re-instated its contents --- tools/linux/serial_upload | 45 +-------------------------------------- 1 file changed, 1 insertion(+), 44 deletions(-) diff --git a/tools/linux/serial_upload b/tools/linux/serial_upload index 24e528d..05d17c6 100755 --- a/tools/linux/serial_upload +++ b/tools/linux/serial_upload @@ -1,45 +1,2 @@ #!/bin/bash - -# Check for leaf device. -function leaf_status() -{ - -this_leaf_status=$(lsusb |grep "1eaf" | awk '{ print $NF}') -# Find the mode of the leaf bootloader -case $this_leaf_status in - "1eaf:0003") - echo "dfu" - ;; - "1eaf:0004") - echo "ttyACMx" - ;; - *) - #echo "$this_leaf_status" - echo "unknown" - ;; -esac -} - -# 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 -# -USBRESET=$(which usb-reset) || USBRESET="./usb-reset" - -# Check to see if a maple compatible board is attached -LEAF_STATUS=$(leaf_status) -echo "USB Status [$LEAF_STATUS]" - -$(dirname $0)/stlink/st-flash write "$4" 0x8000000 - -sleep 4 -# Reset the usb device to bring up the tty rather than DFU -"$USBRESET" "/dev/bus/usb/$(lsusb |grep "1eaf" |awk '{print $2,$4}'|sed 's/\://g'|sed 's/ /\//g')" >/dev/null 2>&1 -# Check to see if a maple compatible board is attached -LEAF_STATUS=$(leaf_status) -echo "USB Status [$LEAF_STATUS]" -# Check to see if the tty came up -TTY_DEV=$(find /dev -cmin -2 |grep ttyAC) -echo -e "Waiting for tty device $TTY_DEV \n" -sleep 20 -echo -e "$TTY_DEV should now be available.\n" -exit 0 - +$(dirname $0)/stm32flash/stm32flash -g 0x8000000 -b 230400 -w "$4" /dev/"$1"