diff --git a/sdk/tools/flash.sh b/sdk/tools/flash.sh index 724e0833e..83415be4c 100755 --- a/sdk/tools/flash.sh +++ b/sdk/tools/flash.sh @@ -80,16 +80,6 @@ esac # Exec file extension postfix EXEEXT="" -# WSL/WSL2 detection -if [ "${PLATFORM}" == "linux" ]; then - if [ "$(uname -r | grep -i microsoft)" != "" ]; then - # WSL/WSL2 is a linux but USB related SDK tools - # should use windows binary. - PLATFORM=windows - EXEEXT=".exe" - fi -fi - # Option handler # -b: UART Baudrate (default: 115200) # -c: UART Port (default: /dev/ttyUSB0) @@ -120,6 +110,18 @@ if [ "${UPDATE_ZIP}" != "" ]; then exit fi +# WSL/WSL2 detection +if [ "${PLATFORM}" == "linux" ]; then + if [ "$(uname -r | grep -i microsoft)" != "" ]; then + if [[ "$UART_PORT" == COM* ]]; then + # WSL/WSL2 is a linux but USB related SDK tools + # should use windows binary. + PLATFORM=windows + EXEEXT=".exe" + fi + fi +fi + # Check loader version ${SCRIPT_DIR}/bootloader.py -c