Skip to content

Commit

Permalink
Update JTAG devices for CDT 10
Browse files Browse the repository at this point in the history
CDT 10 no longer uses DefaultGDBJtagDeviceImpl but instead
DefaultGDBJtagConnectionImpl. The new class uses URI for
connection instead of separate host/port fields. So update
the debugger tab and all JTAG device classes.

Fixes #35

Signed-off-by: Daniel Leung <[email protected]>
  • Loading branch information
dcpleung committed Sep 25, 2020
1 parent 53b177d commit 17572aa
Show file tree
Hide file tree
Showing 9 changed files with 39 additions and 80 deletions.
5 changes: 5 additions & 0 deletions plugins/org.zephyrproject.ide.eclipse.core/plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -176,26 +176,31 @@
point="org.eclipse.cdt.debug.gdbjtag.core.JTagDevice">
<device
class="org.zephyrproject.ide.eclipse.core.debug.jtagdevice.QEMUDevice"
default_connection="localhost:1234"
id="org.zephyrproject.ide.eclipse.core.debug.jtagdevice.qemuDevice"
name="QEMU">
</device>
<device
class="org.zephyrproject.ide.eclipse.core.debug.jtagdevice.ARCnSimDevice"
default_connection="localhost:3333"
id="org.zephyrproject.ide.eclipse.core.debug.jtagdevice.arcnSimDevice"
name="ARC nSIM">
</device>
<device
class="org.zephyrproject.ide.eclipse.core.debug.jtagdevice.XtOCDDevice"
default_connection="localhost:20000"
id="org.zephyrproject.ide.eclipse.core.debug.jtagdevice.xtOCDDevice"
name="xt-ocd">
</device>
<device
class="org.zephyrproject.ide.eclipse.core.debug.jtagdevice.Nios2Device"
default_connection="localhost:3333"
id="org.zephyrproject.ide.eclipse.core.debug.jtagdevice.nios2Device"
name="Nios II GDB Server">
</device>
<device
class="org.zephyrproject.ide.eclipse.core.debug.jtagdevice.OpenIPCDevice"
default_connection="localhost:8086"
id="org.zephyrproject.ide.eclipse.core.debug.jtagdevice.openIPCDevice"
name="OpenIPC">
</device>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@

import java.util.Collection;

import org.eclipse.cdt.debug.gdbjtag.core.jtagdevice.DefaultGDBJtagDeviceImpl;
import org.eclipse.cdt.debug.gdbjtag.core.jtagdevice.DefaultGDBJtagConnectionImpl;

public class ARCnSimDevice extends DefaultGDBJtagDeviceImpl {
public class ARCnSimDevice extends DefaultGDBJtagConnectionImpl {

@Override
public void doDelay(int delay, Collection<String> commands) {
Expand All @@ -29,14 +29,4 @@ public void doHalt(Collection<String> commands) {
public void doReset(Collection<String> commands) {
}

@Override
public String getDefaultIpAddress() {
return "localhost"; //$NON-NLS-1$
}

@Override
public String getDefaultPortNumber() {
return "3333"; //$NON-NLS-1$
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@

import java.util.Collection;

import org.eclipse.cdt.debug.gdbjtag.core.jtagdevice.DefaultGDBJtagDeviceImpl;
import org.eclipse.cdt.debug.gdbjtag.core.jtagdevice.DefaultGDBJtagConnectionImpl;

public class Nios2Device extends DefaultGDBJtagDeviceImpl {
public class Nios2Device extends DefaultGDBJtagConnectionImpl {

@Override
public void doDelay(int delay, Collection<String> commands) {
Expand All @@ -29,14 +29,4 @@ public void doHalt(Collection<String> commands) {
public void doReset(Collection<String> commands) {
}

@Override
public String getDefaultIpAddress() {
return "localhost"; //$NON-NLS-1$
}

@Override
public String getDefaultPortNumber() {
return "3333"; //$NON-NLS-1$
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,9 @@

import java.util.Collection;

import org.eclipse.cdt.debug.gdbjtag.core.jtagdevice.DefaultGDBJtagDeviceImpl;
import org.eclipse.cdt.debug.gdbjtag.core.jtagdevice.DefaultGDBJtagConnectionImpl;

public class OpenIPCDevice extends DefaultGDBJtagDeviceImpl {

@Override
public String getDefaultPortNumber() {
return "8086"; //$NON-NLS-1$
}
public class OpenIPCDevice extends DefaultGDBJtagConnectionImpl {

@Override
public void doDelay(int delay, Collection<String> commands) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@

import java.util.Collection;

import org.eclipse.cdt.debug.gdbjtag.core.jtagdevice.DefaultGDBJtagDeviceImpl;
import org.eclipse.cdt.debug.gdbjtag.core.jtagdevice.DefaultGDBJtagConnectionImpl;

public class QEMUDevice extends DefaultGDBJtagDeviceImpl {
public class QEMUDevice extends DefaultGDBJtagConnectionImpl {

@Override
public void doDelay(int delay, Collection<String> commands) {
Expand All @@ -29,14 +29,4 @@ public void doHalt(Collection<String> commands) {
public void doReset(Collection<String> commands) {
}

@Override
public String getDefaultIpAddress() {
return "localhost"; //$NON-NLS-1$
}

@Override
public String getDefaultPortNumber() {
return "1234"; //$NON-NLS-1$
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@

import java.util.Collection;

import org.eclipse.cdt.debug.gdbjtag.core.jtagdevice.DefaultGDBJtagDeviceImpl;
import org.eclipse.cdt.debug.gdbjtag.core.jtagdevice.DefaultGDBJtagConnectionImpl;

public class XtOCDDevice extends DefaultGDBJtagDeviceImpl {
public class XtOCDDevice extends DefaultGDBJtagConnectionImpl {

@Override
public void doDelay(int delay, Collection<String> commands) {
Expand All @@ -29,14 +29,4 @@ public void doHalt(Collection<String> commands) {
public void doReset(Collection<String> commands) {
}

@Override
public String getDefaultIpAddress() {
return "localhost"; //$NON-NLS-1$
}

@Override
public String getDefaultPortNumber() {
return "20000"; //$NON-NLS-1$
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -23,20 +23,19 @@ public abstract class CommonDebugLaunchDebuggerTab
extends GDBJtagDSFDebuggerTab {

protected String defaultJtagDevice = JTagDeviceDesc.GENERIC_TCPIP_DEVICE;
protected String defaultHost = JTagDeviceDesc.IP_ADDR_LOCALHOST;
protected Integer defaultPort = 10000;
protected String defaultConnection = null;
protected String defaultConnection =
String.format("%s:%d", JTagDeviceDesc.IP_ADDR_LOCALHOST, 10000);

protected JTagDeviceDesc[] jtagDevices = new JTagDeviceDesc[] {

/* Emulator targets */

new JTagDeviceDesc("arc-nsim", //$NON-NLS-1$
"org.zephyrproject.ide.eclipse.core.debug.jtagdevice.arcnSimDevice", //$NON-NLS-1$
JTagDeviceDesc.IP_ADDR_LOCALHOST, 3333),
String.format("%s:%d", JTagDeviceDesc.IP_ADDR_LOCALHOST, 3333)),
new JTagDeviceDesc("qemu", //$NON-NLS-1$
"org.zephyrproject.ide.eclipse.core.debug.jtagdevice.qemuDevice", //$NON-NLS-1$
JTagDeviceDesc.IP_ADDR_LOCALHOST, 1234),
String.format("%s:%d", JTagDeviceDesc.IP_ADDR_LOCALHOST, 1234)),

/* Hardware targets */

Expand All @@ -45,19 +44,20 @@ public abstract class CommonDebugLaunchDebuggerTab
"/dev/ttyACM0"), //$NON-NLS-1$
new JTagDeviceDesc("intel_s1000", //$NON-NLS-1$
"org.zephyrproject.ide.eclipse.core.debug.jtagdevice.xtOCDDevice", //$NON-NLS-1$
JTagDeviceDesc.IP_ADDR_LOCALHOST, 20000),
String.format("%s:%d", JTagDeviceDesc.IP_ADDR_LOCALHOST,
20000)),
new JTagDeviceDesc("JLink", //$NON-NLS-1$
"org.eclipse.cdt.debug.gdbjtag.core.jtagdevice.SeggerJLink", //$NON-NLS-1$
JTagDeviceDesc.IP_ADDR_LOCALHOST, 2331),
String.format("%s:%d", JTagDeviceDesc.IP_ADDR_LOCALHOST, 2331)),
new JTagDeviceDesc("nios2", //$NON-NLS-1$
"org.zephyrproject.ide.eclipse.core.debug.jtagdevice.nios2Device", //$NON-NLS-1$
JTagDeviceDesc.IP_ADDR_LOCALHOST, 3333),
String.format("%s:%d", JTagDeviceDesc.IP_ADDR_LOCALHOST, 3333)),
new JTagDeviceDesc("openocd", //$NON-NLS-1$
"org.eclipse.cdt.debug.gdbjtag.core.jtagdevice.OpenOCDSocket", //$NON-NLS-1$
JTagDeviceDesc.IP_ADDR_LOCALHOST, 3333),
String.format("%s:%d", JTagDeviceDesc.IP_ADDR_LOCALHOST, 3333)),
new JTagDeviceDesc("openipc", //$NON-NLS-1$
"org.zephyrproject.ide.eclipse.core.debug.jtagdevice.openIPCDevice", //$NON-NLS-1$
JTagDeviceDesc.IP_ADDR_LOCALHOST, 8086),
String.format("%s:%d", JTagDeviceDesc.IP_ADDR_LOCALHOST, 8086)),
};

@Override
Expand All @@ -69,8 +69,6 @@ public void setDefaults(ILaunchConfigurationWorkingCopy configuration) {

String device = defaultJtagDevice;
String connection = defaultConnection;
String ipAddr = defaultHost;
Integer ipPort = defaultPort;

/* Grab GDB path and runner from CMake */
try {
Expand Down Expand Up @@ -103,8 +101,7 @@ public void setDefaults(ILaunchConfigurationWorkingCopy configuration) {
if (jtag.connection != null) {
connection = jtag.connection;
} else {
ipAddr = jtag.host;
ipPort = jtag.port;
connection = defaultConnection;
}

break;
Expand All @@ -119,16 +116,18 @@ public void setDefaults(ILaunchConfigurationWorkingCopy configuration) {

configuration.setAttribute(IGDBJtagConstants.ATTR_JTAG_DEVICE_ID,
device);

String connText;
if (connection != null) {
configuration.setAttribute(IGDBJtagConstants.ATTR_CONNECTION,
connection);
connText = connection;
} else {
configuration.setAttribute(IGDBJtagConstants.ATTR_IP_ADDRESS,
ipAddr);

configuration.setAttribute(IGDBJtagConstants.ATTR_PORT_NUMBER,
ipPort);
connText = defaultConnection;
}

/* The ATTR_CONNECTION attribute needs "gdb:" prefix */
connText = String.format("gdb:%s", connText);

configuration.setAttribute(IGDBJtagConstants.ATTR_CONNECTION, connText);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ public EmulatorDebugLaunchDebuggerTab() {
*/
super.defaultJtagDevice =
"org.zephyrproject.ide.eclipse.core.debug.jtagdevice.qemuDevice"; //$NON-NLS-1$
super.defaultHost = JTagDeviceDesc.IP_ADDR_LOCALHOST;
super.defaultPort = 1234;
super.defaultConnection =
String.format("%s:%d", JTagDeviceDesc.IP_ADDR_LOCALHOST, 1234);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ public HardwareDebugLaunchDebuggerTab() {
/* Most boards use OpenOCD or pyOCD, so set it as default */
super.defaultJtagDevice =
"org.eclipse.cdt.debug.gdbjtag.core.jtagdevice.OpenOCDSocket"; //$NON-NLS-1$
super.defaultHost = JTagDeviceDesc.IP_ADDR_LOCALHOST;
super.defaultPort = 3333;
super.defaultConnection =
String.format("%s:%d", JTagDeviceDesc.IP_ADDR_LOCALHOST, 3333);
}

}

0 comments on commit 17572aa

Please sign in to comment.