Change Code Read Protection via SWD

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

Change Code Read Protection via SWD

Jump to solution
1,014 Views
joelhart
Contributor I

What are the steps necessary to change the Code Read Protection (CRP) on an LPC1114FBD48/302, using the SWD interface?

Labels (2)
1 Solution
854 Views
converse
Senior Contributor V

There is no simple way to do this. CRP is 'just' an address in flash. To change it, you need to erase and re-program the entire sector of flash that contains the CRP value (which is sector 0). 

If you are using a debugger, a command line flash programmer, Flash Magic, or any other commercial programmer, you would normally provide an entire new flash image and reprogram the whole of flash. You could optimise this by just providing the portion of the image for sector you wish to change, and then program just that sector (making sure you do not do a mass-erase which erases the whole of flash).

I don't know of any tool that you could use to just change the value of the CRP - this would involve the tool reading the existing date from the sector 0, erasing flash sector 0, and then writing the data back, with a changed CRP value.

View solution in original post

2 Replies
855 Views
converse
Senior Contributor V

There is no simple way to do this. CRP is 'just' an address in flash. To change it, you need to erase and re-program the entire sector of flash that contains the CRP value (which is sector 0). 

If you are using a debugger, a command line flash programmer, Flash Magic, or any other commercial programmer, you would normally provide an entire new flash image and reprogram the whole of flash. You could optimise this by just providing the portion of the image for sector you wish to change, and then program just that sector (making sure you do not do a mass-erase which erases the whole of flash).

I don't know of any tool that you could use to just change the value of the CRP - this would involve the tool reading the existing date from the sector 0, erasing flash sector 0, and then writing the data back, with a changed CRP value.

854 Views
arpad_toth
Contributor II

This is super cumbersome.

There should be an SWD readout protection bit field in CPR.

0 Kudos