LPC-Link2 with CMSIS-DAP & OpenOCD as Device Flasher

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

LPC-Link2 with CMSIS-DAP & OpenOCD as Device Flasher

3,147 Views
RobertRau1z
Contributor I

We have completed development of a product based on the MKL27Z256VFM4 and setup a small programming station with a LPC-Link2 with CMSIS-DAP & OpenOCD. Setting up the LPC-Link2 with CMSIS-DAP went flawlessly. We are using the command line:

openocd -d2 -f interface/cmsis-dap.cfg -f target/klx.cfg -c "init" -c"reset halt" -c "flash write_image erase BabyFrogVFM4cmpA.bin 0"

but only having partial success:

Open On-Chip Debugger 0.10.0
Licensed under GNU GPL v2
For bug reports, read
    http://openocd.org/doc/doxygen/bugs.html
debug_level: 2
Info : auto-selecting first available session transport "swd". To override use 'transport select <transport>'.
Info : add flash_bank kinetis klx.flash
adapter speed: 1000 kHz
none separate
cortex_m reset_config sysresetreq
Info : CMSIS-DAP: SWD  Supported
Info : CMSIS-DAP: JTAG Supported
Info : CMSIS-DAP: Interface Initialised (SWD)
Info : CMSIS-DAP: FW Version = 1.10
Info : SWCLK/TCK = 1 SWDIO/TMS = 1 TDI = 1 TDO = 1 nTRST = 0 nRESET = 1
Info : CMSIS-DAP: Interface ready
Info : clock speed 1000 kHz
Info : SWD DPIDR 0x0bc11477
Error: MDM: failed to read ID register
Info : SWD DPIDR 0x0bc11477
Info : klx.cpu: hardware has 2 breakpoints, 2 watchpoints
Info : MDM: Chip is unsecured. Continuing.
target halted due to debug-request, current mode: Thread
xPSR: 0x61000000 pc: 0x1c0000c0 msp: 0x20000688
auto erase enabled
Info : Probing flash info for bank 0
Warn : This device supports Program Longword execution only.
Warn : This device supports Program Longword execution only.
Warn : Flash Configuration Field written.
Warn : Reset or power off the device to make settings effective.
Warn : This device supports Program Longword execution only.
Error: corrupted fifo read pointer 0xffffffff
Error: timed out while waiting for target halted
target halted due to debug-request, current mode: Handler HardFault
xPSR: 0x21000003 pc: 0x0000adbc msp: 0x20005fd8
Error: error waiting for target flash write algorithm
Error: Error executing kinetis Flash programming algorithm
Error: error writing to flash at address 0x00000000 at offset 0x00000000

I am new to OpenOCD and CMSIS-DAP. We developed with a Segger J-Link. Is my command line correct?

Digging around in a computer where OpenOCD was used a few years and noticed the target config file was kl2x.cfg where the OpenOCD mainline only has klx.cfg. Does NXP have more correct target files for OpenOCD?

Any help would be greatly appreciated.

Thank you for your time.

0 Kudos
3 Replies

2,970 Views
RobertRau1z
Contributor I

Felipe,

Thank you, I have used Erich's site as a life-line for many years, really good stuff. As I am not debugging, just flashing, I tried his kinetis.cfg without the GDB attach at the end. I put the file in the targets directory, and am still having trouble.  OpenOCD changes things from version to version, he was on 0.8 for that post and I am using 0.10. Maybe I still don't understand the proper target file to use, Years ago NXP distributed a kl2x.cfg, OpenOCD now includes a klx.cfg, Erich has this kinetis.cfg, and I found this 11/2014 post for the MKL26Z256 (very similar to my MKL27Z256VFM4):

OpenOCD - Open On-Chip Debugger / [OpenOCD-user] KL26 flash erase 

I still either get the

corrupted fifo read pointer 0xffffffff error or an error failed to write memory at 0x200002b0.

What is the proper target to use for openOCD 0.10 and the MKL27Z256VFM4?

Thanks again for any help.

0 Kudos

2,970 Views
FelipeGarcia
NXP Employee
NXP Employee

Hi,

 

Unfortunately, I am not aware of the changes of OpenOCD in the version you are using so I do not know which cfg file is compatible.

 

Have you tried using P&E or Segger firmware?

 

Also, when you download the SDK for the FRDM-KL27Z in the docs folder you will find a pdf named "Getting Started with MCUXpresso SDK". Section 6 of this document explains how to run an SDK example using ARM GCC. This is the command line we recommend using to build, run, and debug demo applications and necessary driver libraries provided in the MCUXpresso SDK. Maybe it could also be useful for you.

 

Best regards,

Felipe

0 Kudos

2,970 Views
FelipeGarcia
NXP Employee
NXP Employee

Hi Robert,

 

I recommend you to check the following blog from a colleague that explains how to debug FRDM-KL25Z using OpenOCD with CMSIS-DAP.

 

OpenOCD/CMSIS-DAP Debugging with Eclipse and without an IDE | MCU on Eclipse

 

Hope it helps!

 

Best regards,

Felipe

0 Kudos