2021-05-22 23:46:31 +00:00
|
|
|
@ECHO OFF
|
|
|
|
|
|
|
|
set PYTHON=python
|
|
|
|
|
|
|
|
goto GETOPTS
|
|
|
|
:HELP
|
|
|
|
echo Usage: %~nx0 [-h] [-p ESPTOOL_PORT] [-P PYTHON] [-f FILENAME^|FILENAME]
|
|
|
|
echo Flash image file to device, but first erasing and writing system information
|
|
|
|
echo.
|
|
|
|
echo -h Display this help and exit
|
|
|
|
echo -p ESPTOOL_PORT Set the environment variable for ESPTOOL_PORT. If not set, ESPTOOL iterates all ports (Dangerrous).
|
|
|
|
echo -P PYTHON Specify alternate python interpreter to use to invoke esptool. (Default: %PYTHON%)
|
|
|
|
echo -f FILENAME The .bin file to flash. Custom to your device type and region.
|
|
|
|
goto EOF
|
|
|
|
|
|
|
|
:GETOPTS
|
|
|
|
if /I "%1"=="-h" goto HELP
|
|
|
|
if /I "%1"=="--help" goto HELP
|
|
|
|
if /I "%1"=="-F" set "FILENAME=%2" & SHIFT
|
|
|
|
if /I "%1"=="-p" set ESPTOOL_PORT=%2 & SHIFT
|
|
|
|
if /I "%1"=="-P" set PYTHON=%2 & SHIFT
|
|
|
|
SHIFT
|
|
|
|
IF NOT "__%1__"=="____" goto GETOPTS
|
|
|
|
|
|
|
|
IF "__%FILENAME%__" == "____" (
|
|
|
|
echo "Missing FILENAME"
|
|
|
|
goto HELP
|
|
|
|
)
|
2022-11-26 16:00:33 +00:00
|
|
|
IF EXIST %FILENAME% IF x%FILENAME:update=%==x%FILENAME% (
|
2021-05-22 23:46:31 +00:00
|
|
|
echo Trying to flash update %FILENAME%, but first erasing and writing system information"
|
2022-06-15 16:44:37 +00:00
|
|
|
%PYTHON% -m esptool --baud 115200 erase_flash
|
2022-10-01 07:46:56 +00:00
|
|
|
%PYTHON% -m esptool --baud 115200 write_flash 0x00 %FILENAME%
|
2023-03-09 18:45:38 +00:00
|
|
|
|
2024-03-07 14:31:20 +00:00
|
|
|
@REM Account for S3 and C3 board's different OTA partition
|
2024-04-09 16:37:38 +00:00
|
|
|
IF x%FILENAME:s3=%==x%FILENAME% IF x%FILENAME:v3=%==x%FILENAME% IF x%FILENAME:t-deck=%==x%FILENAME% IF x%FILENAME:wireless-paper=%==x%FILENAME% IF x%FILENAME:wireless-tracker=%==x%FILENAME% IF x%FILENAME:station-g2=%==x%FILENAME% IF x%FILENAME:unphone=%==x%FILENAME% (
|
2024-03-07 14:31:20 +00:00
|
|
|
IF x%FILENAME:esp32c3=%==x%FILENAME% (
|
|
|
|
%PYTHON% -m esptool --baud 115200 write_flash 0x260000 bleota.bin
|
|
|
|
) else (
|
|
|
|
%PYTHON% -m esptool --baud 115200 write_flash 0x260000 bleota-c3.bin
|
|
|
|
)
|
2023-03-09 18:45:38 +00:00
|
|
|
) else (
|
|
|
|
%PYTHON% -m esptool --baud 115200 write_flash 0x260000 bleota-s3.bin
|
|
|
|
)
|
2022-02-14 17:45:29 +00:00
|
|
|
for %%f in (littlefs-*.bin) do (
|
2022-09-26 20:42:58 +00:00
|
|
|
%PYTHON% -m esptool --baud 115200 write_flash 0x300000 %%f
|
2021-05-23 00:33:15 +00:00
|
|
|
)
|
2021-05-22 23:46:31 +00:00
|
|
|
) else (
|
|
|
|
echo "Invalid file: %FILENAME%"
|
|
|
|
goto HELP
|
2022-11-26 16:00:33 +00:00
|
|
|
) else (
|
|
|
|
echo "Invalid file: %FILENAME%"
|
|
|
|
goto HELP
|
2021-05-22 23:46:31 +00:00
|
|
|
)
|
|
|
|
|
2022-08-19 18:33:02 +00:00
|
|
|
:EOF
|