@echo off

set OLD_PATH=%PATH%
set PATH=..\bin;%PATH%

echo.
echo !!!      WARNING: This will program the new application hex file.       !!!
echo !!!              Current application will be erased.                    !!!
echo.
echo Press Ctrl-C to abort.

pause

echo.
st-link_cli -c SWD UR -p LoRaMac-iot-3010-sf12-adr.hex -V -Rst -Run

if errorlevel 0 goto end

:error_handler
echo.
echo.
echo !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ERROR !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
echo.
echo                  Programmation failed. Please check connections
echo.

:end
set PATH=%OLD_PATH%
echo.
pause
