cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F0 read out protection at compile time

yury
Associate II
Posted on October 12, 2015 at 21:55

Hi All!

I'd like to know is there a way (linker directive or something) to set option byte value

I'm aware that I can set ROP when downloading the program via ST_link, but that means there's a chance that I forget to make appropriate setting at some moment

Another way would be checking the ROP state upon each reset, that's very reliable but implies slight code overhead

What I want to find out is a way to put default option byte values into resulting .hex file by some compiler/linker directive. Is there any?
2 REPLIES 2
Posted on October 12, 2015 at 23:01

Well with Keil you should be able to have the linker put data in the 0x1FFFF800 [16 bytes] space using #pragma or scatter file, and if you pick the flash programming algorithms to include the ''STM32F0 Options'' then they will be erased and written as part of the flashing process. You can also add these as suitably configure source files, with a bit level configuration wizard.

The most practical method is to use detection in your own code to recognize the options aren't set as you want, and to change them. Can't see that using an overwhelming amount of code.

http://www.keil.com/support/docs/3406.htm

How you do it on other random tools would depend on their explicit support for the memory space using for the options and OTP spaces.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
yury
Associate II
Posted on October 13, 2015 at 18:33

Thank you! That's exactly what I was looking for.