Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'jtag/org.eclipse.cdt.debug.gdbjtag.core/src/org/eclipse')
-rw-r--r--jtag/org.eclipse.cdt.debug.gdbjtag.core/src/org/eclipse/cdt/debug/gdbjtag/core/Activator.java22
-rw-r--r--jtag/org.eclipse.cdt.debug.gdbjtag.core/src/org/eclipse/cdt/debug/gdbjtag/core/GDBJtagDebugger.java179
-rw-r--r--jtag/org.eclipse.cdt.debug.gdbjtag.core/src/org/eclipse/cdt/debug/gdbjtag/core/IGDBJtagConstants.java25
-rw-r--r--jtag/org.eclipse.cdt.debug.gdbjtag.core/src/org/eclipse/cdt/debug/gdbjtag/core/jtagdevice/AbatronBDI2000.java30
-rw-r--r--jtag/org.eclipse.cdt.debug.gdbjtag.core/src/org/eclipse/cdt/debug/gdbjtag/core/jtagdevice/DefaultGDBJtagDeviceImpl.java126
-rw-r--r--jtag/org.eclipse.cdt.debug.gdbjtag.core/src/org/eclipse/cdt/debug/gdbjtag/core/jtagdevice/GDBJtagDeviceContribution.java93
-rw-r--r--jtag/org.eclipse.cdt.debug.gdbjtag.core/src/org/eclipse/cdt/debug/gdbjtag/core/jtagdevice/GDBJtagDeviceContributionFactory.java85
-rw-r--r--jtag/org.eclipse.cdt.debug.gdbjtag.core/src/org/eclipse/cdt/debug/gdbjtag/core/jtagdevice/GenericDevice.java36
-rw-r--r--jtag/org.eclipse.cdt.debug.gdbjtag.core/src/org/eclipse/cdt/debug/gdbjtag/core/jtagdevice/IGDBJtagDevice.java108
-rw-r--r--jtag/org.eclipse.cdt.debug.gdbjtag.core/src/org/eclipse/cdt/debug/gdbjtag/core/jtagdevice/MacraigorUsb2Demon.java46
10 files changed, 695 insertions, 55 deletions
diff --git a/jtag/org.eclipse.cdt.debug.gdbjtag.core/src/org/eclipse/cdt/debug/gdbjtag/core/Activator.java b/jtag/org.eclipse.cdt.debug.gdbjtag.core/src/org/eclipse/cdt/debug/gdbjtag/core/Activator.java
index 2db3a79967d..fdad83e91be 100644
--- a/jtag/org.eclipse.cdt.debug.gdbjtag.core/src/org/eclipse/cdt/debug/gdbjtag/core/Activator.java
+++ b/jtag/org.eclipse.cdt.debug.gdbjtag.core/src/org/eclipse/cdt/debug/gdbjtag/core/Activator.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007 QNX Software Systems and others
+ * Copyright (c) 2008 QNX Software Systems and others
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -7,9 +7,11 @@
*
* Contributors:
* QNX Software Systems - initial API and implementation
+ * Andy Jin - Hardware debugging UI improvements, bug 229946
*******************************************************************************/
package org.eclipse.cdt.debug.gdbjtag.core;
+import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Plugin;
import org.osgi.framework.BundleContext;
@@ -19,7 +21,7 @@ import org.osgi.framework.BundleContext;
public class Activator extends Plugin {
// The plug-in ID
- public static final String PLUGIN_ID = "org.eclipse.cdt.debug.gdbremote.core";
+ public static final String PLUGIN_ID = "org.eclipse.cdt.debug.gdbjtag.core";
// The shared instance
private static Activator plugin;
@@ -57,4 +59,20 @@ public class Activator extends Plugin {
return plugin;
}
+ /**
+ * Convenience method which returns the unique identifier of this plugin.
+ */
+ public static String getUniqueIdentifier() {
+ return PLUGIN_ID;
+ }
+
+ /**
+ * Logs the specified status with this plug-in's log.
+ *
+ * @param status status to log
+ */
+ public static void log( IStatus status ) {
+ getDefault().getLog().log( status );
+ }
+
}
diff --git a/jtag/org.eclipse.cdt.debug.gdbjtag.core/src/org/eclipse/cdt/debug/gdbjtag/core/GDBJtagDebugger.java b/jtag/org.eclipse.cdt.debug.gdbjtag.core/src/org/eclipse/cdt/debug/gdbjtag/core/GDBJtagDebugger.java
index d79886f2d58..d3707479bb0 100644
--- a/jtag/org.eclipse.cdt.debug.gdbjtag.core/src/org/eclipse/cdt/debug/gdbjtag/core/GDBJtagDebugger.java
+++ b/jtag/org.eclipse.cdt.debug.gdbjtag.core/src/org/eclipse/cdt/debug/gdbjtag/core/GDBJtagDebugger.java
@@ -1,23 +1,30 @@
-/**********************************************************************
- * Copyright (c) 2007 QNX Software Systems and others.
+/*******************************************************************************
+ * Copyright (c) 2007 - 2008 QNX Software Systems and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
+ *
+ * Contributors:
* QNX Software Systems - Initial API and implementation
- **********************************************************************/
+ * Andy Jin - Hardware debugging UI improvements, bug 229946
+ *******************************************************************************/
package org.eclipse.cdt.debug.gdbjtag.core;
import java.io.File;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
import org.eclipse.cdt.core.IBinaryParser.IBinaryObject;
import org.eclipse.cdt.debug.core.CDebugCorePlugin;
import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants;
import org.eclipse.cdt.debug.core.cdi.ICDISession;
import org.eclipse.cdt.debug.core.cdi.model.ICDITarget;
+import org.eclipse.cdt.debug.gdbjtag.core.jtagdevice.GDBJtagDeviceContribution;
+import org.eclipse.cdt.debug.gdbjtag.core.jtagdevice.GDBJtagDeviceContributionFactory;
+import org.eclipse.cdt.debug.gdbjtag.core.jtagdevice.IGDBJtagDevice;
import org.eclipse.cdt.debug.mi.core.AbstractGDBCDIDebugger;
import org.eclipse.cdt.debug.mi.core.MIException;
import org.eclipse.cdt.debug.mi.core.MIPlugin;
@@ -27,8 +34,6 @@ import org.eclipse.cdt.debug.mi.core.cdi.model.Target;
import org.eclipse.cdt.debug.mi.core.command.CLICommand;
import org.eclipse.cdt.debug.mi.core.command.CommandFactory;
import org.eclipse.cdt.debug.mi.core.command.MIGDBSetNewConsole;
-import org.eclipse.cdt.debug.mi.core.command.MITargetDownload;
-import org.eclipse.cdt.debug.mi.core.command.MITargetSelect;
import org.eclipse.cdt.debug.mi.core.output.MIInfo;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
@@ -36,11 +41,12 @@ import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.MultiStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.variables.VariablesPlugin;
+import org.eclipse.debug.core.DebugPlugin;
import org.eclipse.debug.core.ILaunch;
import org.eclipse.debug.core.ILaunchConfiguration;
/**
- * @author Doug Schaefer
+ * @author Doug Schaefer, Adrian Petrescu
*
*/
public class GDBJtagDebugger extends AbstractGDBCDIDebugger {
@@ -64,10 +70,12 @@ public class GDBJtagDebugger extends AbstractGDBCDIDebugger {
protected void doStartSession(ILaunch launch, Session session, IProgressMonitor monitor) throws CoreException {
ILaunchConfiguration config = launch.getLaunchConfiguration();
ICDITarget[] targets = session.getTargets();
- if (targets.length == 0 || !(targets[0] instanceof Target))
- return ; // TODO should raise an exception
+ if (targets.length == 0 || !(targets[0] instanceof Target)) {
+ Activator.log(new Status(IStatus.ERROR, Activator.getUniqueIdentifier(),
+ DebugPlugin.INTERNAL_ERROR, "Error getting debug target", null));
+ return;
+ }
MISession miSession = ((Target)targets[0]).getMISession();
- getMISession(session);
CommandFactory factory = miSession.getCommandFactory();
try {
MIGDBSetNewConsole newConsole = factory.createMIGDBSetNewConsole();
@@ -82,55 +90,68 @@ public class GDBJtagDebugger extends AbstractGDBCDIDebugger {
// on GNU/Linux the new-console is an error.
}
+ IGDBJtagDevice gdbJtagDevice;
+ try {
+ gdbJtagDevice = getGDBJtagDevice(config);
+ } catch (NullPointerException e) {
+ return;
+ }
+
+ ArrayList commands = new ArrayList();
+
// hook up to remote target
boolean useRemote = config.getAttribute(IGDBJtagConstants.ATTR_USE_REMOTE_TARGET, IGDBJtagConstants.DEFAULT_USE_REMOTE_TARGET);
if (useRemote) {
- try {
- monitor.beginTask("Connecting to remote", 1);
- String ipAddress = config.getAttribute(IGDBJtagConstants.ATTR_IP_ADDRESS, IGDBJtagConstants.DEFAULT_IP_ADDRESS);
- int portNumber = config.getAttribute(IGDBJtagConstants.ATTR_PORT_NUMBER, IGDBJtagConstants.DEFAULT_PORT_NUMBER);
- String address = ipAddress + ":" + String.valueOf(portNumber);
- MITargetSelect targetSelect = factory.createMITargetSelect(new String[] { "remote", address });
- miSession.postCommand(targetSelect);
- MIInfo info = targetSelect.getMIInfo();
- if (info == null) {
- throw new MIException(MIPlugin.getResourceString("src.common.No_answer")); //$NON-NLS-1$
- }
- } catch (MIException e) {
- // TODO dunno...
- }
+ monitor.beginTask("Connecting to remote", 1);
+ String ipAddress = config.getAttribute(IGDBJtagConstants.ATTR_IP_ADDRESS, IGDBJtagConstants.DEFAULT_IP_ADDRESS);
+ int portNumber = config.getAttribute(IGDBJtagConstants.ATTR_PORT_NUMBER, IGDBJtagConstants.DEFAULT_PORT_NUMBER);
+ gdbJtagDevice.doRemote(ipAddress, portNumber, commands);
+ executeGDBScript(getGDBScript(commands), miSession);
}
// execute init script
monitor.beginTask("Executing init commands", 1);
+
+ // Run device-specific code to reset the board
+ if (config.getAttribute(IGDBJtagConstants.ATTR_DO_RESET, true)) {
+ commands = new ArrayList();
+ gdbJtagDevice.doReset(commands);
+ int defaultDelay = gdbJtagDevice.getDefaultDelay();
+ gdbJtagDevice.doDelay(config.getAttribute(IGDBJtagConstants.ATTR_DELAY, defaultDelay), commands);
+ gdbJtagDevice.doHalt(commands);
+ executeGDBScript(getGDBScript(commands), miSession);
+ }
+ // execute any user defined init command
executeGDBScript(config, IGDBJtagConstants.ATTR_INIT_COMMANDS, miSession);
// execute load
- boolean doLoad = config.getAttribute(IGDBJtagConstants.ATTR_LOAD_IMAGE, IGDBJtagConstants.DEFAULT_LOAD_IMAGE);
+ boolean doLoad = config.getAttribute(IGDBJtagConstants.ATTR_LOAD_IMAGE, IGDBJtagConstants.DEFAULT_LOAD_IMAGE);
if (doLoad) {
+ // Escape windows path separator characters TWICE, once for Java and once for GDB.
String imageFileName = config.getAttribute(IGDBJtagConstants.ATTR_IMAGE_FILE_NAME, "");
if (imageFileName.length() > 0) {
- try {
- monitor.beginTask("Loading image", 1);
- imageFileName = VariablesPlugin.getDefault().getStringVariableManager().performStringSubstitution(imageFileName);
- MITargetDownload download = factory.createMITargetDownload(imageFileName);
- miSession.postCommand(download, MISession.FOREVER);
- MIInfo info = download.getMIInfo();
- if (info == null) {
- throw new MIException(MIPlugin.getResourceString("src.common.No_answer")); //$NON-NLS-1$
- }
- } catch (MIException e) {
- // TODO dunno...
- }
+ monitor.beginTask("Loading image", 1);
+ imageFileName = VariablesPlugin.getDefault().getStringVariableManager().performStringSubstitution(imageFileName).replace("\\", "\\\\");
+ String imageOffset = (imageFileName.endsWith(".elf")) ? "" : "0x" + config.getAttribute(IGDBJtagConstants.ATTR_IMAGE_OFFSET, "");
+ commands = new ArrayList();
+ gdbJtagDevice.doLoadImage(imageFileName, imageOffset, commands);
+ executeGDBScript(getGDBScript(commands), miSession);
+
+ }
+ }
+
+ // execute symbol load
+ boolean doLoadSymbols = config.getAttribute(IGDBJtagConstants.ATTR_LOAD_SYMBOLS, IGDBJtagConstants.DEFAULT_LOAD_SYMBOLS);
+ if (doLoadSymbols) {
+ String symbolsFileName = config.getAttribute(IGDBJtagConstants.ATTR_SYMBOLS_FILE_NAME, "");
+ if (symbolsFileName.length() > 0) {
+ symbolsFileName = VariablesPlugin.getDefault().getStringVariableManager().performStringSubstitution(symbolsFileName).replace("\\", "\\\\");
+ String symbolsOffset = "0x" + config.getAttribute(IGDBJtagConstants.ATTR_SYMBOLS_OFFSET, "");
+ commands = new ArrayList();
+ gdbJtagDevice.doLoadSymbol(symbolsFileName, symbolsOffset, commands);
+ executeGDBScript(getGDBScript(commands), miSession);
}
}
- }
-
- protected MISession getMISession(Session session) {
- ICDITarget[] targets = session.getTargets();
- if (targets.length == 0 || !(targets[0] instanceof Target))
- return null;
- return ((Target)targets[0]).getMISession();
}
public void doRunSession(ILaunch launch, ICDISession session, IProgressMonitor monitor) throws CoreException {
@@ -139,16 +160,44 @@ public class GDBJtagDebugger extends AbstractGDBCDIDebugger {
if ( targets.length == 0 || !(targets[0] instanceof Target) )
return;
MISession miSession = ((Target)targets[0]).getMISession();
-
+
+ IGDBJtagDevice gdbJtagDevice;
+ try {
+ gdbJtagDevice = getGDBJtagDevice(config);
+ } catch (NullPointerException e) {
+ return;
+ }
+
+ ArrayList commands = new ArrayList();
+ // Set program counter
+ String pcRegister = config.getAttribute(IGDBJtagConstants.ATTR_PC_REGISTER, config.getAttribute(IGDBJtagConstants.ATTR_IMAGE_OFFSET, ""));
+ gdbJtagDevice.doSetPC(pcRegister, commands);
+ executeGDBScript(getGDBScript(commands), miSession);
+
// execute run script
monitor.beginTask("Executing run commands", 1);
+ boolean setStopAt = config.getAttribute(IGDBJtagConstants.ATTR_SET_STOP_AT, IGDBJtagConstants.DEFAULT_SET_STOP_AT);
+ if (setStopAt) {
+ String stopAt = config.getAttribute(IGDBJtagConstants.ATTR_STOP_AT, "");
+ commands = new ArrayList();
+ gdbJtagDevice.doStopAt(stopAt, commands);
+ executeGDBScript(getGDBScript(commands), miSession);
+ }
+
+ boolean setResume = config.getAttribute(IGDBJtagConstants.ATTR_SET_RESUME, IGDBJtagConstants.DEFAULT_SET_RESUME);
+ if (setResume) {
+ commands = new ArrayList();
+ gdbJtagDevice.doContinue(commands);
+ executeGDBScript(getGDBScript(commands), miSession);
+ }
+ // Run any user defined command
executeGDBScript(config, IGDBJtagConstants.ATTR_RUN_COMMANDS, miSession);
}
- private void executeGDBScript(ILaunchConfiguration configuration, String attribute,
- MISession miSession) throws CoreException {
- // Try to execute any extrac comand
- String script = configuration.getAttribute(attribute, ""); //$NON-NLS-1$
+ private void executeGDBScript(String script, MISession miSession) throws CoreException {
+ // Try to execute any extra command
+ if (script == null)
+ return;
script = VariablesPlugin.getDefault().getStringVariableManager().performStringSubstitution(script);
String[] commands = script.split("\\r?\\n");
for (int j = 0; j < commands.length; ++j) {
@@ -175,5 +224,35 @@ public class GDBJtagDebugger extends AbstractGDBCDIDebugger {
}
}
}
+
+ private void executeGDBScript(ILaunchConfiguration configuration, String attribute,
+ MISession miSession) throws CoreException {
+ executeGDBScript(configuration.getAttribute(attribute, ""), miSession);
+ }
+ private IGDBJtagDevice getGDBJtagDevice (ILaunchConfiguration config)
+ throws CoreException, NullPointerException {
+ IGDBJtagDevice gdbJtagDevice = null;
+ String jtagDeviceName = config.getAttribute(IGDBJtagConstants.ATTR_JTAG_DEVICE, "");
+ GDBJtagDeviceContribution[] availableDevices = GDBJtagDeviceContributionFactory.
+ getInstance().getGDBJtagDeviceContribution();
+ for (int i = 0; i < availableDevices.length; i++) {
+ if (jtagDeviceName.equals(availableDevices[i].getDeviceName())) {
+ gdbJtagDevice = availableDevices[i].getDevice();
+ break;
+ }
+ }
+ return gdbJtagDevice;
+ }
+
+ private String getGDBScript(Collection commands) {
+ if (commands.isEmpty())
+ return null;
+ StringBuffer sb = new StringBuffer();
+ Iterator it = commands.iterator();
+ while (it.hasNext()) {
+ sb.append(it.next());
+ }
+ return sb.toString();
+ }
}
diff --git a/jtag/org.eclipse.cdt.debug.gdbjtag.core/src/org/eclipse/cdt/debug/gdbjtag/core/IGDBJtagConstants.java b/jtag/org.eclipse.cdt.debug.gdbjtag.core/src/org/eclipse/cdt/debug/gdbjtag/core/IGDBJtagConstants.java
index 1be899720d0..870c2d3f137 100644
--- a/jtag/org.eclipse.cdt.debug.gdbjtag.core/src/org/eclipse/cdt/debug/gdbjtag/core/IGDBJtagConstants.java
+++ b/jtag/org.eclipse.cdt.debug.gdbjtag.core/src/org/eclipse/cdt/debug/gdbjtag/core/IGDBJtagConstants.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007 QNX Software Systems and others.
+ * Copyright (c) 2007 - 2008 QNX Software Systems and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -7,6 +7,7 @@
*
* Contributors:
* QNX Software Systems - Initial API and implementation
+ * Andy Jin - Hardware debugging UI improvements, bug 229946
*******************************************************************************/
package org.eclipse.cdt.debug.gdbjtag.core;
@@ -23,6 +24,7 @@ public interface IGDBJtagConstants {
public static final String ATTR_USE_REMOTE_TARGET = Activator.PLUGIN_ID + ".useRemoteTarget"; //$NON-NLS-1$
public static final String ATTR_IP_ADDRESS = Activator.PLUGIN_ID + ".ipAddress"; //$NON-NLS-1$
public static final String ATTR_PORT_NUMBER = Activator.PLUGIN_ID + ".portNumber"; //$NON-NLS-1$
+ public static final String ATTR_JTAG_DEVICE = Activator.PLUGIN_ID + ".jtagDevice"; //$NON-NLS-1$
public static final boolean DEFAULT_USE_REMOTE_TARGET = true;
public static final String DEFAULT_IP_ADDRESS = "localhost"; //$NON-NLS-1$
@@ -30,11 +32,28 @@ public interface IGDBJtagConstants {
// Startup
public static final String ATTR_INIT_COMMANDS = Activator.PLUGIN_ID + ".initCommands"; //$NON-NLS-1$
+ public static final String ATTR_DELAY = Activator.PLUGIN_ID + ".delay"; //$NON-NLS-1$
+ public static final String ATTR_DO_RESET = Activator.PLUGIN_ID + ".doReset"; //$NON-NLS-1$
public static final String ATTR_LOAD_IMAGE = Activator.PLUGIN_ID + ".loadImage"; //$NON-NLS-1$
+ public static final String ATTR_LOAD_SYMBOLS = Activator.PLUGIN_ID + ".loadSymbols"; //$NON-NLS-1$
public static final String ATTR_IMAGE_FILE_NAME = Activator.PLUGIN_ID + ".imageFileName"; //$NON-NLS-1$
+ public static final String ATTR_SYMBOLS_FILE_NAME = Activator.PLUGIN_ID + ".symbolsFileName"; //$NON-NLS-1$
+ public static final String ATTR_IMAGE_OFFSET = Activator.PLUGIN_ID + ".imageOffset"; //$NON-NLS-1$
+ public static final String ATTR_SYMBOLS_OFFSET = Activator.PLUGIN_ID + ".symbolsOffset"; //$NON-NLS-1$
+ public static final String ATTR_SET_PC_REGISTER = Activator.PLUGIN_ID + ".setPcRegister"; //$NON-NLS-1$
+ public static final String ATTR_PC_REGISTER = Activator.PLUGIN_ID + ".pcRegister"; //$NON-NLS-1$
+ public static final String ATTR_SET_STOP_AT = Activator.PLUGIN_ID + ".setStopAt"; //$NON-NLS-1$
+ public static final String ATTR_STOP_AT = Activator.PLUGIN_ID + ".stopAt"; //$NON-NLS-1$
+ public static final String ATTR_SET_RESUME = Activator.PLUGIN_ID + ".setResume"; //$NON-NLS-1$
public static final String ATTR_RUN_COMMANDS = Activator.PLUGIN_ID + ".runCommands"; //$NON-NLS-1$
-
+
+ public static final boolean DEFAULT_DO_RESET = true;
+ public static final int DEFAULT_DELAY = 3;
public static final boolean DEFAULT_LOAD_IMAGE = false;
+ public static final boolean DEFAULT_LOAD_SYMBOLS = false;
+ public static final boolean DEFAULT_SET_PC_REGISTER = false;
+ public static final boolean DEFAULT_SET_STOP_AT = false;
+ public static final boolean DEFAULT_SET_RESUME = false;
public static final boolean DEFAULT_USE_DEFAULT_RUN = true;
-
+
}
diff --git a/jtag/org.eclipse.cdt.debug.gdbjtag.core/src/org/eclipse/cdt/debug/gdbjtag/core/jtagdevice/AbatronBDI2000.java b/jtag/org.eclipse.cdt.debug.gdbjtag.core/src/org/eclipse/cdt/debug/gdbjtag/core/jtagdevice/AbatronBDI2000.java
new file mode 100644
index 00000000000..0e0d091dfa7
--- /dev/null
+++ b/jtag/org.eclipse.cdt.debug.gdbjtag.core/src/org/eclipse/cdt/debug/gdbjtag/core/jtagdevice/AbatronBDI2000.java
@@ -0,0 +1,30 @@
+/*******************************************************************************
+ * Copyright (c) 2008 QNX Software Systems and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * QNX Software Systems - Initial API and implementation
+ * Andy Jin - Hardware debugging UI improvements, bug 229946
+ *******************************************************************************/
+package org.eclipse.cdt.debug.gdbjtag.core.jtagdevice;
+
+public class AbatronBDI2000 extends DefaultGDBJtagDeviceImpl {
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.debug.gdbjtag.core.jtagdevice.DefaultGDBJtagDeviceImpl#getDefaultIpAddress()
+ */
+ public String getDefaultIpAddress() {
+ return "bdi2000";
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.debug.gdbjtag.core.jtagdevice.DefaultGDBJtagDeviceImpl#getDefaultPortNumber()
+ */
+ public String getDefaultPortNumber() {
+ return "2001";
+ }
+
+}
diff --git a/jtag/org.eclipse.cdt.debug.gdbjtag.core/src/org/eclipse/cdt/debug/gdbjtag/core/jtagdevice/DefaultGDBJtagDeviceImpl.java b/jtag/org.eclipse.cdt.debug.gdbjtag.core/src/org/eclipse/cdt/debug/gdbjtag/core/jtagdevice/DefaultGDBJtagDeviceImpl.java
new file mode 100644
index 00000000000..7b85c33c6da
--- /dev/null
+++ b/jtag/org.eclipse.cdt.debug.gdbjtag.core/src/org/eclipse/cdt/debug/gdbjtag/core/jtagdevice/DefaultGDBJtagDeviceImpl.java
@@ -0,0 +1,126 @@
+/*******************************************************************************
+ * Copyright (c) 2008 QNX Software Systems and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * QNX Software Systems - Initial API and implementation
+ * Andy Jin - Hardware debugging UI improvements, bug 229946
+ *******************************************************************************/
+
+package org.eclipse.cdt.debug.gdbjtag.core.jtagdevice;
+
+import java.util.Collection;
+
+
+/**
+ * @author ajin
+ *
+ */
+public class DefaultGDBJtagDeviceImpl implements IGDBJtagDevice {
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.debug.gdbjtag.core.jtagdevice.IGDBJtagDevice#doDelay(int, java.util.Collection)
+ */
+ public void doDelay(int delay, Collection commands) {
+ String cmd = "monitor delay " + String.valueOf( delay * 1000 );
+ addCmd(commands, cmd);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.debug.gdbjtag.core.jtagdevice.IGDBJtagDevice#doReset(java.util.Collection)
+ */
+ public void doReset(Collection commands) {
+ String cmd = "monitor reset run";
+ addCmd(commands, cmd);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.debug.gdbjtag.core.jtagdevice.IGDBJtagDevice#getDefaultDelay()
+ */
+ public int getDefaultDelay() {
+ return 0;
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.debug.gdbjtag.core.jtagdevice.IGDBJtagDevice#doRemote(java.lang.String, int, java.util.Collection)
+ */
+ public void doRemote(String ip, int port, Collection commands) {
+ String cmd = "target remote " + ip + ":" + String.valueOf(port);
+ addCmd(commands, cmd);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.debug.gdbjtag.core.jtagdevice.IGDBJtagDevice#doHalt(java.util.Collection)
+ */
+ public void doHalt(Collection commands) {
+ String cmd = "monitor halt";
+ addCmd(commands, cmd);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.debug.gdbjtag.core.jtagdevice.IGDBJtagDevice#doContinue(java.util.Collection)
+ */
+ public void doContinue(Collection commands) {
+ String cmd = "continue";
+ addCmd(commands, cmd);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.debug.gdbjtag.core.jtagdevice.IGDBJtagDevice#doLoadImage(java.lang.String, java.lang.String, java.util.Collection)
+ */
+ public void doLoadImage(String imageFileName, String imageOffset, Collection commands) {
+ String cmd = "restore " + imageFileName + " " + imageOffset;
+ addCmd(commands, cmd);
+
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.debug.gdbjtag.core.jtagdevice.IGDBJtagDevice#doLoadSymbol(java.lang.String, java.lang.String, java.util.Collection)
+ */
+ public void doLoadSymbol(String symbolFileName, String symbolOffset, Collection commands) {
+ String cmd = "add-sym " + symbolFileName + " " + symbolOffset;
+ addCmd(commands, cmd);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.debug.gdbjtag.core.jtagdevice.IGDBJtagDevice#doSetPC(java.lang.String, java.util.Collection)
+ */
+ public void doSetPC(String pc, Collection commands) {
+ String cmd = "set $pc=0x" + pc;
+ addCmd(commands, cmd);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.debug.gdbjtag.core.jtagdevice.IGDBJtagDevice#doStopAt(java.lang.String, java.util.Collection)
+ */
+ public void doStopAt(String stopAt, Collection commands) {
+ String cmd = "break " + stopAt;
+ addCmd(commands, cmd);
+ }
+
+ /*
+ * addCmd Utility method to format commands
+ */
+ protected void addCmd (Collection commands, String cmd) {
+ commands.add(cmd + System.getProperty("line.separator"));
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.debug.gdbjtag.core.jtagdevice.IGDBJtagDevice#getDefaultIpAddress()
+ */
+ public String getDefaultIpAddress() {
+ return "localhost";
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.debug.gdbjtag.core.jtagdevice.IGDBJtagDevice#getDefaultPortNumber()
+ */
+ public String getDefaultPortNumber() {
+ return "10000";
+ }
+
+}
diff --git a/jtag/org.eclipse.cdt.debug.gdbjtag.core/src/org/eclipse/cdt/debug/gdbjtag/core/jtagdevice/GDBJtagDeviceContribution.java b/jtag/org.eclipse.cdt.debug.gdbjtag.core/src/org/eclipse/cdt/debug/gdbjtag/core/jtagdevice/GDBJtagDeviceContribution.java
new file mode 100644
index 00000000000..6b80fba52f5
--- /dev/null
+++ b/jtag/org.eclipse.cdt.debug.gdbjtag.core/src/org/eclipse/cdt/debug/gdbjtag/core/jtagdevice/GDBJtagDeviceContribution.java
@@ -0,0 +1,93 @@
+/*******************************************************************************
+ * Copyright (c) 2008 QNX Software Systems and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * QNX Software Systems - Initial API and implementation
+ * Andy Jin - Hardware debugging UI improvements, bug 229946
+ *******************************************************************************/
+package org.eclipse.cdt.debug.gdbjtag.core.jtagdevice;
+
+import org.eclipse.cdt.debug.gdbjtag.core.Activator;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.debug.core.DebugPlugin;
+
+public class GDBJtagDeviceContribution {
+
+ private String deviceId;
+ private String deviceName;
+ private String deviceClassName;
+ private IGDBJtagDevice device;
+
+ /**
+ * @return the deviceId
+ */
+ public String getDeviceId() {
+ return this.deviceId;
+ }
+
+ /**
+ * @param deviceId the deviceId to set
+ */
+ public void setDeviceId(String deviceId) {
+ this.deviceId = deviceId;
+ }
+
+ /**
+ * @return the deviceName
+ */
+ public String getDeviceName() {
+ return this.deviceName;
+ }
+
+ /**
+ * @param deviceName the deviceName to set
+ */
+ public void setDeviceName(String deviceName) {
+ this.deviceName = deviceName;
+ }
+
+ /**
+ * @return the deviceClassName
+ */
+ public String getDeviceClassName() {
+ return this.deviceClassName;
+ }
+
+ /**
+ * @param deviceClassName the deviceClassName to set
+ */
+ public void setDeviceClassName(String deviceClassName) {
+ this.deviceClassName = deviceClassName;
+ }
+
+ public IGDBJtagDevice getDevice() throws NullPointerException {
+ if (device != null)
+ return device;
+ Object o = null;
+ try {
+ o = Class.forName(getDeviceClassName()).newInstance();
+ } catch (InstantiationException e) {
+ Activator.log(new Status(IStatus.ERROR, Activator.getUniqueIdentifier(),
+ DebugPlugin.INTERNAL_ERROR, "Error instantiating "
+ + getDeviceClassName() + " class", null));
+ throw new NullPointerException();
+ } catch (IllegalAccessException e) {
+ Activator.log(new Status(IStatus.ERROR, Activator.getUniqueIdentifier(),
+ DebugPlugin.INTERNAL_ERROR, "Error instantiating "
+ + getDeviceClassName() + " class", null));
+ throw new NullPointerException();
+ } catch (ClassNotFoundException e) {
+ Activator.log(new Status(IStatus.ERROR, Activator.getUniqueIdentifier(),
+ DebugPlugin.INTERNAL_ERROR, "Error instantiating "
+ + getDeviceClassName() + " class", null));
+ throw new NullPointerException();
+ }
+ return device = (IGDBJtagDevice) o;
+ }
+
+}
diff --git a/jtag/org.eclipse.cdt.debug.gdbjtag.core/src/org/eclipse/cdt/debug/gdbjtag/core/jtagdevice/GDBJtagDeviceContributionFactory.java b/jtag/org.eclipse.cdt.debug.gdbjtag.core/src/org/eclipse/cdt/debug/gdbjtag/core/jtagdevice/GDBJtagDeviceContributionFactory.java
new file mode 100644
index 00000000000..a74c0f67a3c
--- /dev/null
+++ b/jtag/org.eclipse.cdt.debug.gdbjtag.core/src/org/eclipse/cdt/debug/gdbjtag/core/jtagdevice/GDBJtagDeviceContributionFactory.java
@@ -0,0 +1,85 @@
+/*******************************************************************************
+ * Copyright (c) 2008 QNX Software Systems and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * QNX Software Systems - Initial API and implementation
+ * Andy Jin - Hardware debugging UI improvements, bug 229946
+ *******************************************************************************/
+package org.eclipse.cdt.debug.gdbjtag.core.jtagdevice;
+
+import java.util.ArrayList;
+
+import org.eclipse.cdt.debug.gdbjtag.core.Activator;
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.IExtensionPoint;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.debug.core.DebugPlugin;
+
+public class GDBJtagDeviceContributionFactory {
+ private static final String EXTENSION_POINT_NAME = "JTagDevice";
+ private static final String MAIN_ELEMENT = "device";
+
+ private static GDBJtagDeviceContributionFactory instance;
+ protected ArrayList contributions;
+
+ private GDBJtagDeviceContributionFactory() {
+ contributions = new ArrayList();
+ loadSubtypeContributions();
+ }
+
+ public GDBJtagDeviceContribution[] getGDBJtagDeviceContribution() {
+ return (GDBJtagDeviceContribution[]) contributions.toArray(
+ new GDBJtagDeviceContribution[contributions.size()]);
+ }
+
+ private void loadSubtypeContributions() {
+
+ IExtensionPoint ep = Platform.getExtensionRegistry().getExtensionPoint(
+ Activator.getUniqueIdentifier(), EXTENSION_POINT_NAME);
+ if (ep == null)
+ return;
+ IConfigurationElement[] elements = ep.getConfigurationElements();
+ for (int i = 0; i < elements.length; i++) {
+ IConfigurationElement configurationElement = elements[i];
+ if (configurationElement.getName().equals(MAIN_ELEMENT)) {
+ String id = getRequired(configurationElement, "id");
+ String name = getRequired(configurationElement, "name");
+ String className = getRequired(configurationElement, "class");
+ GDBJtagDeviceContribution adapter = new GDBJtagDeviceContribution();
+ adapter.setDeviceId(id);
+ adapter.setDeviceName(name);
+ adapter.setDeviceClassName(className);
+ addContribution(adapter);
+ }
+ }
+ }
+
+ public void addContribution(GDBJtagDeviceContribution contribution) {
+ contributions.add(contribution);
+
+ }
+
+ public static GDBJtagDeviceContributionFactory getInstance() {
+ if (instance == null) {
+ instance = new GDBJtagDeviceContributionFactory();
+ }
+ return instance;
+ }
+
+ private static String getRequired(IConfigurationElement configurationElement, String name) {
+ String elementValue = configurationElement.getAttribute(name);
+ if (elementValue == null)
+ Activator.log(new Status(IStatus.ERROR, Activator.getUniqueIdentifier(),
+ DebugPlugin.INTERNAL_ERROR, "Extension "
+ + configurationElement.getDeclaringExtension().getUniqueIdentifier()
+ + " missing required attribute: " + name, null));
+ return elementValue;
+ }
+
+}
diff --git a/jtag/org.eclipse.cdt.debug.gdbjtag.core/src/org/eclipse/cdt/debug/gdbjtag/core/jtagdevice/GenericDevice.java b/jtag/org.eclipse.cdt.debug.gdbjtag.core/src/org/eclipse/cdt/debug/gdbjtag/core/jtagdevice/GenericDevice.java
new file mode 100644
index 00000000000..802b434e129
--- /dev/null
+++ b/jtag/org.eclipse.cdt.debug.gdbjtag.core/src/org/eclipse/cdt/debug/gdbjtag/core/jtagdevice/GenericDevice.java
@@ -0,0 +1,36 @@
+/*******************************************************************************
+ * Copyright (c) 2008 QNX Software Systems and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * QNX Software Systems - Initial API and implementation
+ * Andy Jin - Hardware debugging UI improvements, bug 229946
+ *******************************************************************************/
+package org.eclipse.cdt.debug.gdbjtag.core.jtagdevice;
+
+import java.util.Collection;
+
+public class GenericDevice extends DefaultGDBJtagDeviceImpl {
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.debug.gdbjtag.core.jtagdevice.DefaultGDBJtagDeviceImpl#doDelay(int, java.util.Collection)
+ */
+ public void doDelay(int delay, Collection commands) {
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.debug.gdbjtag.core.jtagdevice.DefaultGDBJtagDeviceImpl#doHalt(java.util.Collection)
+ */
+ public void doHalt(Collection commands) {
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.debug.gdbjtag.core.jtagdevice.DefaultGDBJtagDeviceImpl#doReset(java.util.Collection)
+ */
+ public void doReset(Collection commands) {
+ }
+
+}
diff --git a/jtag/org.eclipse.cdt.debug.gdbjtag.core/src/org/eclipse/cdt/debug/gdbjtag/core/jtagdevice/IGDBJtagDevice.java b/jtag/org.eclipse.cdt.debug.gdbjtag.core/src/org/eclipse/cdt/debug/gdbjtag/core/jtagdevice/IGDBJtagDevice.java
new file mode 100644
index 00000000000..e305c54dd97
--- /dev/null
+++ b/jtag/org.eclipse.cdt.debug.gdbjtag.core/src/org/eclipse/cdt/debug/gdbjtag/core/jtagdevice/IGDBJtagDevice.java
@@ -0,0 +1,108 @@
+/*******************************************************************************
+ * Copyright (c) 2008 QNX Software Systems and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * QNX Software Systems - Initial API and implementation
+ * Andy Jin - Hardware debugging UI improvements, bug 229946
+ *******************************************************************************/
+
+package org.eclipse.cdt.debug.gdbjtag.core.jtagdevice;
+
+import java.util.Collection;
+
+/**
+ * Provides device specific debug commands for different hardware
+ * JTAG devices. See <code>DefaultGDBJtagDeviceImpl</code> for
+ * the default implementations.
+ *
+ */
+public interface IGDBJtagDevice {
+
+ /**
+ * Device reset command
+ * @param commands ommands collection
+ */
+ public void doReset(Collection commands);
+
+ /**
+ * Default device delay in millisecond
+ * @return delay in second
+ */
+ public int getDefaultDelay();
+
+ /**
+ * Target needs some delay in order to initialize
+ * @param delay delay in second
+ * @param commands device specific delay commands
+ */
+ public void doDelay(int delay, Collection commands);
+
+ /**
+ * Target needs to be in pause mode in order to do
+ * JTAG debug. This should happen before the target
+ * MMU takes control
+ * @param commands device specific pause commands
+ */
+ public void doHalt(Collection commands);
+
+ /**
+ * Commands to connect to remote JTAG device
+ * @param ip host name of IP address of JTAG device
+ * @param port TCP socket port number of JTAG device
+ * @param commands remote connection commands
+ */
+ public void doRemote(String ip, int port, Collection commands);
+
+ /**
+ * Commands to download the executable binary to target
+ * @param imageFileName executable binary file name
+ * @param imageOffset executable binary memory offset
+ * @param commands executable binary download commands
+ */
+ public void doLoadImage(String imageFileName, String imageOffset, Collection commands);
+
+ /**
+ * Commands to download the symbols file to target
+ * @param symbolFileName symbols file name
+ * @param symbolOffset symbols file memory offset
+ * @param commands symbols file download command
+ */
+ public void doLoadSymbol(String symbolFileName, String symbolOffset, Collection commands);
+
+ /**
+ * Commands to set initial program counter
+ * @param pc program counter
+ * @param commands set program counter commands
+ */
+ public void doSetPC(String pc, Collection commands);
+
+ /**
+ * Commands to set initial breakpoint
+ * @param stopAt initial breakpoint location
+ * @param commands set breakpoint commands
+ */
+ public void doStopAt(String stopAt, Collection commands);
+
+ /**
+ * De-freeze the target in order to start debugging
+ * @param commands commands to continue the target
+ */
+ public void doContinue(Collection commands);
+
+ /**
+ * Device specific default hostname of IP address
+ * @return default hostname of IP address
+ */
+ public String getDefaultIpAddress();
+
+ /**
+ * Device specific default port number
+ * @return default port number
+ */
+ public String getDefaultPortNumber();
+
+}
diff --git a/jtag/org.eclipse.cdt.debug.gdbjtag.core/src/org/eclipse/cdt/debug/gdbjtag/core/jtagdevice/MacraigorUsb2Demon.java b/jtag/org.eclipse.cdt.debug.gdbjtag.core/src/org/eclipse/cdt/debug/gdbjtag/core/jtagdevice/MacraigorUsb2Demon.java
new file mode 100644
index 00000000000..9ff0c5e96c4
--- /dev/null
+++ b/jtag/org.eclipse.cdt.debug.gdbjtag.core/src/org/eclipse/cdt/debug/gdbjtag/core/jtagdevice/MacraigorUsb2Demon.java
@@ -0,0 +1,46 @@
+/*******************************************************************************
+ * Copyright (c) 2008 QNX Software Systems and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * QNX Software Systems - Initial API and implementation
+ * Andy Jin - Hardware debugging UI improvements, bug 229946
+ *******************************************************************************/
+package org.eclipse.cdt.debug.gdbjtag.core.jtagdevice;
+
+import java.util.Collection;
+
+
+/**
+ * @author ajin
+ *
+ */
+public class MacraigorUsb2Demon extends DefaultGDBJtagDeviceImpl {
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.debug.gdbjtag.core.jtagdevice.DefaultGDBJtagDeviceImpl#getDefaultPortNumber()
+ */
+ public String getDefaultPortNumber() {
+ return "8888";
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.debug.gdbjtag.core.jtagdevice.DefaultGDBJtagDeviceImpl#doDelay(int, java.util.Collection)
+ */
+ public void doDelay(int delay, Collection commands) {
+ String cmd = "monitor sleep " + String.valueOf(delay);
+ super.addCmd(commands, cmd);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.debug.gdbjtag.core.jtagdevice.DefaultGDBJtagDeviceImpl#doReset(java.util.Collection)
+ */
+ public void doReset(Collection commands) {
+ String cmd = "monitor resetrun";
+ super.addCmd(commands, cmd);
+ }
+
+}

Back to the top