EmbDev.net

Forum: ARM programming with GCC/GNU tools how can I read protect my STM32F4 with eclipse + openOCD JTAG ?


von magnetron (Guest)


Rate this post
useful
not useful
hello forum ,

I am using Eclipse + openOCD JTAG for downloading and debugging
my aplication for STM32F4

after I finish my project I want read protect my code
so that it is not stolen

question : how can I read protect my STM32F4 with eclipse + openOCD JTAG

thank you

von Spencer O. (ntfreak)


Rate this post
useful
not useful
Make sure you have an the latest version of OpenOCD (currently 0.7.0) 
and use the following cmds
1
# set readout protection
2
stm32f2x lock 0
3
4
# clear readout protection, power cycle may be required
5
stm32f2x unlock 0

Cheers
Spen

von magnetron (Guest)


Attached files:

Rate this post
useful
not useful
hello Spencer ,

first of all thank you for your answer

in the attachment the screenshot of my Eclipse

1) how can I upgrade this to 0.7.0 ?

2) should  I type "stm32f2x lock 0" in the console window ?

3) "power cycle may be required" - you mean power off and then on ?

4) I have stm32f4 - but your answer "stm32f2x" - is the command equal 
for both f2 and f4 ?

thank you

von Spencer O. (ntfreak)


Rate this post
useful
not useful
magnetron wrote:
> hello Spencer ,
>
> first of all thank you for your answer
>
> in the attachment the screenshot of my Eclipse
>
> 1) how can I upgrade this to 0.7.0 ?
>

depends in your OS, for windoze you could try here - 
http://www.freddiechopin.info

>
> 2) should  I type "stm32f2x lock 0" in the console window ?
>

yes or in gdb or a script.

>
> 3) "power cycle may be required" - you mean power off and then on ?
>

yes

>
> 4) I have stm32f4 - but your answer "stm32f2x" - is the command equal
> for both f2 and f4 ?
>

yes

Spen

von magnetron (Guest)


Attached files:

Rate this post
useful
not useful
hello Spencer,

I downloaded unzipped and copied openocd-0.7.0 folder
into OlimexODS folder

first error olimex_stm32_e407. file was missing in \scripts\board 
directory
I copied this file from 0.6.1 into 0.7.0

then I run Eclipse chosen ARM_USB_TINY_H  and as you see
openocd-0.7.0.exe recognized the JTAG

afterwards I downloaded my code in my Olimex Board

I typed stm32f2x lock 0 in the console window

the console screen you can see in the attached picture

there was no acknowledgment of read protection

I tried to download my code again and there was no warning that
the uC is read protected

what am I doing wrong ?

thank you

von Spencer O. (ntfreak)


Rate this post
useful
not useful
As you are using the gdb console then you need to prefix any OpenOCD 
cmds with monitor (or mon for short).

1
mon stm32f2x lock 0

Cheers
Spen

von magnetron (Guest)


Rate this post
useful
not useful
hello Spencer ,

I sucessfully locked 0 the way you told

my question

what does lock 0 do ?
does it read protect the code flash ?
what else does it do ?

is there lock 1 or lock 2 too ?

thanks

Please log in before posting. Registration is free and takes only a minute.
Existing account
Do you have a Google/GoogleMail account? No registration required!
Log in with Google account
No account? Register here.