mothercup/tools/flash_package.bat
evan.liu 57762e50be tools: self-contained portable production package
- 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
2026-09-05 10:34:59 +08:00

30 lines
1.0 KiB
Batchfile
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

@echo off
rem ============================================================
rem flash_package.bat [image] - erase the chip and program the
rem merged package via NS-LINK (NSpyocd); thin wrapper over
rem flash_package.py (streams output with the CAIIC banner).
rem [image] optional, default: tools\out\mothercup_ble_prod.hex
rem Connect NS-LINK to SWD (PA4/PA5) and the reset pin first,
rem and CLOSE Keil (it holds the probe).
rem ============================================================
setlocal
rem 优先使用随包内嵌的 Python 运行时(tools\python-embed,免安装)
set PYEXE=%~dp0python-embed\python.exe
if not exist "%PYEXE%" (
set PYEXE=
python --version >nul 2>&1 && set PYEXE=python
)
if not defined PYEXE (
if exist "%LOCALAPPDATA%\Programs\Python\Python312\python.exe" (
set PYEXE="%LOCALAPPDATA%\Programs\Python\Python312\python.exe"
)
)
if not defined PYEXE (
echo python not found - install Python 3 or fix PATH
exit /b 1
)
%PYEXE% "%~dp0flash_package.py" %*
exit /b %ERRORLEVEL%