aboutsummaryrefslogtreecommitdiff
path: root/AT91SAM7S256/armdebug
diff options
context:
space:
mode:
authorTat-Chee Wan (USM)2011-03-15 09:51:06 +0800
committerTat-Chee Wan (USM)2011-03-15 09:51:06 +0800
commit5ec6b212c148b98996eba98b4d3ce42ff9ec44fc (patch)
tree1c8602bc8c73b0d5174586a3038ead08b854c320 /AT91SAM7S256/armdebug
parent00a0b7a3fffa6664d1a71b6feec795d50cbffb44 (diff)
parentcb04001b90e3466ac8770ce596c16dfc49846618 (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.S22
-rw-r--r--AT91SAM7S256/armdebug/Debugger/debug_stub.S5
2 files changed, 14 insertions, 13 deletions
diff --git a/AT91SAM7S256/armdebug/Debugger/debug_comm.S b/AT91SAM7S256/armdebug/Debugger/debug_comm.S
index 44a3a7a..6a7aa11 100644
--- a/AT91SAM7S256/armdebug/Debugger/debug_comm.S
+++ b/AT91SAM7S256/armdebug/Debugger/debug_comm.S
@@ -538,12 +538,13 @@ _msgbuf_checksum:
* No parameters (assume pointers were initialized previously using dbg__comm_init)
* On exit:
* r0: >0 = Valid GDB Message Length (incl '$', excluding '#' and checksum),
- * 0 = no valid message (yet), -1 = error
- * r1, r2, r3: Destroyed
+ * 0 = no valid message (yet), -1 = error
+ * r1: GDB Message Buffer Pointer (incl '$', excluding '#' and checksum)
+ * r2, r3: Destroyed
* Note: If GDB Message were returned, it is ASCIIZ terminated, does not include '#' and checksum
*/
dbg__getDebugMsg:
- stmfd sp!, {r4,lr}
+ stmfd sp!, {r4,r5,lr}
bl _dbg__usbHasMsg /* r0: message length, r1: segment number */
teq r0, #0
beq exit_dbg__getDebugMsg /* no new message, exit with R0 = 0 */
@@ -574,25 +575,25 @@ _hasMsg2Copy:
/* Check for valid GDB message */
mov r4, r0 /* keep message length in R4, assume to be within MSGBUF_SIZE */
- ldr r3, =debug_msgRxBufPtr
- ldr r3, [r3] /* Rx buffer Start Address */
+ ldr r5, =debug_msgRxBufPtr
+ ldr r5, [r5] /* Rx buffer Start Address */
#ifdef CHECK_GDBSTARTCHAR
/* Checked in dbg__bkpt_waitCMD */
- ldrb r0, [r3]
+ ldrb r0, [r5]
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]
+ ldrb r0, [r5, r2]
teq r0, #MSGBUF_CHKSUMCHAR
bne exit_dbg__getMsgError /* No checksum char '#', exit with error */
mov r1, #0
- strb r1, [r3, r2] /* Zero out '#' char for checksum calc later */
+ strb r1, [r5, r2] /* Zero out '#' char for checksum calc later */
- add r0, r3, #1 /* Checksum packet data (excl '$') */
+ add r0, r5, #1 /* Checksum packet data (excl '$') */
bl _msgbuf_checksum /* R2: length (excl '$'), R1: calculated checksum, R0: pointer to checksum in receive buffer */
mov r3, r1 /* Keep calculated checksum in R3 (R1 destroyed by ascii2byte) */
bl ascii2byte /* R0: received checksum, R1: address of next buffer location */
@@ -607,7 +608,8 @@ _hasMsg2Copy:
exit_dbg__getMsgError:
mov r0, #MSGBUF_MSGERROR
exit_dbg__getDebugMsg:
- ldmfd sp!, {r4,pc}
+ mov r1, r5 /* Return GDB Message Buffer Pointer in R1 */
+ ldmfd sp!, {r4,r5,pc}
/* _dbg__sendUSBMsg
* Internal USB send routine (interfaces with drivers).
diff --git a/AT91SAM7S256/armdebug/Debugger/debug_stub.S b/AT91SAM7S256/armdebug/Debugger/debug_stub.S
index f40b6fb..b020a09 100644
--- a/AT91SAM7S256/armdebug/Debugger/debug_stub.S
+++ b/AT91SAM7S256/armdebug/Debugger/debug_stub.S
@@ -533,14 +533,13 @@ dbg__bkpt_offset_outofrange:
*
****************************************************************************/
dbg__bkpt_waitCMD:
- bl dbg__getDebugMsg /* Read new message from Debugger, message buffer length in R0, 0 if none, -1 if error */
+ bl dbg__getDebugMsg /* Read new message from Debugger, buflen in R0, 0 if none, -1 if error, msgbuf pointer in R1 */
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 */
- ldr r4, =debug_msgRxBufPtr
- ldr r4, [r4] /* Rx buffer Start Address */
+ mov r4, r1 /* Use R4 as buffer pointer */
ldrb r0, [r4], #1 /* Look for '$' */
teq r0, #MSGBUF_STARTCHAR
movne r0, #MSG_ERRFORMAT /* Message Format invalid (not '$') */