Files
STM32F4-Base/MDK-ARM/download.bat
T

36 lines
1002 B
Batchfile

@echo off
setlocal
set PROJ=%~dp0STM32F407-Demo.uvprojx
set LOG=%~dp0download_log.txt
set TARGET=STM32F407-Demo
:: UV4 location: env var DTU_KEIL_UV4 = full path of UV4.exe (same contract
:: as build.bat; required, no machine-default fallback).
if defined DTU_KEIL_UV4 goto uv4_set
echo DOWNLOAD_FAIL: environment variable DTU_KEIL_UV4 is not set
echo Set it to the full path of UV4.exe, e.g.:
echo [Environment]::SetEnvironmentVariable('DTU_KEIL_UV4', 'D:\Tools\Keil\UV4\UV4.exe', 'User')
exit /b 2
:uv4_set
if exist "%DTU_KEIL_UV4%" goto uv4_ok
echo ENV_ERROR: DTU_KEIL_UV4 is set but does not exist: "%DTU_KEIL_UV4%"
echo Fix the variable value. No fallback to another UV4 install is attempted.
exit /b 2
:uv4_ok
set UV4=%DTU_KEIL_UV4%
"%UV4%" -f "%PROJ%" -t%TARGET% -j0 -o "%LOG%"
findstr /C:"Application running" "%LOG%" >nul
if %ERRORLEVEL% equ 0 (
echo DOWNLOAD_OK: flashed and running
exit /b 0
)
echo DOWNLOAD_FAIL: no application-running marker in log
type "%LOG%"
exit /b 1