cancel
Showing results for 
Search instead for 
Did you mean: 

Flash ReadWrite And Code protection

MehranMsba
Associate II
Posted on March 27, 2014 at 14:18

I use eeprom emulation library on STM32f107.

I don't understand relations of eeprom emulation and flash protection.

If I use flash as eeprom,Is code protection failed? or something else...?

Its any relation between these?

#flash-protect #eeprom-emulation
8 REPLIES 8
Posted on March 27, 2014 at 15:02

You'll have to experiment.

As far as I'm aware read-out protection does not limit code in FLASH reading other data in FLASH, or writing or erasing sections of FLASH. You'd have to mass erase the part to turn off read-out protection.
Tips, buy me a coffee, or three.. PayPal Venmo Up vote any posts that you find helpful, it shows what's working..
chen
Associate II
Posted on March 27, 2014 at 15:56

Hi

Please specify what you mean by ''flash protection''

Do you mean - Flash read out protection or Flash sector lock?

MehranMsba
Associate II
Posted on March 28, 2014 at 13:57

Thank for your answers.

1.I want to protect my code versus extraction methods.

2.I want to use eeprom emulation(use flash for data read and write) too.

I said: ''I dont understand flash sector lock or unlock and read out protection relations'',

Can tell me what the meaning of flash sector lock and read out protection difference?

I secure the chip with jlink program menu:

0690X000006056cQAA.pngIn this state mcu operation has no problem and read from flash(eeprom emulation) is good.

but no success operation when I want to write data to flash and data is not saved.

What can I do? Is this way true?

Thanks.
chen
Associate II
Posted on March 28, 2014 at 14:05

Hi

''Can tell me what the meaning of flash sector lock and read out protection difference?''

'flash sector lock' - adds an extra level of protects when trying to erase/program Flash.

Helps to stop erroneous erasing and programming of Flash.

'flash read out protection' - stops the ability to read out the contents of the flash when turned on.

chen
Associate II
Posted on March 28, 2014 at 15:06

''I secure the chip with jlink program menu:''

This is probably applying Sector Lock protection.

''but no success operation when I want to write data to flash and data is not saved.

What can I do? Is this way true?''

Having locked the Flash - you now cannot change the Flash unless it is unlocked first.

The Flash Lock just adds an additional step (sequence) in the programming sequence.

MehranMsba
Associate II
Posted on March 28, 2014 at 15:30

Thanks.

OK,I want read out protection and write to some page of flash at runtime.

So ''secure chip'' don't solve my problem at all.I want to use EEPROM_Write... and its not work on this mode,but I have another question: Is ''secure chip'' protect the code from read out?,because I cant read mcu in this mode with debugger or program it in uvision.

All of flash will be erased after ''Unsecure chip''.

Is there any way that I can use ''Read out protection'' and write in flash at runtime?

how can I enable read out protection(principled way)?

Thanks.
chen
Associate II
Posted on March 28, 2014 at 15:55

''So ''secure chip'' don't solve my problem at all.''

'' Is ''secure chip'' protect the code from read out?''

I do not know what this feature does.

''because I cant read mcu in this mode with debugger or program it in uvision.''

This suggests the Read out protection has been enabled.

''Is there any way that I can use ''Read out protection'' and write in flash at runtime?

how can I enable read out protection(principled way)?''

Read out protection does not stop the STM32 reading or writing to the Flash.

Read out protection can be enabled/disabled through the option bytes of the processor.

See the reference manual or data sheet for the device you are using for information about the option bytes and how to use them (For a STM32F4xx it is in the Flash memory section - do not know where it will be for your part).

It should explain the memory address for the option bytes, what they are/do and what the sequence is to set them.

There may be functions provided in the standard peripheral library to set the option bytes.

MehranMsba
Associate II
Posted on March 31, 2014 at 12:20

I found this function on flash peripheral library:

FLASH_ReadOutProtection();

This function change option byte and then,readout protection has been activated. There is no write protection flash page in this state,and work with eeprom emulation without any problem. There is a tip in ReadOutProtection: Mcu needs power on reset after set readout option byte. reset pin,or other reset solution don't reload option byte, only

power on reset

reload readout protection data. ''J-Link secure'' enable readout protection and flash write protection.We need only readout protection in eeprom emulation.So its not useful for this thread. Thanks for your answers. Problem Solved.