Secured Kinetis device……

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

Secured Kinetis device……

1,931 Views
FlyChou
Contributor I

Hi,

     I got a problem with Kinetis PK10N512VLL10.It trouble me a few days.while I try to debug my target via J-link.It says that my kinetis is seured.Something information like this: 'Secured Kinetis device detected......Do you want to unsured the device ?'

    Then I pess Yes.But I got a "Time-out"  warning.I don't know why.

    I search the forum for my answer.And I have tryed use command "unsured kinetis" thouth J-Link Commander.It doesn't works.I don't know why……

   Someone thinks the ARM core is in LOW POWER MODE.How can I solve the problem?

   Thx

0 Kudos
Reply
3 Replies

921 Views
James8
Contributor I

I have the same problem so I thought I would post here since your thread is pretty recent.

 

From what I can gather this is a problem with configuration bits at 0x400 to 0x40F... they include some bits which permanently lock your device, forever, permanently. Great stuff!

 

What I am confused about is I only programmed it twice, and I am 50% sure I couldn't have touched these bits. The first time I programmed I used the IAR "getting started" project, this uses K40X_ram.icf linker file, which I heard from another thread shouldn't touch the conf bits:

 

/*###ICF### Section handled by ICF editor, don't touch! ****/
/*-Editor annotation file-*/
/* IcfEditorFile="$TOOLKIT_DIR$\config\ide\IcfEditor\a_v1_0.xml" */
/*-Specials-*/
define symbol __ICFEDIT_intvec_start__ = 0x1FFF8000;
/*-Memory Regions-*/
define symbol __ICFEDIT_region_ROM_start__ = 0x1FFFC000;
define symbol __ICFEDIT_region_ROM_end__ = 0x1FFFFFFF;
define symbol __ICFEDIT_region_RAM_start__ = 0x1FFF8000;
define symbol __ICFEDIT_region_RAM_end__ = 0x20007FFF;
/*-Sizes-*/
define symbol __ICFEDIT_size_cstack__ = 0x200;
define symbol __ICFEDIT_size_heap__ = 0x200;
/**** End of ICF editor section. ###ICF###*/


define memory mem with size = 4G;
define region ROM_region = mem:[from __ICFEDIT_region_ROM_start__ to __ICFEDIT_region_ROM_end__];
define region RAM_region = mem:[from __ICFEDIT_region_RAM_start__ to __ICFEDIT_region_RAM_end__];

define block CSTACK with alignment = 8, size = __ICFEDIT_size_cstack__ { };
define block HEAP with alignment = 8, size = __ICFEDIT_size_heap__ { };

initialize by copy { readwrite };
do not initialize { section .noinit };

place at address mem:__ICFEDIT_intvec_start__ { readonly section .intvec };

place in RAM_region { readonly };
place in RAM_region { readwrite,
block CSTACK, block HEAP };

 

When I was happy that that was programmed, I tried to install my actual project. In my naivety I gave no thought that the linker file might completely destroy my hardware, so I just went and programmed it without thinking, and it gave me this error.... having figured out the problem in hindsight, I checked my linker script and it seems ok:

 

/*###ICF### Section handled by ICF editor, don't touch! ****/
/*-Editor annotation file-*/
/* IcfEditorFile="$TOOLKIT_DIR$\config\ide\IcfEditor\cortex_v1_0.xml" */
/*-Specials-*/
define symbol __ICFEDIT_intvec_start__ = 0x00000000;
/*-Memory Regions-*/
define symbol __ICFEDIT_region_ROM_start__ = 0x00000000;
define symbol __ICFEDIT_region_ROM_end__ = 0x00080000;
define symbol __ICFEDIT_region_RAM_start__ = 0x1FFF0410;
define symbol __ICFEDIT_region_RAM_end__ = 0x20000000;
/*-Sizes-*/
define symbol __ICFEDIT_size_cstack__ = 0x2000;
define symbol __ICFEDIT_size_heap__ = 0x000;
/**** End of ICF editor section. ###ICF###*/


define symbol __region_RAM2_start__ = 0x20000000;
define symbol __region_RAM2_end__ = 0x20010000;

define exported symbol __VECTOR_TABLE = 0x00000000;
define exported symbol __VECTOR_RAM = 0x1fff0000;

define exported symbol __BOOT_STACK_ADDRESS = __region_RAM2_end__ - 8; //0x2000FFF8;

define symbol __code_start__ = 0x00000410;

define memory mem with size = 4G;
define region ROM_region = mem:[from __ICFEDIT_region_ROM_start__ to __ICFEDIT_region_ROM_end__];
define region RAM_region = mem:[from __ICFEDIT_region_RAM_start__ to __ICFEDIT_region_RAM_end__] | mem:[from __region_RAM2_start__ to __region_RAM2_end__];

define block CSTACK with alignment = 8, size = __ICFEDIT_size_cstack__ { };
define block HEAP with alignment = 8, size = __ICFEDIT_size_heap__ { };

initialize by copy { readwrite };
initialize by copy { section .data};
initialize by copy { section .textrw };
do not initialize { section .noinit };

define block CodeRelocate { section .textrw_init };
define block CodeRelocateRam { section .textrw };

place at address mem:__ICFEDIT_intvec_start__ { readonly section .intvec };
place at address mem:__code_start__ { readonly section .noinit };

place in ROM_region { readonly, block CodeRelocate};

place in RAM_region { readwrite, block CodeRelocateRam, block CSTACK, block HEAP };

 

Code is started at 0x410... so I am wondering how on earth did it get protected in the time between programming the example project and programming my real project.

 

If somebody could answer me these it would be appreciated

a) is my linker script ok, or is it going to trash the config section?

b) assuming it is bad, shouldn't it at least allow the file to be programmed once, it doesn't make sense to me that it failed on the first time, it should have programmed it -and then- protected it.

c) is the example project linker script ok. note that that is a K40 file, my chip is actually K60.

 

Thanks

0 Kudos
Reply

921 Views
zeal
Contributor II

It is possible to permanently lock the kinetis device, if the device is locked but not permanently you can unlock with

unlock kinetis in the jlink command tool or use the osjtag interface to perform a mass erase. I havn't been able to unlock it with the keil dongle yet. Very good info can be found here: http://supp.iar.com/Support/?note=77989

 

A link file with takes into acount the flash security bits, comes from IAR.

 

/*###ICF### Section handled by ICF editor, don't touch! ****/
/*-Editor annotation file-*/
/* IcfEditorFile="$TOOLKIT_DIR$\config\ide\IcfEditor\a_v1_0.xml" */
/*-Specials-*/
define symbol __ICFEDIT_intvec_start__ = 0x00000000;
/*-Memory Regions-*/
define symbol __ICFEDIT_region_ROM_start__   = 0x00000000;
define symbol __ICFEDIT_region_ROM_end__     = 0x0007FFFF;
define symbol __ICFEDIT_region_RAM_start__   = 0x1FFF8000;
define symbol __ICFEDIT_region_RAM_end__     = 0x20007FFF;
/*-Sizes-*/
define symbol __ICFEDIT_size_cstack__   = 0x200;
define symbol __ICFEDIT_size_heap__     = 0x200;
/**** End of ICF editor section. ###ICF###*/

define symbol FlashConfig_start__= 0x00000400;
define symbol FlashConfig_end__  = 0x0000040f;

define memory mem with size = 4G;
define region ROM_region   = mem:[from __ICFEDIT_region_ROM_start__ to (FlashConfig_start__ - 1)] | [from (FlashConfig_end__+1)  to __ICFEDIT_region_ROM_end__];
define region RAM_region   = mem:[from __ICFEDIT_region_RAM_start__   to __ICFEDIT_region_RAM_end__];

define block CSTACK    with alignment = 8, size = __ICFEDIT_size_cstack__   { };
define block HEAP      with alignment = 8, size = __ICFEDIT_size_heap__     { };

define region FlashConfig_region = mem:[from FlashConfig_start__ to FlashConfig_end__];

initialize by copy { readwrite };
do not initialize  { section .noinit };

place at address mem:__ICFEDIT_intvec_start__ { readonly section .intvec };

place in ROM_region   { readonly };
place in RAM_region   { readwrite,
                        block CSTACK, block HEAP };

place in FlashConfig_region
                      {section FlashConfig};

0 Kudos
Reply

921 Views
James8
Contributor I

Just got a brand new chip and IAR gives me the same error on the very first time programming it....

 

It was programming with a RAM linker script... so it should have been fine.

 

I'm quickly running out of hardware.

0 Kudos
Reply