Merge branch 'master' of https://github.com/rogerclarkmelbourne/Arduino_STM32
This commit is contained in:
commit
6df2be1012
|
@ -4,3 +4,6 @@
|
||||||
[submodule "drivers/win/src/pbatard_libwdi"]
|
[submodule "drivers/win/src/pbatard_libwdi"]
|
||||||
path = drivers/win/src/pbatard_libwdi
|
path = drivers/win/src/pbatard_libwdi
|
||||||
url = https://github.com/pbatard/libwdi.git
|
url = https://github.com/pbatard/libwdi.git
|
||||||
|
[submodule "tools/src/texane-stlink"]
|
||||||
|
path = tools/src/texane-stlink
|
||||||
|
url = https://github.com/texane/stlink
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# Translates the windows Arduino IDE upload call - something like..
|
# Translates the windows Arduino IDE upload call - something like..
|
||||||
#
|
#
|
||||||
|
@ -9,6 +8,27 @@
|
||||||
# dfu-util -D ./STM32_Blink.cpp.bin -d 1eaf:0003 --intf 0 --alt 1
|
# dfu-util -D ./STM32_Blink.cpp.bin -d 1eaf:0003 --intf 0 --alt 1
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
|
|
||||||
|
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
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
DEVICE="$3"
|
DEVICE="$3"
|
||||||
# Lowercase the 1eaf device name, since in Windows land everybody shouts.
|
# Lowercase the 1eaf device name, since in Windows land everybody shouts.
|
||||||
DEVICE=${DEVICE,,}
|
DEVICE=${DEVICE,,}
|
||||||
|
@ -17,30 +37,57 @@ BINFILE="$4.bin"
|
||||||
INTERFACE="$6"
|
INTERFACE="$6"
|
||||||
ALT_INTERFACE="$2"
|
ALT_INTERFACE="$2"
|
||||||
|
|
||||||
|
# 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"
|
USBRESET=$(which usb-reset) || USBRESET="./usb-reset"
|
||||||
echo -e "\n\rPlease unplug and replug the USB cable to the STB device..."
|
|
||||||
|
# Check to see if a maple compatible board is attached
|
||||||
|
LEAF_STATUS=$(leaf_status)
|
||||||
|
|
||||||
|
# Borard not found, or no boot loader on board.
|
||||||
|
if [[ $(leaf_status) = "unknown" ]]
|
||||||
|
then
|
||||||
|
echo "STM32 Maple Bootloader compatible board not found."
|
||||||
|
sleep 5
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# We got this far, so we need to get the board in bootloader mode.
|
||||||
|
# After the timeout period, the board goes back in to serial mode, we need it in dfu mode, which happens for the first few seconds at power on
|
||||||
|
# so we ask the user to unplug and re-plug the board.
|
||||||
|
echo -e "\n\rSTM32 Maple board is in $LEAF_STATUS mode."
|
||||||
|
|
||||||
|
echo "Please unplug and replug the USB cable to the Maple device."
|
||||||
sleep 2
|
sleep 2
|
||||||
while [[ $(lsusb |grep -i "1eaf") ]]
|
# On unplugging the board will be "unknown"
|
||||||
|
while [[ $(leaf_status) != "unknown" ]]
|
||||||
|
do
|
||||||
|
echo -n "."
|
||||||
|
sleep 1
|
||||||
|
done
|
||||||
|
# On re-plugging the board will be "dfu"
|
||||||
|
while [[ $(leaf_status) != "dfu" ]]
|
||||||
|
do
|
||||||
|
echo -n "."
|
||||||
|
sleep 1
|
||||||
|
done
|
||||||
|
|
||||||
|
echo -e "\n\rProgramming STM32 device with dfu-util"
|
||||||
|
until dfu-util -D "$BINFILE" -d "$DEVICE" --intf "$INTERFACE" --alt "$ALT_INTERFACE" 2>&1
|
||||||
do
|
do
|
||||||
echo -n "."
|
echo -n "."
|
||||||
sleep 1
|
sleep 1
|
||||||
done
|
done
|
||||||
|
|
||||||
until dfu-util -v -D "$BINFILE" -d "$DEVICE" --intf "$INTERFACE" --alt "$ALT_INTERFACE"
|
echo -e "\n\rUnplug and replug the USB cable to the STM32 board again please...."
|
||||||
do
|
while [[ $(leaf_status) != "unknown" ]]
|
||||||
echo -n "."
|
|
||||||
sleep 1
|
|
||||||
done
|
|
||||||
|
|
||||||
echo -e "\n\rUnplug and replug the USB cable to the STM board again please...."
|
|
||||||
while [[ $(lsusb |grep -i "1eaf\:0003") ]]
|
|
||||||
do
|
do
|
||||||
echo -n "."
|
echo -n "."
|
||||||
sleep 1
|
sleep 1
|
||||||
done
|
done
|
||||||
|
|
||||||
echo -e "\n\rReconnecting"
|
echo -e "\n\rReconnecting"
|
||||||
while [ -z "$(lsusb |grep -i "1eaf\:0003")" ]
|
while [[ $(leaf_status) = "unknown" ]]
|
||||||
do
|
do
|
||||||
echo -n "."
|
echo -n "."
|
||||||
sleep 1
|
sleep 1
|
||||||
|
@ -53,17 +100,13 @@ do
|
||||||
sleep 1
|
sleep 1
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|
||||||
"$USBRESET" "/dev/bus/usb/$(lsusb |grep "1eaf" |awk '{print $2,$4}'|sed 's/\://g'|sed 's/ /\//g')" >/dev/null 2>&1
|
"$USBRESET" "/dev/bus/usb/$(lsusb |grep "1eaf" |awk '{print $2,$4}'|sed 's/\://g'|sed 's/ /\//g')" >/dev/null 2>&1
|
||||||
for i in {1..4}
|
|
||||||
|
while [[ $(leaf_status) = "unknown" ]]
|
||||||
do
|
do
|
||||||
echo -n "."
|
echo -n "."
|
||||||
sleep 1
|
sleep 1
|
||||||
done
|
done
|
||||||
|
THIS_TTY=$(find /dev/ttyACM* -cmin -2)
|
||||||
echo -e "\n\rSerial port re-created... $(ls "/dev/ttyACM"*)\n\r"
|
echo -e "\n\rSTM32 Maple board serial port re-created..."
|
||||||
for i in {1..4}
|
echo -e "\n\rSerial port is $THIS_TTY Please allow 15 seconds before attempting to read from serial port."
|
||||||
do
|
|
||||||
echo -n "."
|
|
||||||
sleep 1
|
|
||||||
done
|
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
Subproject commit 1b46200b12ff8764a869a7365eb8253622100fed
|
Loading…
Reference in New Issue