how protec a sector of flash memory

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

how protec a sector of flash memory

1,460 Views
yecosuma
Contributor III

hello how i can protec a sector of memory flash?

Labels (1)
0 Kudos
5 Replies

549 Views
yecosuma
Contributor III

hello thanks

in my code I put :

const byte NVPROT_INIT @0x0000FFBD = 0XDE;  just after of a reset   the adress FFBD   IS EQUAL  0XDE in the true time simulate

can i am sure that already is protec the flash?

other issue how i can insert a key ? I will must to vrite value in NVBACKKEY in the similar way that NVPROT ?

IT IS CORRECT ?

THANKS NEWLY

0 Kudos

549 Views
peg
Senior Contributor IV

Hello

I made an error in my last post.

It should have said to check that it is automatically copied across to FPROT (the second time).

As stated before you will need to attempt to alter flash to prove that it is working.

You seem to be confusing flash protection with flash security.

The flash protection we are discussing here is meant to protect against code runaway or the like from inadvertently changing flash contents. It is not meant to protect from someone deliberately doing it.

To unprotect the flash you simply write to FPROT through the BDM connection, not exactly secure but rogue code proof.

0 Kudos

549 Views
yecosuma
Contributor III

 

hello friends; 

yes I already read this but i dont understand the procedure,

I have that charger value in FPROT

FPROT=0XDE; FOR PROTECCION OF LAST 8192 BYTES of memory  this is correct?

also i must put register NVPROT of this form   

const byte NVPROT_INIT @0x0000FFBD = 0XDE;  this is correct  or not ?

how i can know if the area is protect in the true time simulator of code warrior?

 

 

0 Kudos

549 Views
peg
Senior Contributor IV

Hello,

 

You programme the value to NVPROT along with the rest of your code.

This value is automatically copied across to FPROT after a reset.

FPROT cannot be written from user code, otherwise it could be unlocked.

FPROT can be written in background debug mode which is how you can "unprotect" the flash.

Using the simulator you could simply check that the value you programmed into NVPROT is automatically copied to NVPROT after reset.

You would need to attempt to programme the flash from user code (resident in RAM) to really confirm that it is indeed protected.

 

0 Kudos

549 Views
peg
Senior Contributor IV

Hello,

 

Not sure on your definition of a sector, but, you can't just protect a small amount of flash in the middle of the memory map.

FPROT allow a value to be entered where the flash from this address, extended to 16-bits, to the top of flash memory is protected.

Depends to some degree on which device you are using.

See the section of the FLASH chapter of the datasheet that is titled "FLASH Block Protection".

 

0 Kudos