Hello,
Can we change CRP protection from code. Like this const unsigned long crp __attribute__ ((at(0x2FC))) = 0x87654321;
I need code read protection in my project. But if I enable it then JTAG will be disabled. To make it work in need, I will provide Button on My touch HMI and on button press event, I will change CRP protection to NO_CRP so I can use JTAG.
After burning new software, CRP will be reset to CRP2.
Pradeep P.
What the point in CRP then, if you can disable it like that?! The answer is no - you cannot. The only way out of using CRP1 or CRP2, and deleting the chip entirely to get JTAG working again.
The CRP for your processor (that I have to guess model off because you decided it wasn't important to specify) is nothing magic.
It is 4 bytes in the flash, that are read by the boot loader which then decides how to initialize the processor - or decides what the ISP are allowed to do. Obviously, you can't just assign a new value to the CRP variable since it is stored in flash. IAP can do things that isn't allowed by JTAG or ISP. But the question is why you should bother.
As developer: program a unit without CRP enabled. There. That was simple.
Thank you for replies.
Sorry for late comment.
I should enable CRP to protect my code. Because its commercial product and already one of our previously developed product has been copied by someone somewhere in China. So there is lot of pressure on us about code protection.
I am using LPC1788 MCU. For programming, I am using USB Secondary bootloader. So I will keep 2 Level password protected button on my HMI and also on Web Server. using that button as input I will use IAP to overwrite CRP.
I want to break CRP protection, in case where debugging of particular card is needed.
Pradeep Pol
Your destiny is to get robbed again and again and again.
@Tamir
You mean to say I should not give this option to break CRP in any case. Is there any other way to achieve it?
I dont have provision for ISP on my board to program it after programming once with CRP2 protection enabled. Then In field, it will be difficult to program it, if necessary. Thats why, I was thinking about said scheme. I know its not a good option.
As long as you use CRP1 or 2, ISP mode is still available but requires you to erase the entire chip to make changes. IAP is still available in those modes, too. If you can deliver an image to your application via serial, USB, TCP/IP etc., field upgrades are not an issue.
Yes, I am already using Secondary USB bootloader for firmware upgrade and ISP hardware is not provided on Card. I was thinking about CRP break for Debugging of particular card which is already programmed with CRP2 Level protection.