This is part 2 of how to set up your GNU gcc based toolchain for your Renesas RX project. In this article I will explain how to run your J-Link gdb server and how to connect your target to the J-Link (in my case I worked with the Gadget Renesas GR-Sakura board).
The other parts are:
- Part 1: Build your GNU gcc toolchain for Renesas RX targets
- Part 2: Make your J-Link gdb-server run on Linux (this article)
- Part 3: Setup of your Eclipse IDE project and debugging
After having a working compiler in the end of part 1, you can download the J-Link gdb-server included in the J-Link software & documentation pack for Linux from the SEGGER homepage.
To make the gdb-server work, you need to have libusb installed. Since the J-Link gdb-server also needs libreadline.so.5 I had to create a symlink to the already installed libreadline.so.6 in my /lib directory. If you already have a symlink or version 5 of libreadline installed, you can skip this step.
ln -s /lib/libreadline.so.6 /lib/libreadline.so.5
If you want to start the J-Link gdb-server as a normal user, you have have to make sure, the right permissions are set after plugging in the J-Link. First you need a group whose users should be able to start the server and your user has to be a member of the group.
groupadd jlink usermod -a -G jlink youruser
After that, the following udev-rule written in a new file e.g. /etc/udev/rules.d/99-JLink.rules worked to set the right permissions for the J-Link:
ACTION!="add", SUBSYSTEM!="usb", GOTO="kcontrol_rules_end" ATTRS{idProduct}=="0101", ATTRS{idVendor}=="1366", MODE="664", GROUP="jlink" LABEL="kcontrol_rules_end"
Note, that the files containing udev rules are applied in alphabetical order, so by naming it “99-foo.rules” you make sure no other predefined rule will apply after your own rule and overwrite it. Now after plugging in the J-Link you can try to start the J-Link gdb-server and it should look like this:
./StartJLinkGDBServer.sh SEGGER J-Link GDB Server V4.62a JLinkARM.dll V4.62a (DLL compiled Feb 6 2013 11:42:42) The server has been started with the following settings: ---Server related settings--- GDBInit file: none Listening port: 2331 SWO thread listening port: 2332 Accept remote connection: yes Logfile: off Verify download: off Init regs on start: on Silent mode: off Single run mode: off ---J-Link related settings--- J-Link script: none Target interface: JTAG Host interface: USB Target endian: little Target interface speed: 1000kHz Connecting to J-Link... J-Link is connected. Firmware: J-Link ARM V8 compiled Nov 14 2012 22:34:52 Hardware: V8.00 S/N: XXXXXXXXX OEM: SEGGER-EDU Feature(s): FlashBP, GDB Checking target voltage...
If you can see this, then you have a complete rx-elf GNU gcc-toolchain including a gdb-server for hardware debugging via JTAG.
To connect your RX-target to the J-Link, you need an adapter from the 20-pin J-Link interface to the RX 14-pin header. If you don’t want to pay a relatively large amount of money for a PCB with more or less nothing on it, you can build your own adapter with the schematics below:
After connecting your target to the J-Link, the J-Link gdb-server output should continue with something similar to that
Listening on TCP/IP port 2331 Connecting to target... J-Link found 1 JTAG device, Total IRLen = 8 JTAG ID: 0x1D005447 (RX) Connected to target
Continue with part 3.