55 lines
2.4 KiB
Batchfile
55 lines
2.4 KiB
Batchfile
@echo off
|
|
rem ============================================================
|
|
rem make_package.bat - build bootloader + APP1/APP2, then merge
|
|
rem into the PRODUCTION package:
|
|
rem tools/out/mothercup_ble_prod.{hex,bin} (APP1 only)
|
|
rem tools/out/mothercup_ble_ota.bin (OTA release)
|
|
rem Run from anywhere: tools\make_package.bat
|
|
rem ============================================================
|
|
setlocal
|
|
set ROOT=%~dp0..
|
|
set UV4="D:\Keil_v5\UV4\UV4.exe"
|
|
|
|
echo [1/4] Building bootloader...
|
|
%UV4% -r "%ROOT%\Boot\MDK-ARM\caiic_boot.uvprojx" -j0 -o "%ROOT%\Boot\MDK-ARM\build.log"
|
|
if errorlevel 1 goto :fail
|
|
findstr /C:"0 Error(s), 0 Warning(s)" "%ROOT%\Boot\MDK-ARM\build.log" >nul || goto :fail
|
|
|
|
echo [2/4] Building APP1 (target N32WB03x)...
|
|
%UV4% -r "%ROOT%\mcm-ddc-ble\MDK-ARM\mcm-ddc-ble.uvprojx" -t "N32WB03x" -j0 -o "%ROOT%\mcm-ddc-ble\MDK-ARM\build.log"
|
|
if errorlevel 1 goto :fail
|
|
findstr /C:"0 Error(s), 0 Warning(s)" "%ROOT%\mcm-ddc-ble\MDK-ARM\build.log" >nul || goto :fail
|
|
|
|
echo [3/4] Building APP2-linked OTA payload (target APP2)...
|
|
%UV4% -r "%ROOT%\mcm-ddc-ble\MDK-ARM\mcm-ddc-ble.uvprojx" -t "APP2" -j0 -o "%ROOT%\mcm-ddc-ble\MDK-ARM\build-app2.log"
|
|
if errorlevel 1 goto :fail
|
|
findstr /C:"0 Error(s), 0 Warning(s)" "%ROOT%\mcm-ddc-ble\MDK-ARM\build-app2.log" >nul || goto :fail
|
|
|
|
echo [4/4] Merging images...
|
|
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
|
|
goto :fail
|
|
)
|
|
rem --ota-app2: emit a second OTA payload linked for the APP2 bank
|
|
rem (OTA writes the bank opposite to the running one, so both link
|
|
rem variants must ship; the client picks by info item 0x07 CUR_BANK).
|
|
%PYEXE% "%~dp0merge_image.py" "%ROOT%\mcm-ddc-ble\MDK-ARM\bin\mcm-ddc-ble.bin" mothercup_ble_prod --ota-app2 "%ROOT%\mcm-ddc-ble\MDK-ARM\bin\mcm-ddc-ble-app2.bin" --combo-name mothercup_ble_ota || goto :fail
|
|
|
|
echo.
|
|
echo Package ready: tools\out\mothercup_ble_prod.hex / mothercup_ble_prod.bin
|
|
echo OTA payloads: mothercup_ble_prod_ota.bin (bank1) / mothercup_ble_prod_ota_app2.bin (bank2)
|
|
echo OTA release: mothercup_ble_ota.bin (single file, header carries version/size/CRC)
|
|
goto :eof
|
|
|
|
:fail
|
|
echo.
|
|
echo *** FAILED - check the build logs ***
|
|
exit /b 1
|