:: Getting the Trusted Package Creator and STM32CubeProgammer CLI path @echo off call %~dp0../env.bat @echo on :: Enable delayed expansion setlocal EnableDelayedExpansion :: Environment variable for log file set "projectdir=%~dp0" set provisioning_log="%projectdir%provisioning.log" set current_log_file=%provisioning_log% echo. > %current_log_file% :: Environment variable for CubeMx set isGeneratedByCubeMX=%PROJECT_GENERATED_BY_CUBEMX% :start goto exe: goto py: :exe :: called if we want to use AppliCfg executable set "applicfg=%cube_fw_path%\Utilities\PC_Software\ROT_AppliConfig\dist\AppliCfg.exe" set "python=" if exist %applicfg% ( echo run config Appli with Windows executable goto update ) :py :: called if we just want to use AppliCfg python (think to comment "goto exe:") set "applicfg=%cube_fw_path%\Utilities\PC_Software\ROT_AppliConfig\AppliCfg.py" set "python=python " :update set "AppliCfg=%python%%applicfg%" :: Environment variables for CubeProg set vb=3 set install_log=install_sm_log.txt set connect_ur=-c port=SWD speed=reliable ap=1 mode=UR -vb %vb% -log %install_log% set connect=-c port=SWD speed=reliable ap=1 mode=HotPlug -vb %vb% -log %install_log% set connect_reset="-c port=SWD speed=reliable ap=1 mode=Hotplug -hardRst -vb %vb%" -log %install_log% :: Environment variables for secure manager package versions set binver=%projectdir%Binary\version.bat if exist %binver% goto :getversions echo %binver% missing. >> %current_log_file% echo Please get STM3H5 Secure Manager package from st.com. >> %current_log_file% goto :error_config :getversions call %binver% :: Environment variables for binaries set rsse_binary_path=!stm32programmercli!\..\RSSe\H5\!rsse_binary! set ssfi_binary_path=%projectdir%Binary\%ssfi_binary% set sfi_binary_path=%projectdir%Binary\SecureManagerPackage.sfi set license_sfi=%projectdir%Keys\SFI_Global_License.bin :: Initial configuration echo ===== echo ===== Provisioning of Secure Manager Package echo ===== echo ===== SSFI version: %ssfi_binary% if exist %ssfi_binary_path% goto :rsse_sfi echo %ssfi_binary_path% missing. >> %current_log_file% echo Please get STM3H5 Secure Manager package from st.com. >> %current_log_file% goto :error_config :rsse_sfi echo ===== RSSe SFI version: %rsse_binary% if exist !rsse_binary_path! goto :vcp echo !rsse_binary_path! missing. >> %current_log_file% set rsse_binary_path=%projectdir%ST\%rsse_binary% if exist !rsse_binary_path! goto :vcp echo !rsse_binary_path! missing. >> %current_log_file% echo Please get latest version of STM32CubeProgrammer from st.com. >> %current_log_file% goto :error_config :vcp echo ===== echo ===== Product state must be Open. Execute \ROT_Provisioning\DA\regression.bat if not the case. echo ===== echo. :: ================================================ Secure installation RSSe SFI ================================================= :installation echo; echo Step 2 : Installation echo; echo * BOOT0 pin should be disconnected from VDD echo (STM32H573I-DK: set SW1 to position 0) echo Press any key to continue... echo. if [%1] neq [AUTO] pause >nul echo * Secure installation %stm32programmercli% %connect_ur% -e all IF !errorlevel! NEQ 0 goto :error_install @timeout 10 /nobreak >NUL %stm32programmercli% %connect_ur% -hardRst @timeout 8 /nobreak >NUL %stm32programmercli% %connect_ur% -hardRst echo Installation starting (might take up to 15 seconds)... @timeout 8 /nobreak >NUL set cmd_sfi_programming=%stm32programmercli% %connect% -sfi %sfi_binary_path% %license_sfi% -rsse %rsse_binary_path% if [%use_mcsv_file%]==[true] set cmd_sfi_programming=!cmd_sfi_programming! %modules% %cmd_sfi_programming% IF !errorlevel! NEQ 0 goto :error_install :: Wait end of installation ... echo Installation completion... timeout 3 /NOBREAK >nul echo Successful installation echo. :: ============================================================= End functions =================================================== :: All the steps were executed correctly echo ===== echo ===== The board is correctly configured with ST Secure Manager Package echo ===== if [%2] neq [AUTO] cmd /k exit 0 :: Error when script is executed :error_install %stm32programmercli% %connect% -hardRst >> %current_log_file% :error_config echo. echo ===== echo ===== Error occurred. echo ===== See %current_log_file% for details. Then try again. echo ===== if [%2] neq [AUTO] cmd /k exit 1