‎2023-02-22 05:34 AM
I am using CubeIDE 1.11.2 with a STM32F3DISCOVERY board and have created an IDE project via the integrated CubeMX GUI.
I want to activate read protection via HAL_FLASHEx_OBProgram as well as the write protection for the FLASH area of my firmware (applying the same HAL function).
But HAL only allows one of the two features at a time.
The reason is that for every single action (write RDP and write WRP) HAL completely erases the OptionBytes via the FLASH peripheral (as you can see in the HAL source code).
It is important for us to enable RDP and WRP at the same time!
I could do it the bare metal way, but our project is intended for all our used STM32 MCUs and that's exactly what HAL was created for.
Please, can you tell me a way to enable both RDP and WRP with the HAL functions at the same time?
Thanks in advance!
Solved! Go to Solution.
‎2023-03-07 07:53 AM
Hi @Gahlen Feld​
taking into account the current HAL FLASH driver and given the automatic user option bytes erase the recommended sequence to program RDP, WRP and other user data option bytes is as follows:
Thanks to share your feedback on this proposition
Regards
Patrice
‎2023-03-07 07:53 AM
Hi @Gahlen Feld​
taking into account the current HAL FLASH driver and given the automatic user option bytes erase the recommended sequence to program RDP, WRP and other user data option bytes is as follows:
Thanks to share your feedback on this proposition
Regards
Patrice
‎2023-03-08 06:03 AM
Hello Patrice, many thanks! This way it works fine :smiling_face_with_smiling_eyes: