Hello.
I activated the flash security option on my Kinetis K10. But CoreWarrior doesn't program the MCU with the correct setting. I always get the following error:
CodeWarrior changes the security option to unsecure setting and programs the flash.
I cant' find an option to change the current configuration to support the enabled sucurity feature. How can I enable it?
Hi Peter.
how did you set FSEC register?
Best Regards.
ZhangJun
Hello.
I set the FSEC register in the start-up code.
/* Flash configuration field */
__attribute__ ((section (".cfmconfig"))) const uint8_t _cfm[0x10] =
{
/* NV_BACKKEY3: KEY=0xFF */
0xFFU,
/* NV_BACKKEY2: KEY=0xFF */
0xFFU,
/* NV_BACKKEY1: KEY=0xFF */
0xFFU,
/* NV_BACKKEY0: KEY=0xFF */
0xFFU,
/* NV_BACKKEY7: KEY=0xFF */
0xFFU,
/* NV_BACKKEY6: KEY=0xFF */
0xFFU,
/* NV_BACKKEY5: KEY=0xFF */
0xFFU,
/* NV_BACKKEY4: KEY=0xFF */
0xFFU,
/* NV_FPROT3: PROT=0xFF */
0xFFU,
/* NV_FPROT2: PROT=0xFF */
0xFFU,
/* NV_FPROT1: PROT=0xFF */
0xFFU,
/* NV_FPROT0: PROT=0xFF */
0xFFU,
#if SECURITY_ENABLED
/* NV_FSEC: KEYEN=1, MEEN=3, FSLACC=3, SEC= 2 or 3 */
0x7CU,
#else
0x7EU,
#endif
/* NV_FOPT: ??=1, ??=1, ??=1, ??=1, ??=1, NMI_DIS=1, EZPORT_DIS=1, LPBOOT= 0 or 1 */
#if LP_BOOT_MODE_ENABLED
0xFEU,
#else
0xFFU,
#endif
/* NV_FEPROT: EPROT=0xFF */
0xFFU,
/* NV_FDPROT: DPROT=0xFF */
0xFFU
};
Has nobody an idea?
Hi Peter,
there is many Conditional Compilation in your code. what is the ultimate FSEC value you used?
Best Regards,
Jennie
Hello Jennie,
my final value for FSEC is 0x7C to secure the flash.
Best regards
Peter Krause
hello Peter.
I don't have K10 board, but i just made sample on k20 twr board, set FSEC is 0x7C, i can't see your problem. there is no issue to download. secure feature can work normal.
I attached my demo code made with processor expert.
can it also work for you?
==================================
this answer is for you. if it helps, please click on "Correct Answer" button. thanks!
Best Regards,
Zhang Jun
Hello Jennie,
it still doesn’t work for me when I hit the run or download button in CodeWarrior. Maybe it depends on the debugger hardware? I’m using a Segger J-Link.
But I tried another way to download the code.
I created a target task for the flash programmer. By this way I was able to download the code. How can I verify that my MCU is secured properly? On which way did you try to download the code to the MCU?
Best Regards
Peter Krause
hello Peter.
if chip gets sucured, next time when connects board, debugger will pop up confirm message "Device is secure,...".
I use OSJTAG interface. I currently don't have J-link interface, can you please try P&E Multilink or OSJTAG ? how does it work?
and how did you solve your problem currently?
==================================
this answer is for you. if it helps, please click on "Correct Answer" button. thanks!
Best Regards,
Zhang Jun
Hello Jennie,
I don’t get the confirm message when running the debugger. So I think securing also doesn’t work when using target task for flashing the MCU.
I can’t test the other debugging devices because I only have the J-Link.
The problem seems to be the debugger and its software. In the following forum thread Segger confirms that they check it before downloading:
http://forum.segger.com/index.php?page=Thread&threadID=892
And here is a solution to fix the problem:
http://mcuoneclipse.com/2014/06/22/preventing-reverse-engineering-enabling-flash-security/
But he is using Kinetis Design Studio. I can’t find an “allow security” configuration file for my MCU in CodeWarrior.
How can I enable it in CodeWarrior or which file I have edit to allow security with my J-Link?