summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTat-Chee Wan (USM)2011-06-18 16:13:35 +0800
committerTat-Chee Wan (USM)2011-06-18 16:13:35 +0800
commit3bd42c4969f92d991605c89d4cb3112cc7c5e917 (patch)
tree12caebdc774b30c2fffd2c887f6aac2860b016a8
parentad497e188b490981211ecf61edf12a92d32a233b (diff)
preliminary kill command support
When GDB Kill command received, reboot the brick. Conditionalize Step command support based on compiler flags.
-rw-r--r--Debugger/debug_internals.h2
-rw-r--r--Debugger/debug_runlooptasks.S22
-rw-r--r--Debugger/debug_stub.S29
3 files changed, 50 insertions, 3 deletions
diff --git a/Debugger/debug_internals.h b/Debugger/debug_internals.h
index 82c0e38..9dc2bad 100644
--- a/Debugger/debug_internals.h
+++ b/Debugger/debug_internals.h
@@ -88,6 +88,8 @@
#define CMD_REG_SETONE_MINPARAMLEN (2 + CMD_REG_REGPARAMLEN)
#define CMD_REG_SETONE_MAXPARAMLEN (3 + CMD_REG_REGPARAMLEN)
#define CMD_REG_SETALL_PARAMLEN (CMD_REG_NUMREGS*CMD_REG_REGPARAMLEN)
+#define CMD_KILL_PARAMLEN 0
+
/*@}*/
/** @name Debug Memory Command Constants.
diff --git a/Debugger/debug_runlooptasks.S b/Debugger/debug_runlooptasks.S
index a9e0fcd..a80c46a 100644
--- a/Debugger/debug_runlooptasks.S
+++ b/Debugger/debug_runlooptasks.S
@@ -75,7 +75,7 @@
.code 32
.align 4
.global dbg__runloopTasks
-
+ .global dbg__reboot
#ifdef __NXOS__
/****************************************************************************
@@ -103,6 +103,26 @@ dbg__runloopTasks:
pop {pc}
#endif
+#ifdef __NXOS__
+ .extern nx_core_reset
+/****************************************************************************
+ *
+ * NxOS Reboot Routine
+ *
+ ****************************************************************************/
+ dbg__reboot:
+ b nx_core_reset /* Reboot Brick, won't return */
+
+#else
+/****************************************************************************
+ *
+ * NXT Firmware Reboot Routine
+ *
+ ****************************************************************************/
+dbg__reboot:
+ bx lr
+#endif
+
#ifdef __NXOS__
/****************************************************************************
diff --git a/Debugger/debug_stub.S b/Debugger/debug_stub.S
index eb064fc..fc4f368 100644
--- a/Debugger/debug_stub.S
+++ b/Debugger/debug_stub.S
@@ -242,8 +242,13 @@ debug_cmdJumpTable:
.word _dbg__cmd_ReadMem /* 'm' */
.word _dbg__cmd_WriteMem /* 'M' */
.word _dbg__cmd_Continue /* 'c' */
+#ifdef __NXOS__
+ .word _dbg__cmd_Step /* 's' */
+#else
+ /* NXT Firmware does not support Stepping */
.word _dbg__nop /* 's' */
- .word _dbg__nop /* 'k' */
+#endif
+ .word _dbg__cmd_Kill /* 'k' */
.word _dbg__cmd_RemoveBreakpoint /* 'z' */
.word _dbg__cmd_InsertBreakpoint /* 'Z' */
.word _dbg__cmd_Status /* '?' */
@@ -1203,7 +1208,7 @@ _dbg__cont_is_manual_bkpt_or_address_specified:
* Step User Program Execution Command Handler
* Setup breakpoints before resuming execution of program.
*
- * If Address is specified, update the next instruction address to specified address
+ * If Address is specified, update the next instruction address to specified address
*
* If this is a Normal Breakpoint, then we need to install a Step Breakpoint at next instruction address
* and resume from current (Breakpoint) exception address
@@ -1260,6 +1265,26 @@ _dbg__step_is_manual_bkpt_or_address_specified:
bl dbg__activate_singlestep
b _dbg__switch2undefmode_withAck
+/* _dbg__cmd_Kill
+ * Kill User Program Execution Command Handler
+ * Kill Program, this is accomplished by rebooting the Brick
+ *
+ * On entry:
+ * r0: parameter buffer pointer (contents after '$' and '<cmdchar>')
+ * <NULL> (No Parameters)
+ * On exit:
+ * r0-r7: destroyed
+ * Note: This routine does not return to caller. Instead it calls
+ * the relevant system routine to reboot the Brick
+ */
+_dbg__cmd_Kill:
+ stmfd sp!, {lr} /* In case unexpected parameters were received */
+ bl __dbg__cmdParamLen
+ teq r1, #CMD_KILL_PARAMLEN /* Check for correct length */
+ bne __dbg__procCmdParamError /* Unexpected input, report error */
+
+ bl __dbg__procAckOnly /* send Ack to keep GDB server happy */
+ b dbg__reboot
/* _dbg__proc_brkpt_params
* Process Breakpoint Parameters