Skip to main content
kareemkna
Associate II
August 19, 2015
Question

Protect my code STM32

  • August 19, 2015
  • 5 replies
  • 1383 views
Posted on August 19, 2015 at 15:16

I am using STM32f407 and STM32f302 for a project and Finished, now I need to protect the code so no one can upload the hex from my controller ?? can anyone direct me where to look ?

#read #flash #stm32f
This topic has been closed for replies.

5 replies

Nesrine M_O
Associate
August 19, 2015
Posted on August 19, 2015 at 15:40

Hi ahmed.kareem,

Just you have to go to STM32 ST-LINK utility: Target->Option Bytes:

Select the flash protection mode (Write protection/ Read/Write protection) and the sectors that you need to protect.

-Syrine-

Nesrine M_O
Associate
August 19, 2015
Posted on August 19, 2015 at 16:14

For more information about flash memory protection techniques, you may refer to the

http://www.st.com/st-web-ui/static/active/en/resource/technical/document/application_note/DM00186528.pdf

 

-Syrine-

kareemkna
kareemknaAuthor
Associate II
August 19, 2015
Posted on August 19, 2015 at 16:25

Dear Syrine

Thanks for your response, I am using segger programmer/debuger Ultra+ ,,, would ST-link utility support my device ?

I will look into it now

Thanks

Kareem

Tesla DeLorean
Guru
August 19, 2015
Posted on August 19, 2015 at 16:30

No, it just works with the ST-LINK, but those things are trivially cheap in comparison.

You can write the Options Bytes with your own code too.

Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
Nesrine M_O
Associate
August 19, 2015
Posted on August 19, 2015 at 16:47

Hi ahmed.kareem,

It is possible by software,I suggest you to have a look to this project:

STM32Cube_FW_F4_V1.7.0\Projects\STM324x9I_EVAL\Examples\FLASH\FLASH_WriteProtection:This example guides you through the different configuration steps, by mean of HAL API, on how to enable and disable the write protection for internal FLASH memory integrated within STM32F4xx devices.

-Syrine-