Hi!
I have a custom board with MK22DX128VLK5.
Before I have enabled security bit in FlashConfig section it was all working fine.
The security is enabled as follows: Backdoor disabled, Mass erase enabled, Factory access granted, Sequrity enabled.
When I am trying to flash image using Flash from file in KDS 3.2.0 there are 2 possible scenarios:
Connection from "127.0.0.1" via 127.0.0.1
Copyright 2012 P&E Microcomputer Systems,Inc.
Command Line :C:\Freescale\KDS_v3\eclipse\plugins\com.pemicro.debug.gdbjtag.pne_2.3.6.201602211227\win32\pegdbserver_console -device=NXP_K2x_K22DX128M5 -startserver -singlesession -serverport=7224 -interface=USBMULTILINK -speed=5000 -usejtag -port=USB1 -
CMD>RE
Initializing.
Target has been RESET and is active.
CMD>CM C:\Freescale\KDS_v3\eclipse\plugins\com.pemicro.debug.gdbjtag.pne_2.3.6.201602211227\win32\gdi\P&E\supportFiles_ARM\NXP\K2x\freescale_k22dx128m5_pflash_dflash_eeprom.arp
Initializing.
Initialized.
;version 1.05, 06/02/2014, Copyright 2014 P&E Microcomputer Systems, Inc. All rights reserved. www.pemicro.com [mk22_128k_x_pflash_dflash_eeprom_m5]
;device freescale, k22dx128m5, pflash_dflash_eeprom
;begin_cs device=$00000000, length=$14001000, ram=$20000000
Loading programming algorithm ...
Done.
CMD>EM
Erasing.
Module has been erased.
Reloading programming algorithm ...
done.
CMD>PM
Programming.
Processing Object File Data ...
.
Programmed.
CMD>VC
Verifying object file CRC-16 to device ranges ...
block 00000000-00006173 ...
Ok.
Checksum Verification Successful. (Cumulative CRC-16=$86C7)
CMD>RE
Initializing.
Device is Secure.
The flashing goes Ok until this moment. Than it asks me: Device is secure. Erase to unsecure? Yes or NO
So if I press Yes:
Device is secured. Erasing ...
Target has been RESET and is active.
WARNING - NO RESET SCRIPT FILE HAS BEEN CONFIGURED TO RUN!!!
TO MODIFY THE RESET SCRIPT SETTINGS, USE THE FOLLOWING MENU OPTION:
CONFIGURATION -> AUTOMATED SCRIPT OPTIONS
No breakpoints currently set.
Disconnected from "127.0.0.1" via 127.0.0.1
Target Disconnected.
Target Disconnected.
Which obviously leaves me with empty device.
If I press No:
Cannot enter background mode. Check connections.
Device is secured. Erasing ...
WARNING - NO RESET SCRIPT FILE HAS BEEN CONFIGURED TO RUN!!!
TO MODIFY THE RESET SCRIPT SETTINGS, USE THE FOLLOWING MENU OPTION:
CONFIGURATION -> AUTOMATED SCRIPT OPTIONS
PE-ERROR: Error downloading to the device.
No breakpoints currently set.
Disconnected from "127.0.0.1" via 127.0.0.1
Target Disconnected.
Target Disconnected.
So it erases device anyway. The only way to program the device is disconnect debugger when the dialog appears.
In this case it works as expected.
Is there a reliable way to program a device with secure image?
(For small batch production)
I am using Kinedis Design Studio 3.2.0 on Win7, Multilink Universal debugger.
Thanks