Skip to main content
summaryrefslogtreecommitdiffstats
path: root/jtag
diff options
context:
space:
mode:
authorJohn Dallaway2019-08-23 14:45:13 -0400
committerJohn Dallaway2019-08-23 14:45:13 -0400
commit4ebb82d8b2f02e925ee5e29b22a7803fb8ef7fd2 (patch)
tree2e0a83fa539aec8778751671293bf1b89696cca0 /jtag
parent49c7ae5f3b8d566b4192f865aa3ce0cc5330c467 (diff)
downloadorg.eclipse.cdt-4ebb82d8b2f02e925ee5e29b22a7803fb8ef7fd2.tar.gz
org.eclipse.cdt-4ebb82d8b2f02e925ee5e29b22a7803fb8ef7fd2.tar.xz
org.eclipse.cdt-4ebb82d8b2f02e925ee5e29b22a7803fb8ef7fd2.zip
Bug 535163: Use 'reset and halt' command (DAP)
Change-Id: Id5ec90a062a203933a2756d0a2f71ce36d00daf8 Signed-off-by: John Dallaway <john@dallaway.org.uk>
Diffstat (limited to 'jtag')
-rw-r--r--jtag/org.eclipse.cdt.debug.dap.gdbjtag/src/org/eclipse/cdt/debug/dap/gdbjtag/DapGdbJtagLaunchDelegate.java39
1 files changed, 32 insertions, 7 deletions
diff --git a/jtag/org.eclipse.cdt.debug.dap.gdbjtag/src/org/eclipse/cdt/debug/dap/gdbjtag/DapGdbJtagLaunchDelegate.java b/jtag/org.eclipse.cdt.debug.dap.gdbjtag/src/org/eclipse/cdt/debug/dap/gdbjtag/DapGdbJtagLaunchDelegate.java
index a5baf797d5..176ffac929 100644
--- a/jtag/org.eclipse.cdt.debug.dap.gdbjtag/src/org/eclipse/cdt/debug/dap/gdbjtag/DapGdbJtagLaunchDelegate.java
+++ b/jtag/org.eclipse.cdt.debug.dap.gdbjtag/src/org/eclipse/cdt/debug/dap/gdbjtag/DapGdbJtagLaunchDelegate.java
@@ -1,3 +1,16 @@
+/*******************************************************************************
+ * Copyright (c) 2019 Kichwa Coders and others.
+ *
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * John Dallaway - Use 'reset and halt' command (Bug 535163)
+ *******************************************************************************/
package org.eclipse.cdt.debug.dap.gdbjtag;
import java.net.URI;
@@ -222,26 +235,38 @@ public class DapGdbJtagLaunchDelegate extends DapLaunchDelegate {
private void addInitCommands(Map<String, Object> params, IGDBJtagDevice jtagDevice, Map<String, Object> attributes)
throws CoreException {
+ boolean doReset = CDebugUtils.getAttribute(attributes, IGDBJtagConstants.ATTR_DO_RESET,
+ IGDBJtagConstants.DEFAULT_DO_RESET);
+ boolean doHalt = CDebugUtils.getAttribute(attributes, IGDBJtagConstants.ATTR_DO_HALT,
+ IGDBJtagConstants.DEFAULT_DO_HALT);
+ int defaultDelay = jtagDevice.getDefaultDelay();
+ int delay = CDebugUtils.getAttribute(attributes, IGDBJtagConstants.ATTR_DELAY, defaultDelay);
+ List<String> resetAndHaltCommands = new ArrayList<>();
+ jtagDevice.doResetAndHalt(resetAndHaltCommands);
+ boolean useResetAndHalt = doReset && doHalt && (0 == delay) && !resetAndHaltCommands.isEmpty();
+
List<String> commands = new ArrayList<>();
- if (CDebugUtils.getAttribute(attributes, IGDBJtagConstants.ATTR_DO_RESET, IGDBJtagConstants.DEFAULT_DO_RESET)) {
+ if (doReset) {
int size = commands.size();
- jtagDevice.doReset(commands);
+ if (useResetAndHalt) {
+ commands.addAll(resetAndHaltCommands);
+ } else {
+ jtagDevice.doReset(commands);
+ }
if (size == commands.size()) {
throw newCoreException(
String.format("Reset command not defined for device '%s'", getGDBJtagDeviceName(attributes)));
}
}
- if (CDebugUtils.getAttribute(attributes, IGDBJtagConstants.ATTR_DO_RESET, IGDBJtagConstants.DEFAULT_DO_RESET)) {
- int defaultDelay = jtagDevice.getDefaultDelay();
- int delay = CDebugUtils.getAttribute(attributes, IGDBJtagConstants.ATTR_DELAY, defaultDelay);
+ if (doReset && (0 != delay)) {
int size = commands.size();
jtagDevice.doDelay(delay, commands);
- if (size == commands.size() && (delay != 0)) {
+ if (size == commands.size()) {
throw newCoreException(
String.format("Delay command not defined for device '%s'", getGDBJtagDeviceName(attributes)));
}
}
- if (CDebugUtils.getAttribute(attributes, IGDBJtagConstants.ATTR_DO_HALT, IGDBJtagConstants.DEFAULT_DO_HALT)) {
+ if (doHalt && !useResetAndHalt) {
int size = commands.size();
jtagDevice.doHalt(commands);
if (size == commands.size()) {

Back to the top