diff --git a/11_write_factorytest_by_esptool.sh b/11_write_factorytest_by_esptool.sh index 1e87caf..4156425 100755 --- a/11_write_factorytest_by_esptool.sh +++ b/11_write_factorytest_by_esptool.sh @@ -3,15 +3,20 @@ # This script uploads the factory test firmware to an ESP device using esptool.py. # Check if esptool.py is installed -if ! command -v esptool.py &> /dev/null +if command -v esptool.py &> /dev/null then - echo "esptool.py could not be found. Please install it first." - exit 1 + BUILD_TOOL="esptool.py" +else + if ! command -v py &> /dev/null + then + echo "esptool.py nor py could not be found. Please install it first." + exit 1 + fi + BUILD_TOOL="py -m esptool" fi # Find port - Cross-platform detection PORT="" - # Detect OS and find appropriate port OS_TYPE=$(uname -s) case "$OS_TYPE" in @@ -89,10 +94,10 @@ echo "Partitions file not found at $PARTITIONS_PATH" exit 1 fi -if [ ! -f "$BOOT_APP0_PATH" ]; then - echo "Boot app0 file not found at $BOOT_APP0_PATH" - exit 1 -fi +# if [ ! -f "$BOOT_APP0_PATH" ]; then +# echo "Boot app0 file not found at $BOOT_APP0_PATH" +# exit 1 +# fi if [ ! -f "$FIRMWARE_PATH" ]; then echo "Firmware file not found at $FIRMWARE_PATH" exit 1 @@ -105,7 +110,7 @@ echo "Main firmware: $FIRMWARE_PATH" # Upload the complete firmware using esptool.py -esptool.py --chip esp32 --port "$PORT" --baud 460800 write_flash -z \ +$BUILD_TOOL --chip esp32 --port "$PORT" --baud 460800 write_flash -z \ 0x1000 "$BOOTLOADER_PATH" \ 0x8000 "$PARTITIONS_PATH" \ 0x10000 "$FIRMWARE_PATH"