The LPC2000 user guide states that I can enable code read protection by programming location 0x000001FC with the value 0x87654321. How can I do this in CrossStudio?
You can do this by adding the following code to the end of the .vectors section in the Philips_LPC210X_Startup.s (LPC21xx, LPC22xx) or Philips_LPC230X_Startup.s (LPC23xx, LPC24xx) file:
.org 0x000001FC .word 0x87654321
Warning: With code read protection enabled the JTAG port will be disabled which means that you will no longer be able download and debug over JTAG, see your LPC2000 user guide for more information.
Note that some versions of the LPC2000 bootloader appear to disable the JTAG as soon as the code read protection word is written which means that if you're downloading over JTAG subsequent download or verification operations will fail. If this is the case then you can do one of the following:
- Generate a .hex file (by setting the Linker > Additional Output Format project property to hex and building your application) and then download the application containing the code read protection enable word over serial port using the Philips ISP loader.
- Rather than embedding the code read protection enable word in your program text, write it programatically either from the application itself or from a seperate RAM application. Obviously if you do this you will still need to reserve the word at 0x000001FC so that the program text is not overwritten.
Please sign in to leave a comment.