summaryrefslogtreecommitdiff
path: root/AT91SAM7S256/armdebug
diff options
context:
space:
mode:
authorTat-Chee Wan (USM)2011-03-15 09:31:01 +0800
committerTat-Chee Wan (USM)2011-03-15 09:31:01 +0800
commit00a0b7a3fffa6664d1a71b6feec795d50cbffb44 (patch)
treea0e6983de4127f4d5655454246ddd1753e7da0c9 /AT91SAM7S256/armdebug
parentaa10f35b0d56f1f84c4d486d480a66ec2df316f4 (diff)
parentc5537648e1378aed86b32488f83bd86e4a3f55ff (diff)
Merge branch 'master' of ssh://svc.cs.usm.my/~/gitrepo-bare/armdebug
Diffstat (limited to 'AT91SAM7S256/armdebug')
-rw-r--r--AT91SAM7S256/armdebug/Debugger/debug_comm.S7
-rw-r--r--AT91SAM7S256/armdebug/Debugger/debug_macros.h7
-rw-r--r--AT91SAM7S256/armdebug/Debugger/debug_stub.S5
3 files changed, 11 insertions, 8 deletions
diff --git a/AT91SAM7S256/armdebug/Debugger/debug_comm.S b/AT91SAM7S256/armdebug/Debugger/debug_comm.S
index aa1e36c..44a3a7a 100644
--- a/AT91SAM7S256/armdebug/Debugger/debug_comm.S
+++ b/AT91SAM7S256/armdebug/Debugger/debug_comm.S
@@ -159,8 +159,8 @@ byte2ascii_cont:
lsl r2, r1, #24 /* Keep copy of input byte value R1[7:0], shifted to MSB R2[31:24] */
mov r4, #2 /* Loop counter */
_hex2char_lut r3 /* initialize LUT pointer */
-1: ror r1, r2, #28 /* Rotate MSNibble R2[31:28] into LSNibble position R1[3:0] */
- and r1, r1, #NIBBLE0 /* Mask out everything else */
+1: ror r2, r2, #28 /* Rotate MSNibble R2[31:28] into LSNibble position R2[3:0] */
+ and r1, r2, #NIBBLE0 /* Mask out everything else, store Nibble in R1 */
_hex2char_cont r1, r3 /* Convert nibble to ASCII char */
strb r1, [r0], #1
subs r4, r4, #1 /* decrement loop counter */
@@ -577,9 +577,12 @@ _hasMsg2Copy:
ldr r3, =debug_msgRxBufPtr
ldr r3, [r3] /* Rx buffer Start Address */
+#ifdef CHECK_GDBSTARTCHAR
+ /* Checked in dbg__bkpt_waitCMD */
ldrb r0, [r3]
teq r0, #MSGBUF_STARTCHAR /* Look for '$' */
bne exit_dbg__getMsgError /* No start char '$', exit with error */
+#endif
sub r2, r4, #MSGBUF_CHKSUMOFFSET /* Look for '#': Message Length - 3 = '#' offset */
ldrb r0, [r3, r2]
diff --git a/AT91SAM7S256/armdebug/Debugger/debug_macros.h b/AT91SAM7S256/armdebug/Debugger/debug_macros.h
index 2c6c6e7..dc1efba 100644
--- a/AT91SAM7S256/armdebug/Debugger/debug_macros.h
+++ b/AT91SAM7S256/armdebug/Debugger/debug_macros.h
@@ -159,11 +159,10 @@
* R3: destroyed
*/
.macro _dbg_outputMsgStatusErr
- mov r3, r0
+ mov r1, r0
ldr r0, =debug_OutMsgBuf
- ldr r1, =debug_ErrorResponsePrefix
- _dbg_stpcpy r0, r1, r2
- mov r1, r3
+ ldr r2, =debug_ErrorResponsePrefix
+ _dbg_stpcpy r0, r2, r3
bl byte2ascii /* R0 points to buffer position after byte value */
_asciiz r0, r1
.endm
diff --git a/AT91SAM7S256/armdebug/Debugger/debug_stub.S b/AT91SAM7S256/armdebug/Debugger/debug_stub.S
index 2f688c9..f40b6fb 100644
--- a/AT91SAM7S256/armdebug/Debugger/debug_stub.S
+++ b/AT91SAM7S256/armdebug/Debugger/debug_stub.S
@@ -533,13 +533,14 @@ dbg__bkpt_offset_outofrange:
*
****************************************************************************/
dbg__bkpt_waitCMD:
- bl dbg__getDebugMsg /* Read new message from Debugger, message buffer addr in R0, 0 if none, -1 if error */
+ bl dbg__getDebugMsg /* Read new message from Debugger, message buffer length in R0, 0 if none, -1 if error */
cmp r0, #0
beq _dbg__housekeeping /* No message yet, do housekeeping tasks */
movlt r0, #MSG_ERRCHKSUM /* Message invalid, checksum error? */
blt _dbg__cmdError /* Send response to GDB server */
/* Message now has $<packet info>\0 */
- mov r4, r0 /* Use R4 as Message Buffer pointer */
+ ldr r4, =debug_msgRxBufPtr
+ ldr r4, [r4] /* Rx buffer Start Address */
ldrb r0, [r4], #1 /* Look for '$' */
teq r0, #MSGBUF_STARTCHAR
movne r0, #MSG_ERRFORMAT /* Message Format invalid (not '$') */