Code read protect

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

Code read protect

309 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Muis on Mon Mar 16 22:12:45 MST 2015
I started without CRP, and now I wanted to add it. I enabled it in the Linker settings, and I added:

__CRP const uint32_t CRP_WORD = CRP_NO_CRP ;

to my main.h. But now everytime the linker complains:

      ' multiple definition of `CRP_WORD'' and wont compile.

But if I comment out the CRP_WORD constant from my main.h, it complains:

       Linker CRP Enabled, but no CRP_WORD provided within application


I am sure the CRP_WORD variabele exists only once in my project.

What can be the reason? The only things that are not standard about my project is that the stack is moved to USB ram and I use LTO optimization.
0 Kudos
Reply
2 Replies

272 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Muis on Tue Mar 17 02:26:40 MST 2015
I feel very noobish right now, but thanks!
0 Kudos
Reply

272 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by lpcxpresso-support on Tue Mar 17 00:45:00 MST 2015
If you *define* your variable in your header file, then everywhere that you #include the header file will also get a definition of the variable, leading to multiple definition errors.

You need to *declare* your variable in the header file (if you want to be able to access it from other code). The, just define it in C module.

See
http://www.cprogramming.com/declare_vs_define.html
0 Kudos
Reply