- tools/python-embed/: embedded Python 3.12.10 runtime with bleak/pyserial preinstalled (git-ignored, fetched from the huaweicloud mirror); bats resolve Python in order: python-embed -> .venv-ble -> system - NSpyocd.exe + DFP pack copied into tools/ (git-ignored); flash_package.py prefers the in-tools copies - make_release.bat/ps1: one-click zip to out/mothercup_tools_<ts>.zip (staged in TEMP to avoid self-inclusion; zip excluded from git) - all bats converted to CRLF (LF-only breaks cmd block parsing and %~dp0) - verified: zip extracted outside the repo runs ble_ota --uart end-to-end (PASS, 27 kB/s) and flash_package via the bundled NSpyocd - docs: dev log section 49, AGENTS.md tools section + heap 18KB fix
39 lines
1.5 KiB
Batchfile
39 lines
1.5 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
|
||
rem 优先使用随包内嵌的 Python 运行时(tools\python-embed,免安装);
|
||
rem 没有则回退到自动创建的 .venv-ble(开发机)
|
||
set PYEXE=%TOOLS%python-embed\python.exe
|
||
if not exist "%PYEXE%" 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 -r "%TOOLS%requirements-ble.txt" || goto :fail
|
||
)
|
||
|
||
"%PYEXE%" "%TOOLS%ble_ota_update.py" %1 %2 %3
|
||
goto :eof
|
||
|
||
:fail
|
||
echo.
|
||
echo *** setup failed - check python installation ***
|
||
exit /b 1
|