K1Guitar/tools/flash_app.bat

36 lines
1.2 KiB
Batchfile
Raw Permalink Normal View History

@echo off
REM Flash YNGJ-GT1-M app via IAR cspybat, then reset+run and wait for UI boot.
setlocal
set ROOT=%~dp0..
set OUT=%ROOT%\project\IAR_V7.4\YNGJ-GT1-M\Exe\YNGJ-GT1-M.out
set GEN=%ROOT%\project\IAR_V7.4\settings\YNGJ-GT1-M.YNGJ-GT1-M.general.xcl
set DRV=%ROOT%\project\IAR_V7.4\settings\YNGJ-GT1-M.YNGJ-GT1-M.driver.xcl
set CSPY="C:\Program Files (x86)\IAR Systems\Embedded Workbench 7.3\common\bin\cspybat"
set STAGE=C:\Temp\k1flash
set JLINK="C:\Program Files\SEGGER\JLink_V818\JLink.exe"
if not exist "%OUT%" (
echo ERROR: missing %OUT% - build first
exit /b 1
)
REM Avoid stale debugger locking SWD (cspybat can hang otherwise)
taskkill /F /IM cspybat.exe >nul 2>&1
mkdir "%STAGE%" 2>nul
copy /Y "%OUT%" "%STAGE%\YNGJ-GT1-M.out" >nul
echo [1/3] Downloading (may take ~60s)...
%CSPY% -f "%GEN%" "--debug_file=%STAGE%\YNGJ-GT1-M.out" --download_only --backend -f "%DRV%"
if errorlevel 1 exit /b 1
echo [2/3] Reset and run...
%JLINK% -CommandFile "%~dp0reset_run.jlink"
if errorlevel 1 exit /b 1
echo [3/3] Wait for auto PowerOn + logo (about 4s)...
timeout /t 4 /nobreak >nul
echo Done. UI should be on mode-select screen.
echo Log dump: python rtt_log_dump.py --out problem.log
exit /b 0