Cart New Account Login

HomeAbout usProductsSupportForumsBlogCustomer Service

search inside this forum
search inside all forums
How to flash a secured image to a NXP K66 using PE Multilink Universal?
Kristian L. Jan 19, 2018 at 05:54 AM (05:54 hours)
Staff: Takao Y.

  • Hi,

    I am using a MK66FX1M0VLQ18 in a project of mine. However I can't seem to figure out how to flash a secured image, as it just erases the image after it has been flashed:

    $ ./pegdbserver_console -device=NXP_K6x_K66FX1M0M18 -startserver

       P&E GDB Server for Arm(R) devices, Version
       Copyright 2014, P&E Microcomputer Systems Inc, All rights reserved

       Loading library ./gdi/ ... Done.

       Command line arguments: -device=NXP_K6x_K66FX1M0M18 -startserver
       Device selected is NXP_K6x_K66FX1M0M18
       HW Auto-Selected : Interface=USBMULTILINK Port=PEMF8FD1E ; USB1 : Multilink Universal Rev C (PEMF8FD1E)
       Connecting to target.
       P&E Interface detected - Flash Version 9.86
       Device is NXP_K6x_K66FX1M0M18.
       Mode is In-Circuit Debug.

       (C)opyright 2012, P&E Microcomputer Systems, Inc. (
       API version is 101

       Creating kernel driver for freertos
       Server 1 running on
       Server 2 running on
       Server 3 running on
       Server 4 running on
       Server 5 running on
       Server 6 running on
       Server 7 running on
       Server 8 running on
       Server 9 running on
       Server 10 running on
       All Servers Running
       Connection from "" via
       CPU reset by debugger.

       Copyright 2017 P&E Microcomputer Systems,Inc.
       Command Line :


       Target has been RESET and is active.
       CMD>CM ./gdi/P&E/supportFiles_ARM/NXP/K6x/freescale_k66fx1m0m18_pflash_dflash_eeprom.arp


       ;version 1.02, 04/20/2017, Copyright 2017 P&E Microcomputer Systems, Inc. All rights reserved. [mk_1024k_x_pflash_dflash_eeprom]

       ;device freescale, k66fx1m0m18, pflash_dflash_eeprom

       ;begin_cs device=$00000000, length=$140000, ram=$20000000

       Loading programming algorithm ...

       WARNING - Selected .ARP file has been modified. CRC16 = $08C2
       Verifying object file CRC-16 to device ranges ...
        block 00000000-0000B1DB ...
       Calculated CRC-16 does not match block. (File = $6A99, Device = $ABCF)


       Module has been erased.
       Reloading programming algorithm ...

       Processing Object File Data ...

       Verifying object file CRC-16 to device ranges ...
        block 00000000-0000B1DB ...
        Checksum Verification Successful. (Cumulative CRC-16=$6A99)


       Device is Secure.

       Device is secured. Erasing ...
       Target has been RESET and is active.

    Here is my gdb commands:

    $ arm-none-eabi-gdb

       target remote localhost:7224

       (gdb) monitor reset
       Command Executed successfully: reset

       (gdb) load freedom_bootloader.elf
       Loading section .interrupts, size 0x400 lma 0x0
       Loading section .flash_config, size 0x10 lma 0x400
       Loading section .text, size 0xac88 lma 0x410
       Loading section .init_array, size 0x4 lma 0xb098
       Loading section .fini_array, size 0x4 lma 0xb09c
       Loading section .data, size 0x13c lma 0xb0a0
       Start address 0x47c, load size 45532
       Transfer rate: 12 KB/sec, 1011 bytes/write.

    As one can see above, the flash gets successfully written, but is then immediately erased again.

    Is there a gdb command that will load the image WITHOUT erasing the image afterwards?


  • Greetings,

    This is actually expected behavior. If your binary secures the device and then you attempt to start a debug session, then our tools must unsecure the device (aka erase the flash) to put the chip back into debug mode. What you are looking for is a flash programming software, not a debugger software.

    You can attempt to flash using the IDE you are currently using. There might be a flash programming task option, but it is not implemented by P&E so we have no idea how it works.

    If you require a software to flash program and would not like to use an IDE, we have the PROG ACMP software solution. This standalone software requires only your binary and you can set it up to program and secure your chip. No debugging is done and you can use this set up for low-volume production. A purchase of PROG ACMP comes with a command-line software called CPROGACMP which works with batch files so you can automate programming:

    Takao Yamada

    • Yes I know that the debugger unsecures the device when it starts a debug session, as I could see that from the log. I just assumed that there where some way of programming the device without starting a debug session using the P&E Multilink Universal?

      Kristian Sloth Lauszus

  • Greetings,

    Again, it depends on the IDE you are using. You will need to search around to find what they provide outside of debugging. We do not provide flash programming-only solution within our plugin or within Codewarrior.

    If there is no solution, then you may require getting a software like PROGACMP to do this task for you.

    Takao Yamada

    • Hi,

      I should have said that I am using MCUXpresso. However I found out that it is possible to flash it in Windows, as there is a menu popup asking if you want to erase the device or not. Simply selecting "no" seems to do the trick.

      Thanks for the support.

      Kristian Sloth Lauszus

Add comment

   Want to comment? Please login or create a new PEMicro account.

© 2018 P&E Microcomputer Systems Inc.
Website Terms of Use and Sales Agreement