Skip to main content
Graduate II
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

    This topic has been closed for replies.
    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

    Graduate II
    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

    BarryWhitAnswer
    Graduate II
    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.

     

     

    RickoAuthor
    Graduate II
    August 24, 2024

    Thank you both. :smiling_face_with_smiling_eyes: