mothercup/tools/ble_ota.bat
evan.liu 520838ce65 V1.00.20: OTA_END ack guaranteed delivery via deferred reset
- app_ota.c: after END ok, wait until the RSP is consumed by the host
  (BLE e0005 read-out / UART TX done) plus 300ms grace before resetting,
  2s timeout fallback; polled from the BLE schedule task (rwip_schedule
  must keep running for the ATT read to be processed)
- main.c: app_ota_reset_poll() in the BLE schedule task loop
- docs: ble_protocol.md 6.6 note, dev log section 43, AGENTS.md sync
2026-09-04 17:35:01 +08:00

37 lines
1.3 KiB
Batchfile

@echo off
rem ============================================================
rem ble_ota.bat - BLE OTA updater for CAIIC-MCM devices
rem
rem ble_ota.bat [mothercup_ble_ota.bin] BLE channel (...e0005)
rem ble_ota.bat --uart COM4 [mothercup_ble_ota.bin] UART channel
rem default pkg: tools\out\mothercup_ble_ota.bin
rem
rem The combined package holds both bank-linked payloads; the script
rem reads the current bank (info item 0x07 CUR_BANK) and downloads
rem the payload for the opposite bank, then verifies the reboot.
rem Requires tools\.venv-ble (created automatically on first run).
rem ============================================================
setlocal
set TOOLS=%~dp0
set PYEXE=%TOOLS%.venv-ble\Scripts\python.exe
if not exist "%PYEXE%" (
echo [setup] creating venv %TOOLS%.venv-ble ...
set PYREAL=
if exist "%LOCALAPPDATA%\Programs\Python\Python312\python.exe" set PYREAL="%LOCALAPPDATA%\Programs\Python\Python312\python.exe"
if not defined PYREAL (
py -3 --version >nul 2>&1 && set PYREAL=py -3
)
if not defined PYREAL set PYREAL=python
%PYREAL% -m venv "%TOOLS%.venv-ble" || goto :fail
"%PYEXE%" -m pip install --quiet bleak || goto :fail
)
"%PYEXE%" "%TOOLS%ble_ota_update.py" %1 %2 %3
goto :eof
:fail
echo.
echo *** setup failed - check python installation ***
exit /b 1