Files
Balsam_167/publish_firmware.bat

54 lines
1.7 KiB
Batchfile

@echo off
rem Command-line entry point for publishing firmware from cmd or CCS.
rem Arguments: image, version, release notes, transport, and optional "check".
rem Supplies the default BIN, delegates to PowerShell, and propagates its exit
rem code so that a publication failure also fails the calling build step.
setlocal
set "SCRIPT_DIR=%~dp0"
set "IMAGE_PATH=%~1"
set "VERSION=%~2"
set "NOTES=%~3"
set "TRANSPORT=%~4"
set "CHECK_MODE=%~5"
if not defined IMAGE_PATH set "IMAGE_PATH=%SCRIPT_DIR%Bin\UKSSTMS320F28335.bin"
if not defined VERSION goto :usage
if not defined NOTES set "NOTES=Balsam 167 peripheral firmware %VERSION%"
if not defined TRANSPORT set "TRANSPORT=tms"
set "CHECK_SWITCH="
if /I "%CHECK_MODE%"=="check" set "CHECK_SWITCH=-CheckOnly"
powershell.exe -NoLogo -NoProfile -ExecutionPolicy Bypass -File "%SCRIPT_DIR%scripts\publish-firmware.ps1" ^
-ImagePath "%IMAGE_PATH%" ^
-Version "%VERSION%" ^
-Notes "%NOTES%" ^
-Transport "%TRANSPORT%" ^
-Product "Balsam 167 peripheral" %CHECK_SWITCH%
set "PUBLISH_EXIT=%ERRORLEVEL%"
if not "%PUBLISH_EXIT%"=="0" (
echo.
echo Firmware publication failed with exit code %PUBLISH_EXIT%.
exit /b %PUBLISH_EXIT%
)
echo.
if /I "%CHECK_MODE%"=="check" (
echo Publisher check completed successfully. Nothing was published.
exit /b 0
)
echo Firmware release %VERSION% published successfully.
exit /b 0
:usage
echo Usage:
echo publish_firmware.bat [image.bin] VERSION [notes] [tms^|rs485^|can^|stm32] [check]
echo.
echo Example:
echo publish_firmware.bat "Bin\UKSSTMS320F28335.bin" "1.0.0" "First catalog release" "tms"
echo.
echo Add "check" as the fifth argument to validate access without publishing.
exit /b 2