@echo off

echo.
echo !!! WARNING: This will program the Circle OS into the STM32-Primer. !!!
echo !!!       All applications currently loaded will be erased.         !!!
echo.
echo Press Ctrl-C to abort.

pause

echo.
Cortex_pgm TSTM32F103RBT6 E PCircle.hex S

if errorlevel 1 goto error_handler

goto end

:error_handler
echo.
echo.
echo !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ERROR !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
echo.
echo STM32-Primer programmation failed. Please check that the "Debug" USB connector
echo is plugged and that the STM32-Primer is powered up (press the STM32-Primer 
echo button if you are unsure)

:end
echo.
pause
