1#!/usr/bin/env bash 2#****************************************************************************** 3# * @attention 4# * 5# * <h2><center>© Copyright (c) 2019 STMicroelectronics. 6# * All rights reserved.</center></h2> 7# * 8# * This software component is licensed by ST under BSD 3-Clause license, 9# * the "License"; You may not use this file except in compliance with the 10# * License. You may obtain a copy of the License at: 11# * opensource.org/licenses/BSD-3-Clause 12# * 13# ****************************************************************************** 14echo "regression script started" 15sn_option="" 16if [ $# -eq 1 ]; then 17sn_option="sn=$1" 18fi 19PATH="/C/Program Files/STMicroelectronics/STM32Cube/STM32CubeProgrammer/bin/":$PATH 20stm32programmercli="STM32_Programmer_CLI" 21# remove write protection 22connect="-c port=SWD ap=1 "$sn_option" mode=UR --hardRst" 23connect_no_reset="-c port=SWD ap=1 "$sn_option" mode=HotPlug" 24echo "Regression platforme H5" 25product_state="-ob PRODUCT_STATE=0xED TZEN=0xB4" 26remove_bank1_protect="-ob SECWM1_STRT=127 SECWM1_END=0 WRPSGn1=0xffffffff" 27remove_bank2_protect="-ob SECWM2_STRT=127 SECWM2_END=0 WRPSGn2=0xffffffff" 28erase_all="-e all" 29remove_hdp_protection="-ob HDP1_END=0 HDP2_END=0" 30default_ob1="-ob SECBOOTADD="0x0C0000" HDP1_STRT=1 HDP1_END=0 HDP2_STRT=1 HDP2_END=0 SWAP_BANK=0 SRAM2_RST=0 SRAM2_ECC=0" 31default_ob2="-ob SECWM2_STRT=0 SECWM2_END=127 SECWM1_STRT=0 SECWM1_END=127" 32 33 34echo "Regression to PRODUCT_STATE 0xED and tzen=1" 35$stm32programmercli $connect $product_state 36echo "Remove bank1 protection and erase all" 37$stm32programmercli $connect $remove_bank1_protect $erase_all 38echo "Remove bank2 protection and erase all" 39$stm32programmercli $connect $remove_bank2_protect $erase_all 40echo "Remove hdp protection" 41$stm32programmercli $connect_no_reset $remove_hdp_protection 42echo "Set default OB 1 (dual bank, swap bank, sram2 reset, secure entry point, bank 1 full secure)" 43$stm32programmercli $connect_no_reset $default_ob1 44echo "Set default OB 2 (bank 2 full secure)" 45$stm32programmercli $connect_no_reset $default_ob2 46echo "regression script Done"