LinkServer for Microcontrollers

GDB is the de-facto debugging engine and debug connection for micro-controllers these days: it is versatile and with its client-server architecture very flexible and powerful, and pretty much every debug probe and vendor (PEMICRO, SEGGER, OpenOCD, pyOCD, …) offers it. But a GDB server or command line implementation was not available for the NXP LinkServer family of debug probes (LPC-Link, MCU-Link, MCU-Link Pro). This has changed now: LinkServer is available as command line tool and can be used as GDB Server:

LinkServer as GDB Server with Eclipse

With the new LinkServer package I do not only get a gdb server implementation: I have now a command line tool I can use for automation and all kind of different things: programming boards, erasing flash, and so on.

Outline

The NXP LinkServer software supports the NXP debug probes, so the MCU-Link, MCU-Link Pro, LPC-Link2 and LPC11U325 based debug probes, in the form of a standalone and separate server instance.

Why is this so important? Because so far the NXP LinkServer debug connection was not a ‘standard’ GDB Server one as in other debug probes, see for example DIY Free Toolchain for Kinetis: Part 3 – Debugger (GDB Server with P&E and Segger). The NXP LinkServer debug connection was pretty much bound to the IDE (MCUXpresso IDE), and not really usable from the outside (e.g. for scripting) or from other IDEs (like Visual Studio Code). Having the NXP LinkServer available as ‘standalone/gdb server’ implementation removes that limitation.

Previously, automation or scripting the LinkServer debug connection was very cryptic and not recommended. Now things are as easy as for other debug probes. And the implementation includes multi-core support plus semihosting.

Installation

The setup files are available from https://nxp.com/linkserver. I’m using the version 1.0.9 for this article.

LinkServer Installation

Using LinkServer

What I get with this is a LinkServer executable which is able to act as a gdb server:

LinkServer Installation Directory

This is a console application:

LinkServer Console Application

To get help about a command (config, devices, flash, gdbserver, probes), use the command followed by the help option, e.g.

linkserver flash -h

which gives

Usage: LinkServer.exe flash [OPTIONS] DEVICE COMMAND [ARGS]...

  Flash operations

  DEVICE can be:
  - <DEVICE_NAME>:<BOARD> pair, same as `devices --filter` parameter
  - device configuration file with extension `.json`.
          Use `config` command for generating such a file from an existing device

COMMAND:
  blank      Check that the specified flash region is blank
  erase      Erase all flash
  load       Program the flash with a given FILE
  resurrect  Attempt to unlock the device by running masserase-script
  verify     Verify that the flash contents match a given FILE

ARGS for a specific command are shown when using --help with the respective
subcommand

OPTIONS:
  -p, --probe TEXT                Probe serial/index to use. If it starts with
                                  # then it is interpreted as a probe index,
                                  otherwise it is interpreted as a probe
                                  serial substring. Unnecessary if only one
                                  probe is connected.
  -o, --override <POINTER>=<VALUE>
                                  Override device's JSON configuration.
                                  <POINTER> is a JSON pointer to the property
                                  that needs to be modified. <VALUE> should be
                                  a valid JSON value, otherwise it is
                                  interpreted as a string. Example: `-o
                                  /device/memory/2/flash_driver=LPC553x_S.cfx
                                  If <VALUE> is not given, the property that
                                  <POINTER> points to is deleted. Can be used
                                  multiple times.
  -B, --no-boot                   Do not boot probes
  -I, --boot-image [bridged|non-bridged|vcom-serial]
                                  LPC-Link 2 boot type  [default: bridged]
  -h, --help                      Show this message and exit.

C:\NXP\LinkServer_1.0.9>            McuLog_error("failed to create connection, closing connection");
'McuLog_error' is not recognized as an internal or external command,
operable program or batch file.

List attached probes

With

linkserver probes

I get a list of connected probes with their firmware version and serial number:

C:\NXP\LinkServer_1.0.9>LinkServer.exe probes
  #  Description                           Serial
---  ------------------------------------  -------------
  1  MCU-LINK Pro (r0CF) CMSIS-DAP V3.108  3XFHTRT0LIAOF
  2  MCU-LINK (r0FF) CMSIS-DAP V3.108      LAJCDH1EQDHFY

Both the index number (first column) or the serial number can be used to identify a probe if multiple probes are attached.

The above lists the MCU-Link Pro and MCU-Link probes I have currently attached to my host machine:

MCU-Link Pro (left) and MCU-Link (right)

Scripting and Flashing

One of the very useful commands is the ‘flash’ command. With the LinkServer, I have now a command line tool which I can use to program a binary to the board:

LinkServer flash MK22FN512xxx12:FRDM-K22F load FRDM-K22F_FreeRTOS.axf

which gives:

INFO: Exact match for MK22FN512xxx12:FRDM-K22F found
INFO: Selected device MK22FN512xxx12:FRDM-K22F
INFO: Getting available probes
INFO: Selected probe #1 LAJCDH1EQDHFY (MCU-LINK (r0FF) CMSIS-DAP V3.108)
Ns: MCUXpresso IDE RedlinkMulti Driver v11.7 (Mar 22 2023 09:52:55 - crt_emu_cm_redlink.exe build 13)
Pc: (  0) Reading remote configuration
Wc(03). No cache support.
Nc: Found chip XML file in C:\Users\erich\AppData\Local\Temp\tmpratvcbxz\MK22FN512xxx12.xml
Pc: (  5) Remote configuration complete
Nc: Reconnected to existing LinkServer process.
Wc: ============= SCRIPT: kinetisconnect.scp =============
Wc: Kinetis Connect Script
Wc: Connecting to Probe Index = 1
Wc: This probe = 1
Wc: This TAP = 0
Wc: This core = 0
Wc: DpID = 2BA01477
Wc: Assert NRESET
Wc: Reset pin state: 00
Wc: Power up Debug
Wc: MDM-AP APID: 0x001C0000
Wc: MDM-AP System Reset/Hold Reset/Debug Request
Wc: MDM-AP Control: 0x0000001C
Wc: MDM-AP Status (Flash Ready) : 0x00000032
Wc: Part is not secured
Wc: MDM-AP Control: 0x00000014
Wc: Release NRESET
Wc: Reset pin state: 01
Wc: MDM-AP Control (Debug Request): 0x00000004
Wc: MDM-AP Status: 0x0001003A
Wc: MDM-AP Core Halted
Wc: ============= END SCRIPT =============================
Nc: Probe Firmware: MCU-LINK (r0FF) CMSIS-DAP V3.108 (NXP Semiconductors)
Nc: Serial Number:  LAJCDH1EQDHFY
Nc: VID:PID:  1FC9:0143
Nc: USB Path: 0003:000a:00
Nc: Using memory from core 0 after searching for a good core
Pc: ( 30) Emulator Connected
Pc: ( 40) Debug Halt
Pc: ( 50) CPU ID
Nc: debug interface type      = CoreSight DP (DAP DP ID 2BA01477) over SWD TAP 0
Nc: processor type            = Cortex-M4 (CPU ID 00000C24) on DAP AP 0
Nc: number of h/w breakpoints = 6
Nc: number of flash patches   = 2
Nc: number of h/w watchpoints = 4
Nc: Probe(0): Connected&Reset. DpID: 2BA01477. CpuID: 00000C24. Info: <None>
Nc: Debug protocol: SWD. RTCK: Disabled. Vector catch: Disabled.
Ns: Content of CoreSight Debug ROM(s):
Nc: RBASE E00FF000: CID B105100D PID 04000BB4C4 ROM (type 0x1)
Nc: ROM 1 E000E000: CID B105E00D PID 04000BB00C Gen SCS (type 0x0)
Nc: ROM 1 E0001000: CID B105E00D PID 04003BB002 Gen DWT (type 0x0)
Nc: ROM 1 E0002000: CID B105E00D PID 04002BB003 Gen FPB (type 0x0)
Nc: ROM 1 E0000000: CID B105E00D PID 04003BB001 Gen ITM (type 0x0)
Nc: ROM 1 E0040000: CID B105900D PID 04000BB9A1 CSt TPIU type 0x11 Trace Sink - TPIU
Nc: NXP: MK22FN512xxx12
Nc: DAP stride is 4096 bytes (1024 words)
Nc: Inspected v.2 On chip Kinetis Flash memory module FTFA_2K.cfx
Nc: Image 'Kinetis SemiGeneric Mar 21 2023 12:57:31'
Nc: Opening flash driver FTFA_2K.cfx
Nc: Sending VECTRESET to run flash driver
Nc: Flash variant 'K 22 FTFA Generic 2K' detected (512KB = 256*2K at 0x0)
Nc: Closing flash driver FTFA_2K.cfx
Pc: ( 65) Chip Setup Complete
Pc: ( 70) License Check Complete
Nt: Loading 'FRDM-K22F_FreeRTOS.axf' ELF 0x00000000 len 0x3254
Nc: Opening flash driver FTFA_2K.cfx (already resident)
Nc: Sending VECTRESET to run flash driver
Nc: Flash variant 'K 22 FTFA Generic 2K' detected (512KB = 256*2K at 0x0)
Pb: 1 of 1 (  0) Writing sectors 0-6 at 0x00000000 with 12884 bytes
Ps: (  0) at 00000000: 0 bytes - 0/12884
Ps: ( 15) at 00000000: 2048 bytes - 2048/12884
Ps: ( 31) at 00000800: 2048 bytes - 4096/12884
Ps: ( 47) at 00001000: 2048 bytes - 6144/12884
Ps: ( 63) at 00001800: 2048 bytes - 8192/12884
Ps: ( 79) at 00002000: 2048 bytes - 10240/12884
Ps: ( 95) at 00002800: 2048 bytes - 12288/12884
Ps: (100) at 00003000: 2048 bytes - 14336/12884
Nc: Sectors written: 7, unchanged: 0, total: 7
Nc: Closing flash driver FTFA_2K.cfx
Pb: (100) Finished writing Flash successfully.
Nt: Loaded 0x3254 bytes in 428ms (about 30kB/s)
Nt: Reset target (system)
Nc: Starting execution using system reset

With this and the other commands, I can script and program my boards without the need for an IDE. If I want to use it with a debugger or IDE, then I can use it as a GDB server.

GDBServer

One of the obvious usage of the LinkServer software is to use it in combination with the GNU Debugger (gdb). For this, the software use the ‘gdbserver’ command. Let’s probe it withe the help command:

LinkServer gdbserver -h

which gives

Usage: LinkServer.exe gdbserver [OPTIONS] DEVICE

  Start gdbserver connected to DEVICE

  DEVICE can be:
  - <DEVICE_NAME>:<BOARD> pair, same as `devices --filter` parameter
  - device configuration file with extension `.json`.
          Use `config` command for generating such a file from an existing device

OPTIONS:
  -c, --core TEXT                 Core name to connect to. Can be used
                                  multiple times for starting multiple gdb
                                  servers. Accepts two special values:
                                  `primary` & `all`.  [default: primary]
  --gdb-port INTEGER              GDB server port  [1<=x<=65535]
  --semihost-port INTEGER         Semihost port. Set to -1 to disable
                                  semihosting through telnet.  [-1<=x<=65535]
  --allow-remote                  Allow remote TCP/IP connections
  -p, --probe TEXT                Probe serial/index to use. If it starts with
                                  # then it is interpreted as a probe index,
                                  otherwise it is interpreted as a probe
                                  serial substring. Unnecessary if only one
                                  probe is connected.
  -a, --attach                    Enable attach mode
  -o, --override <POINTER>=<VALUE>
                                  Override device's JSON configuration.
                                  <POINTER> is a JSON pointer to the property
                                  that needs to be modified. <VALUE> should be
                                  a valid JSON value, otherwise it is
                                  interpreted as a string. Example: `-o
                                  /device/memory/2/flash_driver=LPC553x_S.cfx
                                  If <VALUE> is not given, the property that
                                  <POINTER> points to is deleted. Can be used
                                  multiple times.
  --redlink-telnet-port INTEGER   Additional ports for redlinkserv. Can be
                                  used multiple times for additional ports.
                                  Useful for debug purposes, for issuing
                                  commands to the probe already used by the
                                  launcher.  [1<=x<=65535]
  -B, --no-boot                   Do not boot probes
  -I, --boot-image [bridged|non-bridged|vcom-serial]
                                  LPC-Link 2 boot type  [default: bridged]
  -h, --help                      Show this message and exit.

To run it as gdbserver, it needs to know the device we want to connect to. In my case I’m using a FRDM-K22F board which has a K22FN512 on it.

FRDM-K22F with MCU-Link

The command

LinkServer devices

would list all supported devices. Because this produces a long list, a useful command is to filter for the K22 ones:

LinkServer devices --filter K22

which gives a shorter list:

Family    Device          Board                  Cores
--------  --------------  ---------------------  -------
K2x       MK22FN512xxx12  FRDM-K22F              cm4
K2x       MK22FN512xxx12  FRDM-K22F-A8964        cm4
K2x       MK22FN512xxx12  FRDM-K22F-OM13790HOST  cm4

What I need to provide an identification is the <Device>:<Board>. So I can use

MK22FN512xxx12:FRDM-K22F  

to identify the MCU and board.

💡 The board makes in this example not much sense, as the board is not really relevant here. But it is relevant for other devices, e.g. if they have external flash memory which is board specific. Additionally, the device/board tuple can be specified with implicit wildcards too.

So for my K22FN512 I start it in gdb server mode the following way:

LinkServer gdbserver MK22FN512xxx12:FRDM-K22F

but because I have multiple probes attached to my system, I can add the probe serial number like this:

LinkServer gdbserver MK22FN512xxx12:FRDM-K22F --probe LAJCDH1EQDHFY

which gives:

INFO: Exact match for MK22FN512xxx12:FRDM-K22F found
INFO: Selected device MK22FN512xxx12:FRDM-K22F
INFO: Getting available probes
INFO: Selecting probe by serial substring
INFO: Selected probe #2 LAJCDH1EQDHFY (MCU-LINK (r0FF) CMSIS-DAP V3.108)
GDB server listening on port 3333 in debug mode (core cm4)
Semihosting server listening on port 4444 (core cm4)

I have now the GDB server running, which is listening on port 3333.

Connection with GDB

With the LinkServer running as GDB server, I can connect to it from gdb, similar to other GDB server connections:

GDB Debugging Chain
GDB Debugging Chain

Here is a quick-start to use gdb in command-line/interactive mode:

To launch the gdb client:

arm-none-eabi-gdb

Then connect tot he server:

target remote localhost:3333

The ‘file’ command can be used to load the symbols.

(gdb) file c:/tmp/FRDM-K22F_FreeRTOS.axf

In the interactive mode, I can use ‘load’ to program the binary:

(gdb) load

to set a breakpoint on main, use ‘break’ or ‘b’:

(gdb) break main

To continue the program, use ‘c’ or continue:

(gdb) continue

With CTRL+C the execution can be stopped.

To list the threads:

i threads

With quit I can leave the debug session:

(gdb) quit

IDE

The GDB Server mode can used from an IDE like Eclipse too. In MCUXpresso IDE, it already uses the LinkServer internally. But if you want to use it externally, this is very easy too. This has the benefit that launching the GDB server can be automated and debugging is simplified, or I can use any IDE.

For stock Eclipse I can launch firs the GDB server on a console, e.g. with

LinkServer gdbserver MK22FN512xxx12:FRDM-K22F

Next, I connect to it with Eclipse using a ‘GDB Hardware Debugging’ connection:

GDB Hardware Debugging

Summary

The new LinkServer is a big step forward in my view: it not only allows using it as gdb server, it can be used for all kind of command line or script automation. Additionally you can define your own board or device settings (flash driver, memory map, …) using a JSON file (see the Readme.md in the installed package). Overall, it the new LinkServer combined with a debug probes makes it a powerful team for many debugging and automation needs.

Happy linking 🙂

Links

17 thoughts on “LinkServer for Microcontrollers

  1. I’ve been using P&E Micro’s pegdbserver_console for a while. Which crashes more often than I care for. So I wanted to give LinkServe a try. Sadly it doesn’t run at all:

    Start LinkServe 1.0.9, Using MCU-Link probe:

    LinkServer gdbserver K32L2A41xxxxA:FRDM-K32L2A4S
    INFO: Exact match for K32L2A41xxxxA:FRDM-K32L2A4S found
    INFO: Selected device K32L2A41xxxxA:FRDM-K32L2A4S
    INFO: Getting available probes
    INFO: Selected probe #1 abcdefg (MCU-LINK (r0FF) CMSIS-DAP V2.263)
    GDB server listening on port 3333 in debug mode (core cm0plus)
    Semihosting server listening on port 4444 (core cm0plus)
    INFO: Connected to core cm0plus

    Start GDB:

    arm-none-eabi-gdb

    (gdb) target remote :3333
    Remote debugging using :3333

    Remote connection closed

    LinkServe:

    INFO: Disconnected from core cm0plus
    Gdbserver on port 3333 has closed

    Not at all clear which end is closing the connection first or why.
    There is no time given to issue a ‘load’ or anything else before the connection is close. Doing target/load etc. from a single command line did no change the results, so I don’t see it as a timing issue.

    Help?

    This is with a custom board using the K32L2A41. The chip is blank and not secured.

    Like

    • I don’t have such a device, so cannot try it myself. What comes to my mind is maybe a firewall or something which closes the connection? Do you have another device/board you can try with, just to check if this is device specific?

      Like

  2. I had already considered the firewall and had the LineServe approved. I just tried turning it off completely. That made no difference.

    I tried with a real FRDM-K32L2A4S board. No difference

    I updated the MCU-Link board’s code from 2.263 to 3.108.
    No difference.

    The KL28 and KL43 FRDM boards don’t have SWD connectors mounted and I have none at hand. Will get some ordered today.

    In trying the KL25 FRDM board I find that the only device supported in the MCU-Link device list is the KL27 and I don’t have a KL27 FRDM board at hand right now.

    I find it odd that one of the most popular parts, the KL25, is no supported?

    I do have a MCU-Link Pro at hand, would you expect any difference results?

    Like

  3. What I have found is that if you do not install the LinkSever package in the default directory of C:\NXP\ it does not get installed correctly.

    Having no target at all hooked up gets the results of my first comment.

    After replacing the bad SWD cable, along with installing in C:\NXP, I was able to get a FRDM-K64F and a FRDM-K32L2B3 to work. These are M4 cores.

    The FRDM-K32L2A4S still did not work, on two different boards. This is M0+ core.

    I hope to have FRDM-KL27, the only MCU-Link supported KL member (KL27 is subset of the unsupported KL43 [Why?]), in hand tomorrow, which is a M0+ core.

    I’m thinking M0+ cores are not working with MCU-Link.

    Like

    • About the installation path: I have it installed into the default location. What path did you use so I can try it on my end?
      About KL25Z: I am surprised too, maybe it is just not listed. I will give it a try this morning.

      Like

      • I tend to put all of my software in a directory called E:\Apps. I try to leave drive C for just Windows.

        The install script did that for the most part.

        However it still installed some scripts in \NXP.
        It also has Junctions that point to NXP that are actually in \Apps.

        Like

    • Hi Bob,
      Based on the existing files and information, I have created a description file for the FRDM-KL25Z, and it works. So M0+ cores do work.
      I have placed the file here:
      https://github.com/ErichStyger/mcuoneclipse/tree/master/MCU-Link/devices

      Below I have pasted the console output.
      I hope this helps,
      Erich

      C:\NXP\LinkServer_1.0.9>LinkServer.exe flash MKL25 load "C:\Users\erich\Data\GitRepos\McuOnEclipse\Examples\MCUXpresso\FRDM-KL25Z\FRDM-KL25Z_Blinky\Debug\FRDM-KL25Z_Blinky.axf"
      INFO: Selected device MKL25Z128xxx4:FRDM-KL25Z
      INFO: Getting available probes
      INFO: Selected probe #1 VSRVJYNCXJUYZ (MCU-LINK r0FF CMSIS-DAP V0.078)
      Ns: MCUXpresso IDE RedlinkMulti Driver v11.7 (Mar 22 2023 09:52:55 - crt_emu_cm_redlink.exe build 13)
      Pc: ( 0) Reading remote configuration
      Wc(03). No cache support.
      Nc: Found chip XML file in C:\Users\erich\AppData\Local\Temp\tmpwj3056ec\MKL25Z128xxx4.xml
      Pc: ( 5) Remote configuration complete
      Nc: Reconnected to existing LinkServer process.
      Wc: ============= SCRIPT: kinetisconnect.scp =============
      Wc: Kinetis Connect Script
      Wc: Connecting to Probe Index = 1
      Wc: This probe = 1
      Wc: This TAP = 0
      Wc: This core = 0
      Wc: DpID = 0BC11477
      Wc: Assert NRESET
      Wc: Reset pin state: 00
      Wc: Power up Debug
      Wc: MDM-AP APID: 0x001C0020
      Wc: MDM-AP System Reset/Hold Reset/Debug Request
      Wc: MDM-AP Control: 0x0000001C
      Wc: MDM-AP Status (Flash Ready) : 0x00000032
      Wc: Part is not secured
      Wc: MDM-AP Control: 0x00000014
      Wc: Release NRESET
      Wc: Reset pin state: 01
      Wc: MDM-AP Control (Debug Request): 0x00000004
      Wc: MDM-AP Status: 0x0001003A
      Wc: MDM-AP Core Halted
      Wc: ============= END SCRIPT =============================
      Nc: Probe Firmware: MCU-LINK r0FF CMSIS-DAP V0.078 (NXP Semiconductors)
      Nc: Serial Number: VSRVJYNCXJUYZ
      Nc: VID:PID: 1FC9:0143
      Nc: USB Path: \\?\hid#vid_1fc9&pid_0143&mi_00#7&117f5013&0&0000#{4d1e55b2-f16f-11cf-88cb-001111000030}
      Nc: Using memory from core 0 after searching for a good core
      Pc: ( 30) Emulator Connected
      Pc: ( 40) Debug Halt
      Pc: ( 50) CPU ID
      Nc: debug interface type = CoreSight DP (DAP DP ID 0BC11477) over SWD TAP 0
      Nc: processor type = Cortex-M0+ (CPU ID 00000C60) on DAP AP 0
      Nc: number of h/w breakpoints = 2
      Nc: number of flash patches = 0
      Nc: number of h/w watchpoints = 2
      Nc: Probe(0): Connected&Reset. DpID: 0BC11477. CpuID: 00000C60. Info:
      Nc: Debug protocol: SWD. RTCK: Disabled. Vector catch: Disabled.
      Ns: Content of CoreSight Debug ROM(s):
      Nc: RBASE F0002000: CID B105100D PID 000008E000 ROM (type 0x1)
      Nc: ROM 1 F0000000: CID B105900D PID 04000BB932 CSt ARM MTB type 0x31 Trace Sink - Basic trace router
      Nc: ROM 1 F0001000: CID B105900D PID 000008E000 CSt MTBDWT type 0x4 Debug Control - Other
      Nc: ROM 1 E00FF000: CID B105100D PID 04000BB4C0 ROM (type 0x1)
      Nc: ROM 4 E000E000: CID B105E00D PID 04000BB008 Gen SCS (type 0x0)
      Nc: ROM 4 E0001000: CID B105E00D PID 04000BB00A Gen DWT (type 0x0)
      Nc: ROM 4 E0002000: CID B105E00D PID 04000BB00B Gen FPB (type 0x0)
      Nc: NXP: MKL25Z128xxx4
      Nc: DAP stride is 1024 bytes (256 words)
      Nc: Inspected v.2 On chip Kinetis Flash memory module FTFA_1K.cfx
      Nc: Image 'Kinetis SemiGeneric Mar 21 2023 12:58:07'
      Nc: Opening flash driver FTFA_1K.cfx
      Nc: Sending VECTRESET to run flash driver
      Nc: Flash variant 'KL25 FTFA Generic 1K' detected (128KB = 128*1K at 0x0)
      Nc: Closing flash driver FTFA_1K.cfx
      Pc: ( 65) Chip Setup Complete
      Pc: ( 70) License Check Complete
      Nt: Loading 'FRDM-KL25Z_Blinky.axf' ELF 0x00000000 len 0x4278
      Nc: Opening flash driver FTFA_1K.cfx (already resident)
      Nc: Sending VECTRESET to run flash driver
      Nc: Flash variant 'KL25 FTFA Generic 1K' detected (128KB = 128*1K at 0x0)
      Pb: 1 of 1 ( 0) Writing sectors 0-16 at 0x00000000 with 17016 bytes
      Ps: ( 0) at 00000000: 0 bytes - 0/17016
      Ps: (100) at 00000000: 17408 bytes - 17408/17016
      Nc: Sectors written: 0, unchanged: 17, total: 17
      Nc: Closing flash driver FTFA_1K.cfx
      Pb: (100) Finished writing Flash successfully.
      Nt: Loaded 0x4278 bytes in 65ms (about 261kB/s)
      Nt: Reset target (system)
      Nc: Starting execution using system reset

      Like

      • Thank you for the file.

        I have two KL25s one with a blank CPU and one with the default program as shipped. The blank one does does not connect with GBB. The one with the default program does. If you erase the flash, rather than loading Blinky, can you connect with GDB?

        The Windows 10 Firewall is turned off.

        I’m going to move these boards to my laptop where there is no other USB stuff going on and see if that makes any difference.

        My FRDM-KL27 is also missing SWD header. Those are on order now.

        Like

        • I can confirm that there is a problem with erased KL25Z. It works if a ‘blinky’ is running on it. It fails if I do a
          linkserver flash KL25Z erase
          followed by a
          linkserver flash KL25Z load c:\tmp\FRDM-KL25Z_Blinky.axf
          I’m going to report this, maybe I’m missing something.

          Like

        • Just if someone else is running into this, here is the console output:
          C:\NXP\LinkServer_1.0.9>linkserver flash KL25Z load c:\tmp\FRDM-KL25Z_Blinky.axf
          INFO: Selected device MKL25Z128xxx4:FRDM-KL25Z
          INFO: Getting available probes
          INFO: Selected probe #1 LAJCDH1EQDHFY (MCU-LINK (r0FF) CMSIS-DAP V3.108)
          Ns: MCUXpresso IDE RedlinkMulti Driver v11.7 (Mar 22 2023 09:52:55 - crt_emu_cm_redlink.exe build 13)
          Pc: ( 0) Reading remote configuration
          Wc(03). No cache support.
          Nc: Found chip XML file in C:\Users\erich\AppData\Local\Temp\tmpwuxhl8bn\MKL25Z128xxx4.xml
          Pc: ( 5) Remote configuration complete
          Nc: Reconnected to existing LinkServer process.
          Nc: Connecting to probe 1 core 0 (using server started externally) reports:
          'Ee(42). Could not connect to core.'
          Nc: Retrying...
          Nc: Reconnected to existing LinkServer process.
          Nc: Server OK but no connection to probe 1 core 0 (after 3 attempts) - Ee(42). Could not connect to core.
          Wc: ============= SCRIPT: kinetisconnect.scp =============
          Wc: Kinetis Connect Script
          Wc: Connecting to Probe Index = 1
          Wc: Error: Probe not connected
          Wc: Error: Hardware interface transfer error
          Wc: Assert NRESET
          Wc: Reset pin state: 00
          Wc: Error: Wire not connected
          Wc: Power up Debug
          Wc: Error: Wire not connected
          Wc: Error: Wire not connected
          Wc: No Debug Power
          Wc: ============= END SCRIPT =============================
          Ed:02: Failed on connect: Ee(42). Could not connect to core.
          Et:31: No connection to chip's debug port
          Pc: (100) Target Connection Failed
          CRITICAL: Critical error
          ERRMSG: subprocess.CalledProcessError: Command '['C:\\NXP\\LinkServer_1.0.9\\binaries\\crt_emu_cm_redlink.exe', '--redlink-port', '11111', '--flash-dir', 'C:\\NXP\\LinkServer_1.0.9\\binaries\\Flash', '-x', 'C:\\Users\\erich\\AppData\\Local\\Temp\\tmpwuxhl8bn', '-pMKL25Z128xxx4', '--vendor', 'NXP', '-g', '--cache', 'dis', '--probeserial', 'LAJCDH1EQDHFY', '--coreindex', '0', '--connectscript', 'kinetisconnect.scp', '--flash-load-exec', 'C:\\tmp\\FRDM-KL25Z_Blinky.axf']' returned non-zero exit status 1.

          Like

        • Do you have any other devices you can try it with, to see if they also do not connect when erased?
          That may be part of my original problem with the K32Ls.

          Like

      • Here are the -l5 gdbserver output.
        About to find out how long a post is allowed

        Blank KL25:that fails to connect:

        [95]DEBUG:asyncio: Using proactor: IocpProactor
        [727]INFO:launcher.cli.utils.funcs: Exact match for MKL25Z128xxx4:FRDM-KL25Z found
        [727]INFO:launcher.cli.utils.click: Selected device MKL25Z128xxx4:FRDM-KL25Z
        [727]DEBUG:launcher.core.redlinkserv: Starting redlinkserv: C:\NXP\LinkServer_1.0.9\binaries\redlinkserv.exe [‘–port’, ‘11111’, ‘–telnetport’, ‘12222’, ‘–no-telnet-defaults’]
        [738]DEBUG:launcher.core.probeboot: Listing usb devices
        [738]DEBUG:launcher.core.utils: Subprocess exec: cscript [‘/nologo’, ‘C:\\NXP\\LinkServer_1.0.9\\binaries\\Scripts\\listusb.vbs’]
        [738]DEBUG:launcher.core.redlinkserv: Connecting to redlinkserv (localhost:12222)
        [1056]DEBUG:launcher.core.probeboot: Found 34 USB devices
        [2777]DEBUG:launcher.core.redlinkserv: Connected to redlinkserv
        [2777]DEBUG:launcher.core.redlinkserv: [read]
        [2777]INFO:launcher.cli.utils.click: Getting available probes
        [2777]DEBUG:launcher.core.redlinkserv: [write] probelist
        [3054]DEBUG:launcher.core.redlinkserv: [read] Index = 1
        Manufacturer = NXP Semiconductors
        Description = MCU-LINK (r0FF) CMSIS-DAP V3.108
        Serial Number = X3WAY4DLLPZI0
        VID:PID = 1FC9:0143
        Path = 0002:000c:00
        [3054]INFO:launcher.cli.utils.click: Selected probe #1 X3WAY4DLLPZI0 (MCU-LINK (r0FF) CMSIS-DAP V3.108)
        [3054]DEBUG:launcher.core.redlinkserv: [write] probeopenbyindex 1
        [3078]DEBUG:launcher.core.redlinkserv: [read] Probe Handle 1 Open
        [3078]DEBUG:launcher.core.redlinkserv: [write] wireswdconnect 1
        [3078]DEBUG:launcher.core.redlinkserv: [read] DpID = 0BC11477
        [3078]DEBUG:launcher.core.redlinkserv: [write] coreconfig 1
        [3078]DEBUG:launcher.core.redlinkserv: [read] Number of CORES/TAPs = 1, Fully recognized: True
        [3078]DEBUG:launcher.core.redlinkserv: [write] corelist 1
        [3078]DEBUG:launcher.core.redlinkserv: [read] TAP 0: 0BC11477 Core 0: M0+ APID: 04770031 ROM Table: F0002003
        [3078]DEBUG:launcher.cli.cmd.gdbserver: Starting stubs
        [3093]DEBUG:launcher.core.stub: Created stub XMLs in C:\Temp\tmpxz1scta_
        [3093]DEBUG:launcher.core.stub: Internal gdbserver (3333) ports: stub_port=13333, sh_stub_port=14444, stdout_port=15555
        [3093]DEBUG:launcher.core.stub: GDB server args: [‘–redlink-port’, ‘11111’, ‘–flash-dir’, ‘C:\\NXP\\LinkServer_1.0.9\\binaries\\Flash’, ‘-x’, ‘C:\\Temp\\tmpxz1scta_’, ‘-pMKL25Z128xxx4’, ‘–vendor’, ‘NXP’, ‘-g’, ‘–cache’, ‘dis’, ‘–probeserial’, ‘X3WAY4DLLPZI0’, ‘–coreindex’, ‘0’, ‘–kill-server’, ‘–server’, ‘localhost:13333’, ‘–telnet’, ‘14444’, ‘–msg-port’, ‘15555’, ‘–connectscript’, ‘kinetisconnect.scp’]
        GDB server listening on port 3333 in debug mode (core cm0plus)
        Semihosting server listening on port 4444 (core cm0plus)
        [3113]DEBUG:launcher.core.stub: [stub (3333)] Ns: MCUXpresso IDE RedlinkMulti Driver v11.7 (Mar 22 2023 09:52:55 – crt_emu_cm_redlink.exe build 13)
        [32873]DEBUG:launcher.core.stub: Received connection to our GDB server (3333)
        [34895]DEBUG:launcher.core.stub: Connected to stub’s GDB port (13333)
        [34895]INFO:launcher.cli.cmd.gdbserver: Connected to core cm0plus
        [34895]DEBUG:launcher.core.stub: GDB (3333) -> stub (13333): b’+$qSupported:multiprocess+;swbreak+;hwbreak+;qRelocInsn+;fork-events+;vfork-events+;exec-events+;vContSupported+;QThreadEvents+;no-resumed+;memory-tagging+#ec’
        [34895]DEBUG:launcher.core.stub: [stub (3333)] Pc: ( 0) Reading remote configuration
        [34895]DEBUG:launcher.core.stub: [stub (3333)] Wc(03). No cache support.
        [34895]DEBUG:launcher.core.stub: [stub (3333)] Nc: Found chip XML file in C:\Temp\tmpxz1scta_\MKL25Z128xxx4.xml
        [34895]DEBUG:launcher.core.stub: [stub (3333)] Pc: ( 5) Remote configuration complete
        [34895]DEBUG:launcher.core.stub: [stub (3333)] Nc: Reconnected to existing LinkServer process.
        [34911]DEBUG:launcher.core.stub: GDB (3333) -> stub (13333): b’$qSupported:multiprocess+;swbreak+;hwbreak+;qRelocInsn+;fork-events+;vfork-events+;exec-events+;vContSupported+;QThreadEvents+;no-resumed+;memory-tagging+#ec’
        [34988]DEBUG:launcher.core.stub: [stub (3333)] Wc: ============= SCRIPT: kinetisconnect.scp =============
        Wc: Kinetis Connect Script
        Wc: Connecting to Probe Index = 1
        Wc: This probe = 1
        Wc: This TAP = 0
        Wc: This core = 0
        Wc: DpID = 0BC11477
        Wc: Assert NRESET
        Wc: Reset pin state: 00
        Wc: Power up Debug
        Wc: MDM-AP APID: 0x001C0020
        Wc: MDM-AP System Reset/Hold Reset/Debug Request
        Wc: MDM-AP Control: 0x0000001C
        [34988]DEBUG:launcher.core.stub: [stub (3333)] Wc: MDM-AP Status (Flash Ready) : 0x00000032
        Wc: Part is not secured
        Wc: MDM-AP Control: 0x00000014
        Wc: Release NRESET
        Wc: Reset pin state: 01
        Wc: MDM-AP Control (Debug Request): 0x00000004
        Wc: MDM-AP Status: 0x0001003A
        Wc: MDM-AP Core Halted
        Wc: ============= END SCRIPT =============================
        [34988]DEBUG:launcher.core.stub: [stub (3333)] Nc: Probe Firmware: MCU-LINK (r0FF) CMSIS-DAP V3.108 (NXP Semiconductors)
        Nc: Serial Number: abcdefg
        Nc: VID:PID: 1FC9:0143
        Nc: USB Path: 0002:000c:00
        [34988]DEBUG:launcher.core.stub: [stub (3333)] Nc: Using memory from core 0 after searching for a good core
        [34988]DEBUG:launcher.core.stub: [stub (3333)] Pc: ( 30) Emulator Connected
        [34988]DEBUG:launcher.core.stub: [stub (3333)] Pc: ( 40) Debug Halt
        [35004]DEBUG:launcher.core.stub: [stub (3333)] Pc: ( 50) CPU ID
        [35004]DEBUG:launcher.core.stub: [stub (3333)] Nc: debug interface type = CoreSight DP (DAP DP ID 0BC11477) over SWD TAP 0
        [35004]DEBUG:launcher.core.stub: [stub (3333)] Nc: processor type = Cortex-M0+ (CPU ID 00000C60) on DAP AP 0
        [35004]DEBUG:launcher.core.stub: [stub (3333)] Nc: number of h/w breakpoints = 2
        Nc: number of flash patches = 0
        [35004]DEBUG:launcher.core.stub: [stub (3333)] Nc: number of h/w watchpoints = 2
        Nc: Probe(0): Connected&Reset. DpID: 0BC11477. CpuID: 00000C60. Info:
        [35004]DEBUG:launcher.core.stub: [stub (3333)] Nc: Debug protocol: SWD. RTCK: Disabled. Vector catch: Disabled.
        Ns: Content of CoreSight Debug ROM(s):
        [35004]DEBUG:launcher.core.stub: [stub (3333)] Nc: RBASE F0002000: CID B105100D PID 000008E000 ROM (type 0x1)
        [35004]DEBUG:launcher.core.stub: [stub (3333)] Nc: ROM 1 F0000000: CID B105900D PID 04000BB932 CSt ARM MTB type 0x31 Trace Sink – Basic trace router
        [35004]DEBUG:launcher.core.stub: [stub (3333)] Nc: ROM 1 F0001000: CID B105900D PID 000008E000 CSt MTBDWT type 0x4 Debug Control – Other
        [35004]DEBUG:launcher.core.stub: [stub (3333)] Nc: ROM 1 E00FF000: CID B105100D PID 04000BB4C0 ROM (type 0x1)
        [35004]DEBUG:launcher.core.stub: [stub (3333)] Nc: ROM 4 E000E000: CID B105E00D PID 04000BB008 Gen SCS (type 0x0)
        [35004]DEBUG:launcher.core.stub: [stub (3333)] Nc: ROM 4 E0001000: CID B105E00D PID 04000BB00A Gen DWT (type 0x0)
        [35004]DEBUG:launcher.core.stub: [stub (3333)] Nc: ROM 4 E0002000: CID B105E00D PID 04000BB00B Gen FPB (type 0x0)
        [35129]DEBUG:launcher.core.stub: [stub (3333)] Nc: NXP: MKL25Z128xxx4
        [35129]DEBUG:launcher.core.stub: [stub (3333)] Nc: DAP stride is 1024 bytes (256 words)
        [35129]DEBUG:launcher.core.stub: [stub (3333)] Nc: Inspected v.2 On chip Kinetis Flash memory module FTFA_1K.cfx
        Nc: Image ‘Kinetis SemiGeneric Mar 21 2023 12:58:07’
        [35129]DEBUG:launcher.core.stub: [stub (3333)] Nc: Opening flash driver FTFA_1K.cfx
        [35134]DEBUG:launcher.core.stub: [stub (3333)] Nc: Sending VECTRESET to run flash driver
        [35168]DEBUG:launcher.core.stub: [stub (3333)] Nc: Flash variant ‘KL25 FTFA Generic 1K’ detected (128KB = 128*1K at 0x0)
        Nc: Closing flash driver FTFA_1K.cfx
        [35184]DEBUG:launcher.core.stub: [stub (3333)] Pc: ( 65) Chip Setup Complete
        Pc: ( 70) License Check Complete
        Ns: Awaiting telnet connection to port 14444 …
        [35184]DEBUG:launcher.core.stub: Create connect task to stub’s semihost server
        [36917]DEBUG:launcher.core.stub: GDB (3333) -> stub (13333): b’$qSupported:multiprocess+;swbreak+;hwbreak+;qRelocInsn+;fork-events+;vfork-events+;exec-events+;vContSupported+;QThreadEvents+;no-resumed+;memory-tagging+#ec’
        [37202]DEBUG:launcher.core.stub: Connected to stub’s semihost server (14444)
        [37202]DEBUG:launcher.core.stub: [stub (3333)] Pc: ( 85) Registered Semihost Handler
        Pc: (100) Target Ready
        [37202]DEBUG:launcher.core.stub: stub (13333) -> GDB (3333): b’-‘
        [37202]DEBUG:launcher.core.stub: GDB (3333) -> stub (13333): b’$qSupported:multiprocess+;swbreak+;hwbreak+;qRelocInsn+;fork-events+;vfork-events+;exec-events+;vContSupported+;QThreadEvents+;no-resumed+;memory-tagging+#ec’
        [37202]DEBUG:launcher.core.stub: stub (13333) -> GDB (3333): b’+$PacketSize=4000;qXfer:memory-map:read+;qXfer:features:read+;QNonStop+#D7′
        [37202]DEBUG:launcher.core.stub: GDB (3333) -> stub (13333): b’+$vMustReplyEmpty#3a’
        [37202]DEBUG:launcher.core.stub: stub (13333) -> GDB (3333): b’+$#00′
        [37202]DEBUG:launcher.core.stub: GDB (3333) -> stub (13333): b’+$Hg0#df’
        [37202]DEBUG:launcher.core.stub: stub (13333) -> GDB (3333): b’+$OK#9A’
        [37202]DEBUG:launcher.core.stub: GDB (3333) -> stub (13333): b’+$qXfer:features:read:target.xml:0,1000#0c’
        [37218]DEBUG:launcher.core.stub: stub (13333) -> GDB (3333): b’+$l…
        [37218]DEBUG:launcher.core.stub: GDB (3333) -> stub (13333): b’+’
        [37218]DEBUG:launcher.core.stub: GDB (3333) -> stub (13333): b’$QNonStop:0#8c’
        [37218]DEBUG:launcher.core.stub: [stub (3333)] Na: GDB nonstop mode disabled (using allstop mode)
        [37218]DEBUG:launcher.core.stub: stub (13333) -> GDB (3333): b’+$OK#9A’
        [37218]DEBUG:launcher.core.stub: GDB (3333) -> stub (13333): b’+$qTStatus#49′
        [37218]DEBUG:launcher.core.stub: stub (13333) -> GDB (3333): b’+$#00′
        [37218]DEBUG:launcher.core.stub: GDB (3333) -> stub (13333): b’+$?#3f’
        [37218]DEBUG:launcher.core.stub: stub (13333) -> GDB (3333): b’+$S05#B8′
        [37218]DEBUG:launcher.core.stub: GDB (3333) -> stub (13333): b’+$qfThreadInfo#bb’
        [37218]DEBUG:launcher.core.stub: stub (13333) -> GDB (3333): b’+$m1OK#38′
        [37218]DEBUG:launcher.core.stub: GDB (3333) -> stub (13333): b’+$qsThreadInfo#c8′
        [37218]DEBUG:launcher.core.stub: stub (13333) -> GDB (3333): b’+$lOK#06′
        [37218]DEBUG:launcher.core.stub: GDB (3333) -> stub (13333): b’+$qAttached#8f’
        [37233]DEBUG:launcher.core.stub: stub (13333) -> GDB (3333): b’+$#00′
        [37233]DEBUG:launcher.core.stub: GDB (3333) -> stub (13333): b’+’
        [37250]DEBUG:launcher.core.stub: GDB (3333) -> stub (13333): b’$Hc-1#09′
        [37251]DEBUG:launcher.core.stub: stub (13333) -> GDB (3333): b’+$OK#9A’
        [37251]DEBUG:launcher.core.stub: GDB (3333) -> stub (13333): b’+$qC#b4′
        [37251]DEBUG:launcher.core.stub: stub (13333) -> GDB (3333): b’+$QC1#C5′
        [37251]DEBUG:launcher.core.stub: GDB (3333) -> stub (13333): b’+’
        [37252]DEBUG:launcher.core.stub: GDB (3333) -> stub (13333): b’$g#67′
        [37253]DEBUG:launcher.core.stub: stub (13333) -> GDB (3333): b’+$fffffffe…
        [37253]DEBUG:launcher.core.stub: GDB (3333) -> stub (13333): b’+$qfThreadInfo#bb’
        [37253]DEBUG:launcher.core.stub: stub (13333) -> GDB (3333): b’+$m1OK#38′
        [37253]DEBUG:launcher.core.stub: GDB (3333) -> stub (13333): b’+$qsThreadInfo#c8′
        [37253]DEBUG:launcher.core.stub: stub (13333) -> GDB (3333): b’+$lOK#06′
        [37253]DEBUG:launcher.core.stub: GDB (3333) -> stub (13333): b’+’
        [37253]DEBUG:launcher.core.stub: GDB (3333) -> stub (13333): b’$qXfer:memory-map:read::0,1000#ab’
        [37253]DEBUG:launcher.core.stub: stub (13333) -> GDB (3333): b’+$l…
        [37253]DEBUG:launcher.core.stub: GDB (3333) -> stub (13333): b’+’
        [37253]DEBUG:launcher.core.stub: GDB socket closed (3333). Closing stub socket (13333)
        [37253]DEBUG:launcher.core.stub: Stub socket closed (13333). Closing GDB socket (3333)
        [37253]INFO:launcher.cli.cmd.gdbserver: Disconnected from core cm0plus
        [37253]DEBUG:launcher.core.stub: [stub (3333)] Wc: GDB stub (C:\NXP\LinkServer_1.0.9\binaries\crt_emu_cm_redlink.exe) terminating – GDB protocol problem: Pipe has been closed by GDB.
        [38274]DEBUG:launcher.core.stub: Stub stdout socket closed (15555)
        Gdbserver on port 3333 has closed
        [38274]DEBUG:launcher.core.redlinkserv: [write] exit
        [38274]DEBUG:launcher.core.redlinkserv: Waiting for redlinkserv to close
        [38506]DEBUG:launcher.core.redlinkserv: Redlinkserv has closed

        KL25 with default NXP program that does connect:

        [109]DEBUG:asyncio: Using proactor: IocpProactor
        [732]INFO:launcher.cli.utils.funcs: Exact match for MKL25Z128xxx4:FRDM-KL25Z found
        [734]INFO:launcher.cli.utils.click: Selected device MKL25Z128xxx4:FRDM-KL25Z
        [734]DEBUG:launcher.core.redlinkserv: Starting redlinkserv: C:\NXP\LinkServer_1.0.9\binaries\redlinkserv.exe [‘–port’, ‘11111’, ‘–telnetport’, ‘12222’, ‘–no-telnet-defaults’]
        [734]DEBUG:launcher.core.probeboot: Listing usb devices
        [734]DEBUG:launcher.core.utils: Subprocess exec: cscript [‘/nologo’, ‘C:\\NXP\\LinkServer_1.0.9\\binaries\\Scripts\\listusb.vbs’]
        [743]DEBUG:launcher.core.redlinkserv: Connecting to redlinkserv (localhost:12222)
        [1069]DEBUG:launcher.core.probeboot: Found 36 USB devices
        [2775]DEBUG:launcher.core.redlinkserv: Connected to redlinkserv
        [2775]DEBUG:launcher.core.redlinkserv: [read]
        [2775]INFO:launcher.cli.utils.click: Getting available probes
        [2775]DEBUG:launcher.core.redlinkserv: [write] probelist
        [3011]DEBUG:launcher.core.redlinkserv: [read] Index = 1
        Manufacturer = NXP Semiconductors
        Description = MCU-LINK (r0FF) CMSIS-DAP V3.108
        Serial Number = abcdefg
        VID:PID = 1FC9:0143
        Path = 0002:000c:00
        [3011]INFO:launcher.cli.utils.click: Selected probe #1 X3WAY4DLLPZI0 (MCU-LINK (r0FF) CMSIS-DAP V3.108)
        [3011]DEBUG:launcher.core.redlinkserv: [write] probeopenbyindex 1
        [3027]DEBUG:launcher.core.redlinkserv: [read] Probe Handle 1 Open
        [3027]DEBUG:launcher.core.redlinkserv: [write] wireswdconnect 1
        [3042]DEBUG:launcher.core.redlinkserv: [read] DpID = 0BC11477
        [3042]DEBUG:launcher.core.redlinkserv: [write] coreconfig 1
        [3042]DEBUG:launcher.core.redlinkserv: [read] Number of CORES/TAPs = 1, Fully recognized: True
        [3042]DEBUG:launcher.core.redlinkserv: [write] corelist 1
        [3042]DEBUG:launcher.core.redlinkserv: [read] TAP 0: 0BC11477 Core 0: M0+ APID: 04770031 ROM Table: F0002003
        [3042]DEBUG:launcher.cli.cmd.gdbserver: Starting stubs
        [3042]DEBUG:launcher.core.stub: Created stub XMLs in C:\Temp\tmpk02iryyu
        [3042]DEBUG:launcher.core.stub: Internal gdbserver (3333) ports: stub_port=13333, sh_stub_port=14444, stdout_port=15555
        [3042]DEBUG:launcher.core.stub: GDB server args: [‘–redlink-port’, ‘11111’, ‘–flash-dir’, ‘C:\\NXP\\LinkServer_1.0.9\\binaries\\Flash’, ‘-x’, ‘C:\\Temp\\tmpk02iryyu’, ‘-pMKL25Z128xxx4’, ‘–vendor’, ‘NXP’, ‘-g’, ‘–cache’, ‘dis’, ‘–probeserial’, ‘X3WAY4DLLPZI0’, ‘–coreindex’, ‘0’, ‘–kill-server’, ‘–server’, ‘localhost:13333’, ‘–telnet’, ‘14444’, ‘–msg-port’, ‘15555’, ‘–connectscript’, ‘kinetisconnect.scp’]
        GDB server listening on port 3333 in debug mode (core cm0plus)
        Semihosting server listening on port 4444 (core cm0plus)
        [3059]DEBUG:launcher.core.stub: [stub (3333)] Ns: MCUXpresso IDE RedlinkMulti Driver v11.7 (Mar 22 2023 09:52:55 – crt_emu_cm_redlink.exe build 13)
        [19376]DEBUG:launcher.core.stub: Received connection to our GDB server (3333)
        [21399]DEBUG:launcher.core.stub: Connected to stub’s GDB port (13333)
        [21399]INFO:launcher.cli.cmd.gdbserver: Connected to core cm0plus
        [21399]DEBUG:launcher.core.stub: GDB (3333) -> stub (13333): b’+$qSupported:multiprocess+;swbreak+;hwbreak+;qRelocInsn+;fork-events+;vfork-events+;exec-events+;vContSupported+;QThreadEvents+;no-resumed+;memory-tagging+#ec$qSupported:multiprocess+;swbreak+;hwbreak+;qRelocInsn+;fork-events+;vfork-events+;exec-events+;vContSupported+;QThreadEvents+;no-resumed+;memory-tagging+#ec’
        [21399]DEBUG:launcher.core.stub: [stub (3333)] Pc: ( 0) Reading remote configuration
        [21399]DEBUG:launcher.core.stub: [stub (3333)] Wc(03). No cache support.
        [21399]DEBUG:launcher.core.stub: [stub (3333)] Nc: Found chip XML file in C:\Temp\tmpk02iryyu\MKL25Z128xxx4.xml
        [21399]DEBUG:launcher.core.stub: [stub (3333)] Pc: ( 5) Remote configuration complete
        [21399]DEBUG:launcher.core.stub: [stub (3333)] Nc: Reconnected to existing LinkServer process.
        [21484]DEBUG:launcher.core.stub: [stub (3333)] Wc: ============= SCRIPT: kinetisconnect.scp =============
        Wc: Kinetis Connect Script
        Wc: Connecting to Probe Index = 1
        Wc: This probe = 1
        Wc: This TAP = 0
        Wc: This core = 0
        Wc: DpID = 0BC11477
        Wc: Assert NRESET
        Wc: Reset pin state: 00
        Wc: Power up Debug
        Wc: MDM-AP APID: 0x001C0020
        Wc: MDM-AP System Reset/Hold Reset/Debug Request
        [21484]DEBUG:launcher.core.stub: [stub (3333)] Wc: MDM-AP Control: 0x0000001C
        Wc: MDM-AP Status (Flash Ready) : 0x00000032
        Wc: Part is not secured
        Wc: MDM-AP Control: 0x00000014
        Wc: Release NRESET
        Wc: Reset pin state: 01
        Wc: MDM-AP Control (Debug Request): 0x00000004
        Wc: MDM-AP Status: 0x0001003A
        Wc: MDM-AP Core Halted
        Wc: ============= END SCRIPT =============================
        [21484]DEBUG:launcher.core.stub: [stub (3333)] Nc: Probe Firmware: MCU-LINK (r0FF) CMSIS-DAP V3.108 (NXP Semiconductors)
        Nc: Serial Number: X3WAY4DLLPZI0
        Nc: VID:PID: 1FC9:0143
        Nc: USB Path: 0002:000c:00
        [21484]DEBUG:launcher.core.stub: [stub (3333)] Nc: Using memory from core 0 after searching for a good core
        [21484]DEBUG:launcher.core.stub: [stub (3333)] Pc: ( 30) Emulator Connected
        [21484]DEBUG:launcher.core.stub: [stub (3333)] Pc: ( 40) Debug Halt
        [21500]DEBUG:launcher.core.stub: [stub (3333)] Pc: ( 50) CPU ID
        [21500]DEBUG:launcher.core.stub: [stub (3333)] Nc: debug interface type = CoreSight DP (DAP DP ID 0BC11477) over SWD TAP 0
        Nc: processor type = Cortex-M0+ (CPU ID 00000C60) on DAP AP 0
        [21500]DEBUG:launcher.core.stub: [stub (3333)] Nc: number of h/w breakpoints = 2
        Nc: number of flash patches = 0
        [21500]DEBUG:launcher.core.stub: [stub (3333)] Nc: number of h/w watchpoints = 2
        Nc: Probe(0): Connected&Reset. DpID: 0BC11477. CpuID: 00000C60. Info:
        [21500]DEBUG:launcher.core.stub: [stub (3333)] Nc: Debug protocol: SWD. RTCK: Disabled. Vector catch: Disabled.
        Ns: Content of CoreSight Debug ROM(s):
        [21500]DEBUG:launcher.core.stub: [stub (3333)] Nc: RBASE F0002000: CID B105100D PID 000008E000 ROM (type 0x1)
        [21500]DEBUG:launcher.core.stub: [stub (3333)] Nc: ROM 1 F0000000: CID B105900D PID 04000BB932 CSt ARM MTB type 0x31 Trace Sink – Basic trace router
        [21500]DEBUG:launcher.core.stub: [stub (3333)] Nc: ROM 1 F0001000: CID B105900D PID 000008E000 CSt MTBDWT type 0x4 Debug Control – Other
        [21500]DEBUG:launcher.core.stub: [stub (3333)] Nc: ROM 1 E00FF000: CID B105100D PID 04000BB4C0 ROM (type 0x1)
        [21500]DEBUG:launcher.core.stub: [stub (3333)] Nc: ROM 4 E000E000: CID B105E00D PID 04000BB008 Gen SCS (type 0x0)
        [21515]DEBUG:launcher.core.stub: [stub (3333)] Nc: ROM 4 E0001000: CID B105E00D PID 04000BB00A Gen DWT (type 0x0)
        [21515]DEBUG:launcher.core.stub: [stub (3333)] Nc: ROM 4 E0002000: CID B105E00D PID 04000BB00B Gen FPB (type 0x0)
        [21631]DEBUG:launcher.core.stub: [stub (3333)] Nc: NXP: MKL25Z128xxx4
        [21631]DEBUG:launcher.core.stub: [stub (3333)] Nc: DAP stride is 1024 bytes (256 words)
        [21631]DEBUG:launcher.core.stub: [stub (3333)] Nc: Inspected v.2 On chip Kinetis Flash memory module FTFA_1K.cfx
        Nc: Image ‘Kinetis SemiGeneric Mar 21 2023 12:58:07’
        [21631]DEBUG:launcher.core.stub: [stub (3333)] Nc: Opening flash driver FTFA_1K.cfx
        [21631]DEBUG:launcher.core.stub: [stub (3333)] Nc: Sending VECTRESET to run flash driver
        [21672]DEBUG:launcher.core.stub: [stub (3333)] Nc: Flash variant ‘KL25 FTFA Generic 1K’ detected (128KB = 128*1K at 0x0)
        Nc: Closing flash driver FTFA_1K.cfx
        [21682]DEBUG:launcher.core.stub: [stub (3333)] Pc: ( 65) Chip Setup Complete
        Pc: ( 70) License Check Complete
        Ns: Awaiting telnet connection to port 14444 …
        [21682]DEBUG:launcher.core.stub: Create connect task to stub’s semihost server
        [23413]DEBUG:launcher.core.stub: GDB (3333) -> stub (13333): b’$qSupported:multiprocess+;swbreak+;hwbreak+;qRelocInsn+;fork-events+;vfork-events+;exec-events+;vContSupported+;QThreadEvents+;no-resumed+;memory-tagging+#ec’
        [23714]DEBUG:launcher.core.stub: Connected to stub’s semihost server (14444)
        [23714]DEBUG:launcher.core.stub: [stub (3333)] Pc: ( 85) Registered Semihost Handler
        Pc: (100) Target Ready
        [23714]DEBUG:launcher.core.stub: stub (13333) -> GDB (3333): b’-‘
        [23714]DEBUG:launcher.core.stub: GDB (3333) -> stub (13333): b’$qSupported:multiprocess+;swbreak+;hwbreak+;qRelocInsn+;fork-events+;vfork-events+;exec-events+;vContSupported+;QThreadEvents+;no-resumed+;memory-tagging+#ec’
        [23714]DEBUG:launcher.core.stub: stub (13333) -> GDB (3333): b’+$PacketSize=4000;qXfer:memory-map:read+;qXfer:features:read+;QNonStop+#D7′
        [23714]DEBUG:launcher.core.stub: GDB (3333) -> stub (13333): b’+$vMustReplyEmpty#3a’
        [23714]DEBUG:launcher.core.stub: stub (13333) -> GDB (3333): b’+$#00′
        [23714]DEBUG:launcher.core.stub: GDB (3333) -> stub (13333): b’+$Hg0#df’
        [23714]DEBUG:launcher.core.stub: stub (13333) -> GDB (3333): b’+$OK#9A’
        [23714]DEBUG:launcher.core.stub: GDB (3333) -> stub (13333): b’+’
        [23714]DEBUG:launcher.core.stub: GDB (3333) -> stub (13333): b’$qXfer:features:read:target.xml:0,1000#0c’
        [23714]DEBUG:launcher.core.stub: stub (13333) -> GDB (3333): b’+$l…
        [23714]DEBUG:launcher.core.stub: GDB (3333) -> stub (13333): b’+’
        [23714]DEBUG:launcher.core.stub: GDB (3333) -> stub (13333): b’$QNonStop:0#8c’
        [23714]DEBUG:launcher.core.stub: [stub (3333)] Na: GDB nonstop mode disabled (using allstop mode)
        [23714]DEBUG:launcher.core.stub: stub (13333) -> GDB (3333): b’+$OK#9A’
        [23714]DEBUG:launcher.core.stub: GDB (3333) -> stub (13333): b’+$qTStatus#49′
        [23714]DEBUG:launcher.core.stub: stub (13333) -> GDB (3333): b’+$#00′
        [23722]DEBUG:launcher.core.stub: GDB (3333) -> stub (13333): b’+$?#3f’
        [23722]DEBUG:launcher.core.stub: stub (13333) -> GDB (3333): b’+$S05#B8′
        [23722]DEBUG:launcher.core.stub: GDB (3333) -> stub (13333): b’+$qfThreadInfo#bb’
        [23722]DEBUG:launcher.core.stub: stub (13333) -> GDB (3333): b’+$m1OK#38′
        [23723]DEBUG:launcher.core.stub: GDB (3333) -> stub (13333): b’+$qsThreadInfo#c8′
        [23723]DEBUG:launcher.core.stub: stub (13333) -> GDB (3333): b’+$lOK#06′
        [23723]DEBUG:launcher.core.stub: GDB (3333) -> stub (13333): b’+$qAttached#8f’
        [23723]DEBUG:launcher.core.stub: stub (13333) -> GDB (3333): b’+$#00′
        [23723]DEBUG:launcher.core.stub: GDB (3333) -> stub (13333): b’+’
        [23725]DEBUG:launcher.core.stub: GDB (3333) -> stub (13333): b’$Hc-1#09′
        [23725]DEBUG:launcher.core.stub: stub (13333) -> GDB (3333): b’+$OK#9A’
        [23725]DEBUG:launcher.core.stub: GDB (3333) -> stub (13333): b’+$qC#b4′
        [23725]DEBUG:launcher.core.stub: stub (13333) -> GDB (3333): b’+$QC1#C5′
        [23725]DEBUG:launcher.core.stub: GDB (3333) -> stub (13333): b’+$g#67′
        [23739]DEBUG:launcher.core.stub: stub (13333) -> GDB (3333): b’+$0a00000048…
        [23739]DEBUG:launcher.core.stub: GDB (3333) -> stub (13333): b’+$qfThreadInfo#bb’
        [23739]DEBUG:launcher.core.stub: stub (13333) -> GDB (3333): b’+$m1OK#38′
        [23739]DEBUG:launcher.core.stub: GDB (3333) -> stub (13333): b’+$qsThreadInfo#c8′
        [23740]DEBUG:launcher.core.stub: stub (13333) -> GDB (3333): b’+$lOK#06′
        [23740]DEBUG:launcher.core.stub: GDB (3333) -> stub (13333): b’+’
        [23740]DEBUG:launcher.core.stub: GDB (3333) -> stub (13333): b’$qXfer:memory-map:read::0,1000#ab’
        [23740]DEBUG:launcher.core.stub: stub (13333) -> GDB (3333): b’+$l…
        [23742]DEBUG:launcher.core.stub: GDB (3333) -> stub (13333): b’+’
        [23742]DEBUG:launcher.core.stub: GDB (3333) -> stub (13333): b’$m4f0,4#97′
        [23742]DEBUG:launcher.core.stub: stub (13333) -> GDB (3333): b’+$46494748#AE’
        [23742]DEBUG:launcher.core.stub: GDB (3333) -> stub (13333): b’+$p19#da’
        [23742]DEBUG:launcher.core.stub: stub (13333) -> GDB (3333): b’+$00000001#81′
        [23742]DEBUG:launcher.core.stub: GDB (3333) -> stub (13333): b’+’
        [23742]DEBUG:launcher.core.stub: GDB (3333) -> stub (13333): b’$m4f0,2#95′
        [23742]DEBUG:launcher.core.stub: stub (13333) -> GDB (3333): b’+$4649#D7′
        [23742]DEBUG:launcher.core.stub: GDB (3333) -> stub (13333): b’+’
        [23742]DEBUG:launcher.core.stub: GDB (3333) -> stub (13333): b’$m4c0,40#c4′
        [23752]DEBUG:launcher.core.stub: stub (13333) -> GDB (3333): b’+$69f901f053f8c0460000080000300020000000000000000000faff1fb0ffff1f8d1500007046eff30981eff30882d7e0464947488824421a464b650190100022#65′
        [23752]DEBUG:launcher.core.stub: GDB (3333) -> stub (13333): b’+’

        Like

  4. Moving the boards to my laptop and adding –allow-remote to gdbserver got things to be more consistent. Alas trying to erase the Flash with LinkServe also fails, so the whole connecting thing is just misleading.

    Getting back to the original problem of the KL32L2A,
    still can not get anything meaningful to happen with MCU-Link connected to a K32L2A.

    The K32L2A It is very similar to the KL28, with
    some security features added, and twice the memory.

    [9468]DEBUG:launcher.core.stub: [stub (3333)] Nc: connection failed –
    Em(01). Cannot find MEM-AP selected by core index (check target power).. Retrying

    The ‘check target power’ is boughs as the [write wireswdconnect would return Wire Ack Fault if there is no power or bad cable.

    The wireswdconnect indicates that the board is connected.
    The Kinetis Connect Script, later in the output, indicates that it is
    not.

    ?


    [2956]DEBUG:launcher.core.redlinkserv: [write] probeopenbyindex 1
    [2956]DEBUG:launcher.core.redlinkserv: [read] Probe Handle 1 Open
    [2956]DEBUG:launcher.core.redlinkserv: [write] wireswdconnect 1
    [2972]DEBUG:launcher.core.redlinkserv: [read] DpID = 2BA01477
    [2972]DEBUG:launcher.core.redlinkserv: [write] coreconfig 1
    [2988]DEBUG:launcher.core.redlinkserv: [read] Number of CORES/TAPs = 1, Fully recognized: True
    [2988]DEBUG:launcher.core.redlinkserv: [write] corelist 1
    [2988]DEBUG:launcher.core.redlinkserv: [read]

    Wc: Kinetis Connect Script
    Wc: Connecting to Probe Index = 1
    Wc: This probe = 1
    Wc: This TAP = 0
    Wc: This core = 0
    Wc: DpID = 2BA01477
    Wc: Assert NRESET
    Wc: Reset pin state: 00
    Wc: Error: Wire Ack Wait Fault
    Wc: Power up Debug
    Wc: Error: Wire Ack Wait Fault
    Wc: Error: Wire Ack Wait Fault
    [9421]DEBUG:launcher.core.stub: [stub (3333)] Wc: Error: Wire Ack Wait Fault
    Wc: MDM-AP APID: 0xF0000F00
    Wc: MDP-AP Not Found

    Full output:

    linkserver -l 5 gdbserver –allow-remote K32L2A41xxxxA:FRDM-K32L2A4S
    [110]DEBUG:asyncio: Using proactor: IocpProactor
    [721]INFO:launcher.cli.utils.funcs: Exact match for K32L2A41xxxxA:FRDM-K32L2A4S found
    [721]INFO:launcher.cli.utils.click: Selected device K32L2A41xxxxA:FRDM-K32L2A4S
    [721]DEBUG:launcher.core.redlinkserv: Starting redlinkserv: C:\NXP\LinkServer\binaries\redlinkserv.exe [‘–port’, ‘11111’, ‘–telnetport’, ‘12222’, ‘–no-telnet-defaults’]
    [735]DEBUG:launcher.core.probeboot: Listing usb devices
    [735]DEBUG:launcher.core.utils: Subprocess exec: cscript [‘/nologo’, ‘C:\\NXP\\LinkServer\\binaries\\Scripts\\listusb.vbs’]
    [738]DEBUG:launcher.core.redlinkserv: Connecting to redlinkserv (localhost:12222)
    [1072]DEBUG:launcher.core.probeboot: Found 16 USB devices
    [2783]DEBUG:launcher.core.redlinkserv: Connected to redlinkserv
    [2783]DEBUG:launcher.core.redlinkserv: [read]
    [2783]INFO:launcher.cli.utils.click: Getting available probes
    [2783]DEBUG:launcher.core.redlinkserv: [write] probelist
    [2941]DEBUG:launcher.core.redlinkserv: [read] Index = 1
    Manufacturer = NXP Semiconductors
    Description = MCU-LINK (r0FF) CMSIS-DAP V3.108
    Serial Number = abcdefg
    VID:PID = 1FC9:0143
    Path = 0001:0005:00
    [2956]INFO:launcher.cli.utils.click: Selected probe #1 abcdefg (MCU-LINK (r0FF) CMSIS-DAP V3.108)
    [2956]DEBUG:launcher.core.redlinkserv: [write] probeopenbyindex 1
    [2956]DEBUG:launcher.core.redlinkserv: [read] Probe Handle 1 Open
    [2956]DEBUG:launcher.core.redlinkserv: [write] wireswdconnect 1
    [2972]DEBUG:launcher.core.redlinkserv: [read] DpID = 2BA01477
    [2972]DEBUG:launcher.core.redlinkserv: [write] coreconfig 1
    [2988]DEBUG:launcher.core.redlinkserv: [read] Number of CORES/TAPs = 1, Fully recognized: True
    [2988]DEBUG:launcher.core.redlinkserv: [write] corelist 1
    [2988]DEBUG:launcher.core.redlinkserv: [read]
    [2988]DEBUG:launcher.cli.cmd.gdbserver: Starting stubs
    [2988]DEBUG:launcher.core.stub: Created stub XMLs in C:\Temp\TEMPWI~1\tmp7kfv2xy0
    [2988]DEBUG:launcher.core.stub: Internal gdbserver (3333) ports: stub_port=13333, sh_stub_port=14444, stdout_port=15555
    [2988]DEBUG:launcher.core.stub: GDB server args: [‘–redlink-port’, ‘11111’, ‘–flash-dir’, ‘C:\\NXP\\LinkServer\\binaries\\Flash’, ‘-x’, ‘C:\\Temp\\TEMPWI~1\\tmp7kfv2xy0’, ‘-pK32L2A41xxxxA’, ‘–vendor’, ‘NXP’, ‘-g’, ‘–cache’, ‘dis’, ‘–probeserial’, ‘abcdefg’, ‘–coreindex’, ‘0’, ‘–kill-server’, ‘–server’, ‘localhost:13333’, ‘–telnet’, ‘14444’, ‘–msg-port’, ‘15555’, ‘–connectscript’, ‘kinetisconnect.scp’]
    GDB server listening on port 3333 in debug mode (core cm0plus)
    Semihosting server listening on port 4444 (core cm0plus)
    [3020]DEBUG:launcher.core.stub: [stub (3333)] Ns: MCUXpresso IDE RedlinkMulti Driver v11.7 (Mar 22 2023 09:52:55 – crt_emu_cm_redlink.exe build 13)
    [7335]DEBUG:launcher.core.stub: Received connection to our GDB server (3333)
    [9359]DEBUG:launcher.core.stub: Connected to stub’s GDB port (13333)
    [9359]INFO:launcher.cli.cmd.gdbserver: Connected to core cm0plus
    [9359]DEBUG:launcher.core.stub: GDB (3333) -> stub (13333): b’+$qSupported:multiprocess+;swbreak+;hwbreak+;qRelocInsn+;fork-events+;vfork-events+;exec-events+;vContSupported+;QThreadEvents+;no-resumed+;memory-tagging+#ec$qSupported:multiprocess+;swbreak+;hwbreak+;qRelocInsn+;fork-events+;vfork-events+;exec-events+;vContSupported+;QThreadEvents+;no-resumed+;memory-tagging+#ec’
    [9359]DEBUG:launcher.core.stub: [stub (3333)] Pc: ( 0) Reading remote configuration
    [9359]DEBUG:launcher.core.stub: [stub (3333)] Wc(03). No cache support.
    [9359]DEBUG:launcher.core.stub: [stub (3333)] Nc: Found chip XML file in C:\Temp\TEMPWI~1\tmp7kfv2xy0\K32L2A41xxxxA.xml
    [9359]DEBUG:launcher.core.stub: [stub (3333)] Pc: ( 5) Remote configuration complete
    [9359]DEBUG:launcher.core.stub: [stub (3333)] Nc: Reconnected to existing LinkServer process.
    [9421]DEBUG:launcher.core.stub: [stub (3333)] Wc: ============= SCRIPT: kinetisconnect.scp =============
    Wc: Kinetis Connect Script
    Wc: Connecting to Probe Index = 1
    Wc: This probe = 1
    Wc: This TAP = 0
    Wc: This core = 0
    Wc: DpID = 2BA01477
    Wc: Assert NRESET
    Wc: Reset pin state: 00
    Wc: Error: Wire Ack Wait Fault
    Wc: Power up Debug
    Wc: Error: Wire Ack Wait Fault
    Wc: Error: Wire Ack Wait Fault
    [9421]DEBUG:launcher.core.stub: [stub (3333)] Wc: Error: Wire Ack Wait Fault
    Wc: MDM-AP APID: 0xF0000F00
    Wc: MDP-AP Not Found
    Wc: ============= END SCRIPT =============================
    [9437]DEBUG:launcher.core.stub: [stub (3333)] Nc: Probe Firmware: MCU-LINK (r0FF) CMSIS-DAP V3.108 (NXP Semiconductors)
    Nc: Serial Number: abcdefg
    Nc: VID:PID: 1FC9:0143
    Nc: USB Path: 0001:0005:00
    [9468]DEBUG:launcher.core.stub: [stub (3333)] Nc: connection failed – Em(01). Cannot find MEM-AP selected by core index (check target power).. Retrying
    [9500]DEBUG:launcher.core.stub: [stub (3333)] Ed:02: Failed on connect: Em(01). Cannot find MEM-AP selected by core index (check target power)
    Et: Probe(0): Connected&Reset. Was: NotConnected. DpID: 2BA01477. CpuID: 00000000. Info:
    Nc: Last stub error 0: OK
    Nc: Last sticky error: 0x0 AIndex: 0
    Nc: No debug bus (MemAp) selected
    Nc: DAP Speed test unexecuted or failed
    [9500]DEBUG:launcher.core.stub: [stub (3333)] Nc: Debug protocol: SWD. RTCK: Disabled. Vector catch: Disabled.
    Pc: (100) Target Connection Failed
    [10516]DEBUG:launcher.core.stub: Stub stdout socket closed (15555)
    [10516]DEBUG:launcher.core.stub: Stub socket closed (13333). Closing GDB socket (3333)
    [10516]DEBUG:launcher.core.stub: GDB socket closed (3333). Closing stub socket (13333)
    [10516]INFO:launcher.cli.cmd.gdbserver: Disconnected from core cm0plus
    Gdbserver on port 3333 has closed
    [10516]DEBUG:launcher.core.redlinkserv: [write] exit
    [10516]DEBUG:launcher.core.redlinkserv: Waiting for redlinkserv to close
    [10971]DEBUG:launcher.core.redlinkserv: Redlinkserv has closed

    Like

  5. Pingback: How to recover microcontrollers with a script #Debugging #Scripting @MCUonEclipse « Adafruit Industries – Makers, hackers, artists, designers and engineers!

What do you think?

This site uses Akismet to reduce spam. Learn how your comment data is processed.