#!/bin/bash TOOLPATH="/Applications/STMicroelectronics/STM32Cube/STM32CubeProgrammer/STM32CubeProgrammer.app/Contents/MacOs/bin" $TOOLPATH/STM32_Programmer_CLI -c port=SWD -ob RDP=0xAA status=$? if [ $status -ne 0 ]; then echo "Failed to set Optiobytes, EXIT!" exit 1 fi $TOOLPATH/STM32_Programmer_CLI -c port=SWD -e all -w firmware_v21_20211028.bin 0x08000000 -ob RDP=0xBB