MCUXpresso IDE: Terminate and Disconnect a Debug Session

Eclipse for C/C++ (CDT) offers two different ways to get out of a debug session: Terminate and Disconnect:

Terminate and Disconnect

Terminate and Disconnect

The terminate and disconnect behaviour is not standardized, and varies between Eclipse distributions and debug connection. This article is about how things are handled in MCUXpresso IDE, and how I can influence the behaviour.

MCUXpresso IDE Series

This article is part of a series to get up to speed using the new NXP MCUXpresso IDE. Published so far are:

Outline

With debugging with Eclipse, there are two different ways to end a debug session:

  • Terminate:
    Terminate Button

    Terminate Button

    The expected behaviour is to stop the target under debug and disconnect from it and leave it in the stopped state. Similar like the ‘stop button’ on audio or video devices.

  • Disconnect:
    Disconnect Button

    Disconnect Button

    The expected behaviour is to leave the target as it is (running, suspended) and disconnect the debugger from the target.

Behaviour in MCUXpresso IDE V10.0.0

As said in the introduction text, the behaviour depends on the Eclipse distribution and run control. I know that especially ‘disconnect’ varies a lot, to the point that plugin owners even disable the ‘disconnect’ button. So here is how things are working in MCUXpresso IDE:

  • MCUXpresso IDE V10.0.0 b344
  • P&E plugin 2.9.4.201704202022
  • SEGGER J-Link software V6.14b
  • LinkServer (LPC-Link2)

The following table summarizes the behaviour:

Action Expected P&E SEGGER
(MCUXpresso)
SEGGER
(GNU ARM Eclipse)
LinkServer
Terminate while suspended Halt target, disconnect OK: Halt target, disconnect Restart OK: Halt target, disconnect Target keeps running (configurable)
Terminate while running Halt target, disconnect OK: Halt target, disconnect Restart Halt Target, disconnect Target keeps running (configurable)
Disconnect while suspended Disconnect, target remains haltet Target keeps running not possible Button disabled Button disabled
Disconnect while running Disconnect, target continues running OK: Disconnect, Target continues running not possible Button disabled Button disabled

With the exception of disconnect while suspended, the P&E connection behaves as expected. The Segger GDB connection throws an error for disconnect, and the terminate action seems to exposes some race conditions. The LinkServer has the terminate button disabled.

Below some tips how to configure the behaviour.

P&E

The P&E connection offers both the ‘terminate’ and ‘disconnect’ buttons, so it is close to perfect. But there are no settings I’m aware of to configure the behaviour in the launch configuration.

LinkServer Configuration

The LinkServer (LPC-Link2/LPC-Link/CMSIS-DAP) connection offers the terminate button and the disconnect button is grayed out/disabled.

The Linkserver terminate action can be configured in the Debugger configuration settings under the ‘Debugger’ tab. The setting can be easily missed as the ‘terminate’ action is behind the ‘disconnect’ setting:

LinkServer Terminate Behaviour

LinkServer Terminate Behaviour

It has the following options:

  • nochange: I’m not clear on this one, but it does a ‘stop’ followed by a ‘disconnect’?
  • stop: send ‘stop’, followed by ‘disconnect’
  • cont: send ‘continue’, followed by ‘disconnect’
  • run_cont: Does a ‘restart’ (‘stop’ followed by ‘restart’ and ‘disconnect’)

While this is a very flexible way to configure the ‘terminate’ action, it would be easier to use if the ‘disconnect’ button would be available. Otherwise I always have to go into the launch configuration and change the settings.

SEGGER (GNU ARM Eclipse)

For Segger J-Link debugging, there is the option to install the GNU ARM Eclipse plugins (see “MCUXpresso IDE: Importing Kinetis Design Studio Projects“). With the GNU ARM Eclipse plugins the disconnect button is disabled.

There is a feature request on this (https://sourceforge.net/p/gnuarmeclipse/feature-requests/106/), and the workaround is to

  1. Suspend the target with the toolbar button (Pause button)
  2. In the arm-none-eabi-gdb console, execute ‘monitor go’
  3. Followed by ‘disconnect’

The ‘terminate’ always does a ‘restart’.

There is an option to change this so the targets does not restart. From the Segger J-Link manual:

SetRestartOnClose Manual Entry

SetRestartOnClose Manual Entry

Add the following to the ‘Startup’ tab in the ‘Run/Restart’ Commands:

monitor exec SetRestartOnClose=0
SetRestartOnClose

SetRestartOnClose

What it does for me is to reset the target but keep it halted.

SEGGER (MCUXPresso)

The Segger J-Link plugin which comes with MCUXpresso has the disconnect button available, but is currently not supported:

002,487 (gdb) 
006,732 31-target-detach i1
006,736 31^error,msg="Remote doesn't know how to detach"
006,737 (gdb) 
006,737 32-target-detach --thread-group i1
006,746 32^error,msg="Remote doesn't know how to detach"

 

Summary

Terminate and Disconnect can mean different things for different Eclipse implementations. The P&E implementation is mostly following what I expect, and the NXP LinkServer implementation has configuration setting for the terminate action. If using the Segger J-Link in MCUXpresso IDE, with using the GNU ARM Eclipse plugin I have a command line option to control the J-Link behaviour.

Happy Terminating 🙂

Links

 

Advertisements

8 thoughts on “MCUXpresso IDE: Terminate and Disconnect a Debug Session

  1. Pingback: MCUXpresso IDE: Installing Processor Expert into Eclipse Neon | MCU on Eclipse

  2. Pingback: MCUXpresso IDE: Importing Kinetis Design Studio Projects | MCU on Eclipse

  3. Pingback: MCUXpresso IDE: S-Record, Intel Hex and Binary Files | MCU on Eclipse

  4. Pingback: MCUXpresso IDE: Adding the Eclipse Marketplace Client | MCU on Eclipse

  5. Pingback: MCUXpresso IDE: Unified Eclipse IDE for NXPs ARM Cortex-M Microcontrollers | MCU on Eclipse

  6. Another way to stop debug can by terminate button which on console view. The terminate button which on toolbar has some problem for GNU ARM Eclipse, It will halt cpu when stop debug. But i want the cpu is running when debug session was stopped.

    Like

  7. Pingback: MCUXPresso IDE: Blinky the NXP LPC800-DIP Board | MCU on Eclipse

What do you think?

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s