Enabling CRP (working with IAR)

Started by noelia, February 03, 2012, 06:24:31 AM

Previous topic - Next topic

noelia

I am working with LPC1764 and IAR compiler. I am trying to enable CRP in my code but I can't. Flash Magic always say to me "CRP is disabled" (I tried with two different boards and always test it through a power cycle).

I tried two options:
1) Writing this code in main, but it doesn't work because is for KEIL

const unsigned long crp __attribute__ ((at(0x2FC))) = 0x87654321;

2) Adding this to startup_LPC17xx.s after Default interrupt handlers and before END. I attached the file.

SECTION .crp:CODE:ROOT(2)
DATA
DCD 0x87654321


Flash Magic works perfectly, I can read memory, erase, program, etc. But I can't protect my board.
I read the UM10360 and AN10851.
What am I doing wrong?

Andy Ayre

When you read the memory of your programmed device what value is at location 2FCH?

Andy
Embedded Systems Academy, Inc.
support at esacademy dot com

noelia

When I go to ISP->Display Memory-> 000002F0
I see this:
00 88 36 30 DF F8 08 1B 08 80 DF F8 34 09 00 78

I was testing with different values in my startup (0x87654321, 0x12345678 and 0xFFFFFFFF) and I always read the same.

This is the line in my hex file:
:1002F000 00883630DFF8081B0880DFF834090078 02

Am I looking the value (0x87654321) in the correct line?
My code is already protected? or not?

Thanks

Andy Ayre

The hex file and memory contents match up - you are programming the value 0x78000934, which does not turn CRP on. I presume that value is part of your application. I think you will need to consult your IAR documentation to find the correct compiler extensions to use.

Andy
Embedded Systems Academy, Inc.
support at esacademy dot com

noelia

I could program CRP OK!
I can see "CRP is at level 1" in Flash Magic. When I want to read memory says Operation Failed (reading data - security violation in device).

My startup was OK but the error was in my IAR project. It is important to configure a correct icf file in Linker Options (Options->Linker->Config->Linker Configuration File). This file has the definition for crp section.
I take LPC1768_Flash.icf from an LPC1768 example from IAR. Now I have to write one for LPC1764.
Thanks for your help.


laurianus

Can some one give me a good icf file so I can enable CRP for a LPC1768 using IAR?

noelia

This is my icf file, it works with LPC1764.
Good luck!