The J-Link hardware debugging Eclipse plug-in

时间:2014-05-17 14:32:55   收藏:0   阅读:890

Quicklinks

If you already know what are the features of the new plug-in and just want to know how to install/use it, you can directly skip to:

Why a new plug-in?

Until now, debugging with the J-Link probe in Eclipse was done via the GDB Hardware Debugging Plug-in. For experimental projects it was more or less ok, but for serious development it was quite tedious. The missing features, that were added to this plug-in, are:

Prerequisites

Before being able to use the J-Link probe with the GNU ARM Eclipse Plug-in, you must separately install:

If you did not do it yet, please follow the instructions in the J-Link install page and return when completed.

J-Link plug-in usage

Define the J-Link folder location

Before starting work with the J-Link tools, it is recommended to define a global variable with the path to the J-Link folder.

bubuko.com,布布扣

Define a global variable with the path to the J-Link tools.

It is recommended to define the path to the GDB server relative to this variable in all your debug configurations, to have a single place to update the path when a new version of the J-Link tools is released.

Create the debugger configuration

Being a standard debugger, this plug-in also uses the Eclipse standard method of creating debugger configurations for each application. After you successfully build your application, you can create a new debug configuration following these steps:

bubuko.com,布布扣

Debug configurations menu

bubuko.com,布布扣

J-Link Debug Configurations.

bubuko.com,布布扣

The Main tab.

bubuko.com,布布扣

The J-Link Debugger tab.

bubuko.com,布布扣

The J-Link Startup tab.

bubuko.com,布布扣

Shared debug configuration.

bubuko.com,布布扣

Debug configuration stored in the project.

Start a debug session

Before starting a debug session, be sure that:

With all the above steps completed properly, you can start the debug session:

Alternatively, you can use the bug specific icon. Do not press it directly, since it will not behave as expected; instead, click the down arrow button:

bubuko.com,布布扣

Down arrow debug.

This will open a new window where you can select the desired debug configuration:

bubuko.com,布布扣

Select the debug configuration.

If everything is ok, after a few seconds required to start the server, to allow it to connect to the target, start the gdb client, download the application and start the debugging session, you should see something like this:

bubuko.com,布布扣

The new debug session, with three consoles.

Since the first breakpoint was set in the Debugger tab to main, the execution stopped right at the beginning of the main() function, which in this case is a tracing printf().

To see the content of the other consoles, just select them in the top left window. For example the server console might look like this:

bubuko.com,布布扣

The GDB server console.

Similarly for the tracing console:

bubuko.com,布布扣

The tracing console.

Show console when standard out/error change

This is the default Eclipse behaviour when multiple consoles are active, to automatically switch to the latest updated. In our case, especially when the Semihosting/SWV console is also active, the focus will jump between windows, making things impossible to follow.

This mode can be identified by the status of the buttons on the right side of the Debugging view.

bubuko.com,布布扣

Show console when standard out/err changes.

To make the display stable on the desired console, disable both buttons. To switch between consoles, select them either in the top left Debug view, or using the right button, as shown above.

The Restart button

Apparently not a big deal, but quite useful for repeated debug sessions, the Restart button can be used at any time during a debug session, and the result is that a reset is dispatched to the target board via the JTAG/SWD interface and the debug session is restarted.

bubuko.com,布布扣

The Restart button.

Using a remote GDB server

If, for any reason, you need to run the GDB server on a remote machine (for example the development board is connected via J-Link to a machine in your office, but you are in another location), you can still use the plug-in to run debugging session. For this to work, just disable Start the GDB server locally in theDebugger tab and instead of localhost for the Host name or IP address, enter the name or address where the GDB server can be accessed.

Then you must manually start the JLinkGDBServer process on the remote machine and only then you can start the debugging session.

Troubleshooting

Missing or wrong jlink_path

The first failure to start a debug session is missing to enter the J-Link path. Without it, the launching sequence will complain Cannot run program “/JLinkGDBServer”.

bubuko.com,布布扣

Cannot run the JLinkGDBServer.

Define the jlink_path as instructed above and the session should start properly.

Wrong device selection

If the devices that you selected in the plug-in does not match the device physically connected, the GDB server session fails and the entire debug session is cancelled. You can identify this case by studying the GDB server log.

bubuko.com,布布扣

Wrong device.

Select the device properly and the session should start properly.

J-Link hangups

Although SEGGER took special measures to avoid J-Link firmware hangups, in case you suspect such a situation (the JLinkGDBServer refuses to connect to the USB device, or to the target), it might help to power cycle the J-Link, by disconnecting and reconnecting the USB cable.

Cannot start applications running from RAM

Please be sure you disable the Pre-run reset and halt option in the Startup tab, this usually does not preserve the RAM content.

More info

Although the plug-in takes care of most of the configuration options, and provides reasonable defaults for the usual cases, it is recommended to read the SEGGER manuals, available from the Doc folder in the installation location or directly from the SEGGER J-Link page.

The J-Link hardware debugging Eclipse plug-in,布布扣,bubuko.com

评论(0
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!