Skip to main content
Senior
August 24, 2024
Solved

Locking micro to prevent download of code

  • August 24, 2024
  • 3 replies
  • 953 views

Hi,

where do you set programmatically (perhaps through a preprocessor directive) the option to lock the micro to prevent read/download of the flashed code but while obviously still allow for firmware updates?

Also I could not seem to find any such option in CubeIDE. Is it available there or do I need to use the CubeProgrammer?

Thank you

Best answer by BarryWhit

Use CubeProgrammer's Option Byte pane to set RDP options (Readout Protection). Make sure to carefully read up on this feature first, so you don't hurt yourself. Setting RDP level 2 is irreversible.

 

Update: here's another pitfall story, of a near-brick even with RDP level 1.

 

Update2: 

AN5347: Arm® TrustZone® features for STM32L5 and STM32U5 Series

does a good job of scaring you with brick scenarios.

 

 

3 replies

Tesla DeLorean
Guru
August 24, 2024

Simpler perhaps to engage writing of Option Bytes in your own code, and either engage automatically based on a check if currently locked in RDP, or command initiated via your user interface, along with mass erase to clear RDP1

Tips, Buy me a coffee, or three.. PayPal VenmoUp vote any posts that you find helpful, it shows what's working..
BarryWhit
BarryWhitBest answer
Lead
August 24, 2024

Use CubeProgrammer's Option Byte pane to set RDP options (Readout Protection). Make sure to carefully read up on this feature first, so you don't hurt yourself. Setting RDP level 2 is irreversible.

 

Update: here's another pitfall story, of a near-brick even with RDP level 1.

 

Update2: 

AN5347: Arm® TrustZone® features for STM32L5 and STM32U5 Series

does a good job of scaring you with brick scenarios.

 

 

"- If someone's post helped resolve your issue, please thank them by clicking ""Accept as Solution"".- Please post an update with details once you've solved your issue. Your experience may help others."
RickoAuthor
Senior
August 24, 2024

Thank you both. :smiling_face_with_smiling_eyes: