diff --git a/manufacturing/programming/program.sh b/manufacturing/programming/program.sh index 4594d1b..20ee1c8 100755 --- a/manufacturing/programming/program.sh +++ b/manufacturing/programming/program.sh @@ -1,3 +1,13 @@ #!/bin/bash -/Applications/STMicroelectronics/STM32Cube/STM32_Programmer_CLI -c port=SWD -ob RDP=0xAA -/Applications/STMicroelectronics/STM32Cube/STM32_Programmer_CLI -c port=SWD -e all -w /Users/willem/Documents/PROJECTS/Leo-led-truck/manufacturing/programming/firmware_v21_20211028.bin 0x08000000 -ob RDP=0xBB \ No newline at end of file +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 \ No newline at end of file