diff --git a/tools/dev/flash.sh b/tools/dev/flash.sh index 5134e7a1f..c81fa0089 100644 --- a/tools/dev/flash.sh +++ b/tools/dev/flash.sh @@ -25,13 +25,14 @@ set -e : "${FLASH_SERIAL_PORT:=/dev/ttyUSB0}" : "${FLASH_OFFSET:=0x210000}" -if [ -z "${IDF_PATH}" ]; then - echo "ERROR! IDF_PATH must be set to root of IDF-SDK to pick up esptool." +ESP_TOOL=`which esptool.py` +if [ -z ${ESP_TOOL} ]; then + echo "ERROR! esptool.py not found! IDF_PATH must be set to root of IDF-SDK to pick up esptool. Or install the standalone tool." exit -1 fi usage() { - echo "Usage: $0 [-p ] [-b ] " + echo "Usage: $ ${0} [-p ] [-b ] [-o ] [-l :: flash given .avm file to lib.avm partition] " } if [[ $# -lt 1 ]]; then @@ -39,7 +40,7 @@ if [[ $# -lt 1 ]]; then exit -1 fi -while getopts 'p:b:h' arg; do +while getopts 'p:b:o:lh' arg; do case ${arg} in p) FLASH_SERIAL_PORT=${OPTARG} @@ -47,6 +48,12 @@ while getopts 'p:b:h' arg; do b) FLASH_BAUD_RATE=${OPTARG} ;; + o) + FLASH_OFFSET=${OPTARG} + ;; + l) + FLASH_OFFSET="0x1D0000" + ;; h) usage exit 0 @@ -69,6 +76,7 @@ echo "%%" echo "%% Flashing ${1} (size=${filesize}k)" echo "%%" + exec `which esptool.py` \ --chip auto \ --port "${FLASH_SERIAL_PORT}" \