J-Link Commander

J-Link Commander Tutorial

 Summary

The SEGGER J-Link Commander is a command line interface to the J-Link Debug Probe that allows total control over the probe. The nature of an IDE or graphical user interface is such that usually only the most popular functions are given controls through the IDE. In order to access and control beyond what is provided through the IDE, you must invoke the J-Link commander command line utility.


1

Complete the Simple Programming Example

Before experimenting with the J-Link Commander, ensure your system is properly configured by following the steps in the Simple Programming Example tutorial. Once you have confirmed that your system is working, then proceed through the following steps. The same source project is used for all tutorials.

J-Link Commander is only supported over the 4-wire JTAG interface. You must switch the communications type from the default 2-wire to 4-wire in order for the J-Link Commander to communicate to the J-Link Debug Probe. Instructions for switching between communications types can be found here.

2

Invoke J-Link Commander

When the Drivers/Utilities/Documents package was installed, a shortcut or alias for J-Link should have been installed on your desktop. If it wasn't, you can invoke the it directly from the installed folder:

For Windows, the default location is:
C:\Program Files (x86)\SEGGER\JlinkARM_Vxxxx\Jlink.exe
For MAC OS X, the default location is:
Applications/SEGGER/Jlink/JLinkEXE

Due to the nature of USB communications, it is possible to communicate to the J-Link Debug Probe through both MPLAB® X IDE and J-Link Commander. This means that we can erase through one interface (e.g. J-Link Commander), then program with the other (e.g. MPLAB® X IDE) without having to exit either program.

Upon invoking J-Link Commander, you should see a window similar to the one below:

JLC1.png

3

Get Professional Help

Enter ? after the J-Link> prompt to see the full list of available commands. As you can see from the figure below, there are too many commands to fit into one window, so you will have to scroll through the command window to see all of the available commands.

JLC2.png

4

Halt!

After successfully following the steps to program the target device, your Explorer16 should be blinking four LEDs. This step will use the J-Link Commander to start and stop execution.

  1. Enter h after the J-Link> prompt. Blinking will stop and status of the PIC32 registers will be displayed.
  2. Enter g after the J-Link> prompt and blinking will resume.

The figure below illustrates the results of these commands:

JLC4.png

5

View Execution Memory

The next step in this tutorial is to use J-Link Commander to erase the target device. Ultimately we will want to confirm that the PIC32 has been erased. MPLAB® X IDE provides an easy means of viewing the Execution Memory both before and after erasing.

The first step is to program the device by clicking the Make And Program Device icon, then follow these steps to view the program memory within MPLAB X IDE:

  1. From the toolbar, open the memory window by clicking WINDOW -> PIC MEMORY VIEWS -> EXECUTION MEMORY.
  2. Click on the blue, downward facing arrow in the left margin of the execution memory window to open the Go To dialog box.
  3. From the Go To dialog box, select MEMORY REGION -> PROGRAM MEMORY, then click Go To.
  4. Note that the program memory contains code as illustrated below:
JLCmem.png

6

Erase the Device

Erasing is one of those functions that cannot be done directly through MPLAB® X IDE. Fortunately it is easily done through the J-Link Commander. Before issuing the erase command, the J-Link needs to be told which device is in use. Follow the steps below to erase the target and confirm that it is erased:

1. Enter device ? after the J-Link> prompt. A new dialog box will open. Select the target manufacturer and device.

JLC5.png

Click OK and the dialog box will close, the J-Link will reconnect, and status information will be displayed:

JLCdevice.png

2. Enter erase after the J-Link> prompt. The device will erase and status information will be displayed. Note that the LEDs will stop blinking, but may still be illuminated. Erasing the memory will not clear the LEDs. In order to clear the LEDs, reset the PIC32 by entering r after the J-Link> prompt.

JLCerase.png

7

Confirm that Execution Memory has been erased

Because the device was erased outside of MPLAB® X IDE, we must import the memory from the PIC32 into MPLAB in order to confirm that the program memory was erased. To do do, click the Read Device Memory icon, then follow these steps to view the program memory within MPLAB® X IDE:

  1. From the toolbar, open the memory window by clicking WINDOW -> PIC MEMORY VIEWS -> EXECUTION MEMORY.
  2. Click on the blue downward facing arrow in the left margin of the execution memory window to open the Go To dialog box.
  3. From the Go To dialog box, select MEMORY REGION -> PROGRAM MEMORY, then click Go To.
  4. Note that the program memory now contains 0xFFFFFFFFs as illustrated below, which is the erased state.
JLCmem-erased.png

Success!!

The SEGGER J-Link Commander utility provides a lot of capability not available directly through the MPLAB® X IDE plugin. In addition to the J-Link Commander utility there are a number of other utilities that SEGGER provides that are not treated here.

20th Annual
Microchip MASTERs Conference 2016
Register now - Deadline: July 29

JW Marriott Desert Ridge Resort-Phoenix, AZ

© 2016 Microchip Technology, Inc.
Information contained on this site regarding device applications and the like is provided only for your convenience and may be superseded by updates. It is your responsibility to ensure that your application meets with your specifications. MICROCHIP MAKES NO REPRESENTATIONS OR WARRANTIES OF ANY KIND WHETHER EXPRESS OR IMPLIED, WRITTEN OR ORAL, STATUTORY OR OTHERWISE, RELATED TO THE INFORMATION, INCLUDING BUT NOT LIMITED TO ITS CONDITION, QUALITY, PERFORMANCE, MERCHANTABILITY OR FITNESS FOR PURPOSE. Microchip disclaims all liability arising from this information and its use. Use of Microchip devices in life support and/or safety applications is entirely at the buyer's risk, and the buyer agrees to defend, indemnify and hold harmless Microchip from any and all damages, claims, suits, or expenses resulting from such use. No licenses are conveyed, implicitly or otherwise, under any Microchip intellectual property rights.