mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-31 21:05:37 +02:00
Bug 535163: Use 'reset and halt' command
Change-Id: Icfe5796a33c01208c1fa98cc6357d21c0e83b9ae Signed-off-by: John Dallaway <john@dallaway.org.uk>
This commit is contained in:
parent
b1f14709b8
commit
49c7ae5f3b
2 changed files with 47 additions and 10 deletions
|
@ -22,6 +22,7 @@
|
||||||
* John Dallaway - Test for reset/delay/halt command not defined (Bug 361881)
|
* John Dallaway - Test for reset/delay/halt command not defined (Bug 361881)
|
||||||
* Torbjörn Svensson (STMicroelectronics) - Bug 535024
|
* Torbjörn Svensson (STMicroelectronics) - Bug 535024
|
||||||
* John Dallaway - Report download progress (Bug 543149)
|
* John Dallaway - Report download progress (Bug 543149)
|
||||||
|
* John Dallaway - Use 'reset and halt' command (Bug 535163)
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.debug.gdbjtag.core;
|
package org.eclipse.cdt.debug.gdbjtag.core;
|
||||||
|
|
||||||
|
@ -412,7 +413,11 @@ public class GDBJtagDSFFinalLaunchSequence extends FinalLaunchSequence {
|
||||||
if (CDebugUtils.getAttribute(getAttributes(), IGDBJtagConstants.ATTR_DO_RESET,
|
if (CDebugUtils.getAttribute(getAttributes(), IGDBJtagConstants.ATTR_DO_RESET,
|
||||||
IGDBJtagConstants.DEFAULT_DO_RESET)) {
|
IGDBJtagConstants.DEFAULT_DO_RESET)) {
|
||||||
List<String> commands = new ArrayList<>();
|
List<String> commands = new ArrayList<>();
|
||||||
fGdbJtagDevice.doReset(commands);
|
if (useResetAndHalt()) {
|
||||||
|
fGdbJtagDevice.doResetAndHalt(commands);
|
||||||
|
} else {
|
||||||
|
fGdbJtagDevice.doReset(commands);
|
||||||
|
}
|
||||||
if (commands.isEmpty()) {
|
if (commands.isEmpty()) {
|
||||||
setError(String.format(Messages.getString("GDBJtagDebugger.reset_not_defined"), getGDBJtagDeviceName()), //$NON-NLS-1$
|
setError(String.format(Messages.getString("GDBJtagDebugger.reset_not_defined"), getGDBJtagDeviceName()), //$NON-NLS-1$
|
||||||
rm);
|
rm);
|
||||||
|
@ -437,9 +442,11 @@ public class GDBJtagDSFFinalLaunchSequence extends FinalLaunchSequence {
|
||||||
List<String> commands = new ArrayList<>();
|
List<String> commands = new ArrayList<>();
|
||||||
int delay = CDebugUtils.getAttribute(getAttributes(), IGDBJtagConstants.ATTR_DELAY, defaultDelay);
|
int delay = CDebugUtils.getAttribute(getAttributes(), IGDBJtagConstants.ATTR_DELAY, defaultDelay);
|
||||||
fGdbJtagDevice.doDelay(delay, commands);
|
fGdbJtagDevice.doDelay(delay, commands);
|
||||||
if (commands.isEmpty() && (delay != 0)) {
|
if (0 == delay) {
|
||||||
setError(String.format(Messages.getString("GDBJtagDebugger.delay_not_defined"), getGDBJtagDeviceName()), //$NON-NLS-1$
|
rm.done();
|
||||||
rm);
|
} else if (commands.isEmpty()) {
|
||||||
|
setError(String.format(Messages.getString("GDBJtagDebugger.delay_not_defined"), //$NON-NLS-1$
|
||||||
|
getGDBJtagDeviceName()), rm);
|
||||||
} else {
|
} else {
|
||||||
queueCommands(commands, rm);
|
queueCommands(commands, rm);
|
||||||
}
|
}
|
||||||
|
@ -454,7 +461,7 @@ public class GDBJtagDSFFinalLaunchSequence extends FinalLaunchSequence {
|
||||||
/** @since 8.2 */
|
/** @since 8.2 */
|
||||||
@Execute
|
@Execute
|
||||||
public void stepHaltBoard(final RequestMonitor rm) {
|
public void stepHaltBoard(final RequestMonitor rm) {
|
||||||
if (CDebugUtils.getAttribute(getAttributes(), IGDBJtagConstants.ATTR_DO_HALT,
|
if (!useResetAndHalt() && CDebugUtils.getAttribute(getAttributes(), IGDBJtagConstants.ATTR_DO_HALT,
|
||||||
IGDBJtagConstants.DEFAULT_DO_HALT)) {
|
IGDBJtagConstants.DEFAULT_DO_HALT)) {
|
||||||
List<String> commands = new ArrayList<>();
|
List<String> commands = new ArrayList<>();
|
||||||
fGdbJtagDevice.doHalt(commands);
|
fGdbJtagDevice.doHalt(commands);
|
||||||
|
@ -772,6 +779,21 @@ public class GDBJtagDSFFinalLaunchSequence extends FinalLaunchSequence {
|
||||||
return sb.toString();
|
return sb.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determine if reset and halt should be issued as one command
|
||||||
|
*/
|
||||||
|
private boolean useResetAndHalt() {
|
||||||
|
final boolean doReset = CDebugUtils.getAttribute(getAttributes(), IGDBJtagConstants.ATTR_DO_RESET,
|
||||||
|
IGDBJtagConstants.DEFAULT_DO_RESET);
|
||||||
|
final boolean doHalt = CDebugUtils.getAttribute(getAttributes(), IGDBJtagConstants.ATTR_DO_HALT,
|
||||||
|
IGDBJtagConstants.DEFAULT_DO_HALT);
|
||||||
|
final int defaultDelay = fGdbJtagDevice.getDefaultDelay();
|
||||||
|
final int delay = CDebugUtils.getAttribute(getAttributes(), IGDBJtagConstants.ATTR_DELAY, defaultDelay);
|
||||||
|
final List<String> resetAndHaltCommands = new ArrayList<>();
|
||||||
|
fGdbJtagDevice.doResetAndHalt(resetAndHaltCommands);
|
||||||
|
return doReset && doHalt && (0 == delay) && !resetAndHaltCommands.isEmpty();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Cleanup now that the sequence has been run.
|
* Cleanup now that the sequence has been run.
|
||||||
* @since 8.2
|
* @since 8.2
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2008, 2012 QNX Software Systems and others.
|
* Copyright (c) 2008, 2019 QNX Software Systems and others.
|
||||||
*
|
*
|
||||||
* This program and the accompanying materials
|
* This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License 2.0
|
* are made available under the terms of the Eclipse Public License 2.0
|
||||||
|
@ -11,6 +11,7 @@
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* QNX Software Systems - Initial API and implementation
|
* QNX Software Systems - Initial API and implementation
|
||||||
* Andy Jin - Hardware debugging UI improvements, bug 229946
|
* Andy Jin - Hardware debugging UI improvements, bug 229946
|
||||||
|
* John Dallaway - Support 'reset and halt' command, bug 535163
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
|
|
||||||
package org.eclipse.cdt.debug.gdbjtag.core.jtagdevice;
|
package org.eclipse.cdt.debug.gdbjtag.core.jtagdevice;
|
||||||
|
@ -26,13 +27,13 @@ import java.util.Collection;
|
||||||
public interface IGDBJtagDevice {
|
public interface IGDBJtagDevice {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Device reset command
|
* Device reset and run commands
|
||||||
*
|
*
|
||||||
* @param commands
|
* @param commands
|
||||||
* implementation should populate the collection with the gdb
|
* implementation should populate the collection with the gdb
|
||||||
* commands that will reset the device, or leave the collection
|
* commands that will reset the device and let it run, or leave
|
||||||
* as-is if that operation is either unsupported or not
|
* the collection as-is if that operation is either unsupported
|
||||||
* applicable
|
* or not applicable
|
||||||
*/
|
*/
|
||||||
public void doReset(Collection<String> commands);
|
public void doReset(Collection<String> commands);
|
||||||
|
|
||||||
|
@ -68,6 +69,20 @@ public interface IGDBJtagDevice {
|
||||||
*/
|
*/
|
||||||
public void doHalt(Collection<String> commands);
|
public void doHalt(Collection<String> commands);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Device reset and immediate halt as a single command
|
||||||
|
*
|
||||||
|
* @param commands
|
||||||
|
* implementation should populate the collection with the
|
||||||
|
* single gdb command that will reset and halt the target, or
|
||||||
|
* leave the collection as-is if that operation is either
|
||||||
|
* unsupported or not applicable
|
||||||
|
* @since 9.3
|
||||||
|
*/
|
||||||
|
default void doResetAndHalt(Collection<String> commands) {
|
||||||
|
/* override where supported by debugger */
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Commands to connect to remote JTAG device
|
* Commands to connect to remote JTAG device
|
||||||
*
|
*
|
||||||
|
|
Loading…
Add table
Reference in a new issue