Difference between revisions of "RZ-G/RZG2 openocd"

From eLinux.org
Jump to: navigation, search
(Replaced content with "this page can be deleted")
(Tag: Replaced)
 
Line 1: Line 1:
== Introduction ==
+
this page can be deleted
This document provides a guide to use OpenOCD and compatible JTAG debugger devices on RZ/G2 platforms.
 
 
 
== Target Device ==
 
* RZ/G2E Rev C
 
 
 
== Overview ==
 
OpenOCD is an opensource software that provides on-chip programming and debugging feature, with support from compatible JTAG hardware debugger devices.
 
 
 
'''Prerequisites'''<br>
 
A compatible JTAG hardware debugger device is required. Different JTAG device can have different procedure.<br>
 
As an example, following guidance is writing for Flyswatter2 device from Tin Can Tools, LLC.
 
https://www.tincantools.com/flyswatter2/
 
[[File:flyswatter2.png|left|100px|link=|flyswatter2]]
 
 
 
 
 
 
 
 
 
 
 
 
 
== Environment ==
 
Below illustration shows how user should connect RZ/G2 platform with JTAG debugger and OpenOCD (run on a Linux Host PC).
 
Note that most RZ/G2 development board has 10 pin JTAG header, so a JTAG converter (20pin-10pin) is required.
 
Example: https://www.mouser.com/ProductDetail/Olimex-Ltd/ARM-JTAG-20-10?qs=sGAEpiMZZMu3sxpa5v1qruKJnqf7E2bHKCQxSxTTkuc%3D
 
[[File:openocd_env1.png|500px|left]]
 
<br>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
== Usage ==
 
After connect devices as guide in section 2, follow below instruction to use OpenOCD and JTAG debugger.
 
 
 
'''Hardware setup'''<br>
 
User must change the switches setting on development board to enable JTAG debugging feature.
 
The switches setting is different between each development board. Please refer to its board manual or user guide for the detail information.
 
For EK874 RZ/G2E board, change switches as below. Note that board version 3 or later must be used.
 
[[File:sw12.png|thumb|200px|left|• SW12: change bit 4 and 5 to OFF to enable JTAG ]]
 
[[File:sw50.png|thumb|200px|left|• SW50: change to (2-3) side ]]
 
[[File:sw51.png|thumb|200px|left|• SW51: change to (1-2) side ]]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
'''Attach JTAG'''<br>
 
Make sure you have all the necessary packages installed:
 
<pre>
 
$sudo apt-get install libtool pkg-config texinfo libusb-dev libusb-1.0.0-dev libftdi-dev autoconf
 
</pre>
 
 
 
'''Download OpenOCD (if not available yet'''<br>
 
User can get latest OpenOCD software from https://github.com/ntfreak/openocd
 
<pre>
 
$ git clone https://github.com/ntfreak/openocd
 
$ cd openocd
 
</pre>
 
 
 
Next, follow instruction from github to build openocd.
 
<pre>
 
$ ./bootstrap
 
$ ./configure --prefix ${PWD}/installdir
 
$ make
 
$ make install
 
</pre>
 
 
 
In configuration, use may need to add option “--enable-ftdi” to ensure ftdi related function (which Flyswatter2 uses) will be built.
 
 
 
'''Run openocd'''<br>
 
OpenOCD provides many setting scripts for many JTAG debugger and development boards under directory share/openocd/scripts/.
 
Users must find two suitable scripts to use for their environment, one for Debugger and one for the development board.
 
For debug with Flyswatter2 on RZ/G2 development boards, below scripts are suitable:
 
* Flyswatter2: interface/ftdi/flyswatter2.cfg
 
* RZ/G2 board: target/renesas_rcar_gen3.cfg
 
For EK874 RZ/G2E board: set SOC E3
 
 
 
renesas_rcar_gen3.cfg is the most suitable configure file for RZ/G2.
 
In this configure, “E3” SOC config is the most suitable config for EK874 RZ/G2E.
 
Thus, the run command to attach JTAG with OpenOCD is:
 
<pre>
 
$ sudo bin/openocd -f share/openocd/scripts/interface/ftdi/flyswatter2.cfg -c “set SOC E3” -f share/openocd/scripts/target/renesas_rcar_gen3.cfg
 
</pre>
 
Note: If below error appears
 
[[File:openocd_error.png|700px|left ]]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
User has to modify flyswatter2.cfg configure file to fix missing “adater speed”. Just add below line to the end of that file, then rerun the command:
 
<pre>Adapter speed 15000</pre>
 
 
 
If openocd command succeeds, message like bellow will appear
 
[[File:openocd_run.png|700px|left ]]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
Note that “E3” and “r8a77990” in these messages are not correct for RZ/G2 platform. They are shown because configure renesas_rcar_gen3.cfg was used.
 
 
 
== Start debugging ==
 
Now that openocd command has succeeded, user can run GDB on Linux Host PC and attach to GDB Server created by OpenOCD (the port is shown in OpenOCD log, default is 3333).
 
<pre>
 
$ gdb
 
(gdb) target remote localhost:3333
 
</pre>
 
After that, gdb and openocd will show message like below.<br>
 
This mean GDB has connected successfully. After this, user can control and debug device by GDB (refer to GDB guide https://sourceware.org/gdb/current/onlinedocs/gdb/).
 
 
 
[[File:gdb_run.png|700px|left ]]
 
[[File:openocd_run2.png|700px|left ]]
 

Latest revision as of 12:57, 23 July 2021

this page can be deleted