From 6d55f0fda6820e343eac219dd3a338fc44a26618 Mon Sep 17 00:00:00 2001 From: Tat-Chee Wan (USM) Date: Fri, 18 Mar 2011 18:41:36 +0800 Subject: second attempt at determining whether we are in debug mode Checking CPSR does not seem to be reliable in cCommHandleDebug which runs in Thumb mode. Modified to use explicit mode variable for keeping track of our operating mode (normal vs. debug). --- Debugger/debug_comm.S | 4 +--- Debugger/debug_macros.h | 27 ++++++++++++++++++++++++--- Debugger/debug_stub.S | 41 +++++++++++++++++++++++++---------------- 3 files changed, 50 insertions(+), 22 deletions(-) diff --git a/Debugger/debug_comm.S b/Debugger/debug_comm.S index efe44a9..6a7aa11 100644 --- a/Debugger/debug_comm.S +++ b/Debugger/debug_comm.S @@ -408,8 +408,7 @@ _dbg__usb_readbuf_reset: * R1: USB Command Bit * R2: USB Raw Message Length * On Exit: - * R0: CPSR - * R1-R3: Destroyed + * R0-R3: Destroyed */ dbg__copyNxtDebugMsg: @@ -417,7 +416,6 @@ dbg__copyNxtDebugMsg: str r2, [r1] ldr r1, =debug_InUSBBuf _dbg_memcpy r1, r0, r2, r3 /* r3: scratch register */ - mrs r0, cpsr bx lr #endif diff --git a/Debugger/debug_macros.h b/Debugger/debug_macros.h index dc1efba..5af75fd 100644 --- a/Debugger/debug_macros.h +++ b/Debugger/debug_macros.h @@ -251,7 +251,7 @@ */ .macro _dbg_getstate reg ldr \reg, =debug_state - ldr \reg, [\reg] + ldrb \reg, [\reg] .endm /* _dbg_setstate @@ -260,9 +260,30 @@ * r0, r1: destroyed */ .macro _dbg_setstate state - ldr r0, =\state + mov r0, #\state ldr r1, =debug_state - str r0, [r1] + strb r0, [r1] + .endm + +/* _dbg_getmode + * Get Debugger Mode + * On exit: + * reg: Debugger Mode (Boolean) + */ + .macro _dbg_getmode reg + ldr \reg, =debug_mode + ldrb \reg, [\reg] + .endm + +/* _dbg_setmode + * Set Debugger Mode to given value + * On exit: + * r0, r1: destroyed + */ + .macro _dbg_setmode mode + mov r0, #\mode + ldr r1, =debug_mode + strb r0, [r1] .endm /* _dbg_getcurrbkpt_index diff --git a/Debugger/debug_stub.S b/Debugger/debug_stub.S index ec6b149..f8e58ec 100644 --- a/Debugger/debug_stub.S +++ b/Debugger/debug_stub.S @@ -160,8 +160,6 @@ .bss .align 4 -debug_state: - .word 0x0 debug_curr_breakpoint: .word 0x0 debug_InMsgBuf: @@ -169,6 +167,11 @@ debug_InMsgBuf: debug_OutMsgBuf: .space MSGBUF_SIZE,0 +debug_state: + .byte 0x0 +debug_mode: + .byte 0x0 /* Boolean variable */ + .data .align 4 debug_ValidResponsePrefix: @@ -394,26 +397,29 @@ debug_armComplexCCTable: * * UWORD cCommHandleDebug(UBYTE *pInBuf, UBYTE CmdBit, UWORD MsgLength); * - * On Entry, we're in SVC mode. We need to setup the USB Buffers, and switch mode to + * This routine is called from cCommInterprete either in normal operation mode (SVC) + * or else when we're in debug mode (ABORT) which uses the cCommCtrl() routine to handle + * I/O with the Host. + * + * On entry, the message is copied from the NXT buffer into our own buffers. + * + * If this is accessed from normal operation mode, we need to switch mode to * ABORT mode to handle the incoming message using a Manual Breakpoint instruction. * When DEBUG is exited, the execution resumes from the instruction following the Breakpoint. */ cCommHandleDebug: - push {r0-r3} /* store all argX registers */ +/* Arg Registers are not preserved since this is invoked explicitly */ + /* push {r1-r3} */ /* store arg registers */ bl dbg__copyNxtDebugMsg /* setup Debugger Message Buffers, validate input, CPSR returned in R0 */ - mov r1, #CPSR_MODE /* Thumb mode can't handle immediate Operands for AND */ - and r0, r1 /* Check Current Mode */ - cmp r0, #MODE_ABT /* Debug Mode Check (Flags set) */ + /* pop {r1-r3} */ /* restore values */ + _dbg_getmode r0 /* Get Debug Mode */ + cmp r0, #TRUE - /* If we're in ABT (Abort) mode, this means that we're already running the Debugger */ - beq _in_debug + /* If Debug Mode is TRUE, this means that we're already running the Debugger */ + beq _cCommHandleDebug_cont /* Else, we're in normal operation mode (SVC), or other mode (??!) and need to force a switch to Debug mode */ - pop {r0-r3} /* restore all values */ dbg__bkpt_thumb - b _cont_cCommHandleDebug -_in_debug: - pop {r0-r3} /* restore all values */ -_cont_cCommHandleDebug: +_cCommHandleDebug_cont: mov r0, #0 /* FIXME: Return Status */ bx lr #endif @@ -443,6 +449,7 @@ dbg__bkpt_init: /* FIXME: Initialize other stuff here */ _dbg_setstate DBG_INIT + _dbg_setmode FALSE /* Debug Mode = False */ pop {lr} bx lr /* Must return via BX; may have been called from Thumb mode (NXT Firmware) */ @@ -545,6 +552,8 @@ dbg__bkpt_offset_outofrange: * ****************************************************************************/ dbg__bkpt_waitCMD: + _dbg_setmode TRUE /* Debug Mode = True */ +dbg__bkpt_waitCMD_cont: 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 */ @@ -567,14 +576,14 @@ _dbg__cmdExists: mov r3, r0 /* put Command Handler Index in R3 */ mov r0, r4 /* R0 now contains Input Message Buffer Parameter Pointer (previously in R4) */ _dbg_jumpTableHandler debug_cmdJumpTable, r2, r3 /* Call Command Handler Routine, use R2 as jump address pointer */ - b dbg__bkpt_waitCMD + b dbg__bkpt_waitCMD_cont _dbg__cmdError: _dbg_outputMsgStatusErr bl dbg__putDebugMsg /* Send error response to the GDB server */ _dbg__housekeeping: bl dbg__runloopTasks /* Execute platform run loop tasks while in ABRT mode */ - b dbg__bkpt_waitCMD + b dbg__bkpt_waitCMD_cont /* _dbg__cmdChar2Index -- cgit v1.2.3 From fba2c1e6e702392c6dfb789b49f76c21675fce92 Mon Sep 17 00:00:00 2001 From: Tat-Chee Wan (USM) Date: Sat, 19 Mar 2011 08:59:32 +0800 Subject: added r1 read command --- Host/gdb-commands.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Host/gdb-commands.txt b/Host/gdb-commands.txt index ef412d1..37b84d5 100644 --- a/Host/gdb-commands.txt +++ b/Host/gdb-commands.txt @@ -6,6 +6,9 @@ $g#67 # Display R0 $p0#A0 +# Display R1 +$p1#A1 + # Display PC $pF#B6 -- cgit v1.2.3 From 1fa36d1d6cbbf8e469618462f2078d27684e9669 Mon Sep 17 00:00:00 2001 From: Tat-Chee Wan (USM) Date: Sat, 19 Mar 2011 09:01:24 +0800 Subject: added read memory command WIP. Added prelim read memory command --- Debugger/debug_stub.S | 52 ++++++++++++++++++++++++++++++++++++++++++++++++--- Debugger/debug_stub.h | 12 +++++++++--- 2 files changed, 58 insertions(+), 6 deletions(-) diff --git a/Debugger/debug_stub.S b/Debugger/debug_stub.S index f8e58ec..8bc4f96 100644 --- a/Debugger/debug_stub.S +++ b/Debugger/debug_stub.S @@ -122,6 +122,8 @@ * Additional commands from GDB Reference Appendix D.2 */ +/* FIXME: Format for Write bytes 'M' is incomplete */ + #define __ASSEMBLY__ #include "debug_stub.h" #include "debug_macros.h" @@ -200,8 +202,8 @@ debug_cmdJumpTable: .word _dbg__cmd_SetAllRegs /* 'G' */ .word _dbg__cmd_GetOneReg /* 'p' */ .word _dbg__cmd_SetOneReg /* 'P' */ - .word _dbg__nop /* 'm' */ - .word _dbg__nop /* 'M' */ + .word _dbg__cmd_ReadMem /* 'm' */ + .word _dbg__cmd_WriteMem /* 'M' */ .word _dbg__nop /* 'c' */ .word _dbg__nop /* 's' */ .word _dbg__nop /* 'k' */ @@ -648,6 +650,16 @@ __dbg__procCmdParamError: ldmfd sp!, {pc} +/* __dbg__procCmdReturnLengthError + * Common subroutine exit stub to handle Command Return Length Error for Command Handlers + * DO NOT CALL THIS STUB DIRECTLY! It Assumes that the return address is in the stack. + * + */ +__dbg__procCmdReturnLengthError: + _dbg_outputMsgStatusErrCode MSG_ERRLENGTH + bl dbg__putDebugMsg /* Send error response to the GDB server */ + ldmfd sp!, {pc} + /* __dbg__procBreakpointAddrError * Common subroutine exit stub to handle Breakpoint Address Error for Breakpoint Insert/Remove Handlers * DO NOT CALL THIS STUB DIRECTLY! It Assumes that the return address is in the stack. @@ -725,7 +737,7 @@ _dbg__cmd_GetAllRegs: teq r1, #CMD_REG_GETALL_PARAMLEN /* Check for correct length */ bne __dbg__procCmdParamError /* Unexpected input, report error */ - _dbg_outputMsgValidResponse /* Setup R1 with address of output message buffer data pointer (after response prefix) */ + _dbg_outputMsgValidResponse /* R0: address of output message buffer data pointer (after response prefix) */ mov r3, #DBGSTACK_USERCPSR_OFFSET /* Output User CPSR Value first */ 1: mov r1, r3 bl _dbg_outputOneRegValue /* update output buffer */ @@ -811,6 +823,40 @@ _dbg__nop: bl dbg__putDebugMsg /* Send error response to the GDB server */ ldmfd sp!, {pc} +/* _dbg__cmd_ReadMem + * Read Memory Contents Command Handler + * Output Buffer returns memory contents + * On entry: + * r0: parameter buffer pointer (contents after '$' and '') + * AA..AA,LLLL + * On exit: + * r0, r1, r2, r3, r4: destroyed + */ +_dbg__cmd_ReadMem: + stmfd sp!, {lr} + bl __dbg__cmdParamLen + teq r1, #CMD_MEM_READ_PARAMLEN /* Check for correct length */ + bne __dbg__procCmdParamError /* Unexpected input, report error */ + bl ascii2word /* convert ASCII address location to Hex (in R0), R1 has address of next buffer char */ + mov r3, r0 /* Keep Address location in R3 */ + _check_msgseparator r1 + bne __dbg__procCmdParamError /* Can't find ',' */ + mov r0, r1 /* move buffer pointer to R0 for subsequent processing */ + bl ascii2halfword /* convert ASCII length to Hex (in R0), R1 has address of next buffer char */ + cmp r0, #CMD_MEM_MAXNUMBYTES + bhi __dbg__procCmdReturnLengthError /* Requested Length greater than buffer size, return error */ + mov r4, r0 /* Keep numbytes in R4 */ + /* FIXME: Should validate the address? */ + + _dbg_outputMsgValidResponse /* R0: address of output message buffer data pointer (after response prefix) */ +1: ldrb r1, [r3], #1 + bl byte2ascii /* update output buffer */ + subs r4, r4, #1 + bne 1b + + _asciiz r0, r1 + bl dbg__putDebugMsg /* Send response to the GDB server */ + ldmfd sp!, {pc} /* _dbg__proc_brkpt_params diff --git a/Debugger/debug_stub.h b/Debugger/debug_stub.h index 63e3c26..dce47fc 100644 --- a/Debugger/debug_stub.h +++ b/Debugger/debug_stub.h @@ -46,10 +46,11 @@ #define USB_GDBMSG_START 3 /* Offset into USB Telegram buffer */ -#define MSG_NUMSEGMENTS 3 /* For packet transfers */ +#define MSG_NUMSEGMENTS 3 /* For packet transfers */ #define MSG_SEGMENTSIZE (USB_BUFSIZE - USB_GDBMSG_START) /* 61 bytes per segment */ #define MSGBUF_SIZE (MSG_SEGMENTSIZE*MSG_NUMSEGMENTS) /* Debug Message Buffer Size, 61 x 3 = 183 chars = ~80 bytes of actual data */ #define MSGBUF_CHKSUMOFFSET 3 /* to be subtracted from message length */ +#define MSGBUF_OVERHEADLEN 6 /* For calculating max message data length (include ASCIIZ char) */ #define MSGBUF_CTRLC 0x03 /* For Out of Band Signaling: not implemented yet */ #define MSGBUF_STARTCHAR '$' @@ -84,8 +85,12 @@ #define CMD_REG_REGPARAMLEN 8 /* 32-bit ASCII Hex Value */ #define CMD_REG_SETONE_PARAMLEN (2 + CMD_REG_REGPARAMLEN) #define CMD_REG_SETALL_PARAMLEN (CMD_REG_NUMREGS*CMD_REG_REGPARAMLEN) - - +#define CMD_NUMITEMS_PARAMLEN 4 /* 16-bit ASCII Hex Value */ +#define CMD_MEM_READ_PARAMLEN (CMD_REG_REGPARAMLEN + CMD_NUMITEMS_PARAMLEN + 1) /* Address length is equivalent to reg param len */ +#define CMD_MEM_WRITE_PARAMLEN (CMD_REG_REGPARAMLEN + CMD_NUMITEMS_PARAMLEN + 1) /* Address length is equivalent to reg param len */ +#define CMD_MEM_SEPCHAR_OFFSET CMD_REG_REGPARAMLEN /* Address length is equivalent to reg param len */ +#define CMD_MEM_MAXBUFLEN (MSGBUF_SIZE - MSGBUF_OVERHEADLEN) +#define CMD_MEM_MAXNUMBYTES (CMD_MEM_MAXBUFLEN/2) /*@}*/ /** @name Debug Breakpoint Command Constants. @@ -214,6 +219,7 @@ ENUM_BEGIN ENUM_VALASSIGN(MSG_ERRIMPL, 0) /**< Stub (not implemented) Error. */ ENUM_VAL(MSG_ERRCHKSUM) /**< Checksum Error. */ ENUM_VAL(MSG_ERRFORMAT) /**< Message Format Error. */ +ENUM_VAL(MSG_ERRLENGTH) /**< Message Output Length Error. */ ENUM_VAL(MSG_UNKNOWNCMD) /**< Unrecognized Command Error. */ ENUM_VAL(MSG_UNKNOWNPARAM) /**< Unrecognized Parameter Error. */ ENUM_VAL(MSG_UNKNOWNBRKPT) /**< Unrecognized Breakpoint Error. */ -- cgit v1.2.3 From 89b4bf567db9eeda1b9b4e5e7e3049ee8f62c988 Mon Sep 17 00:00:00 2001 From: Tat-Chee Wan (USM) Date: Sat, 19 Mar 2011 14:40:17 +0800 Subject: implemented memory write command, renumbered error messages Preliminary Memory Write command implementation. Error Message Enum renumbered based on ecos error message values (not validated). --- Debugger/debug_stub.S | 88 ++++++++++++++++++++++++++++++++++++++++++--------- Debugger/debug_stub.h | 16 +++++++--- 2 files changed, 84 insertions(+), 20 deletions(-) diff --git a/Debugger/debug_stub.S b/Debugger/debug_stub.S index 8bc4f96..ba6bf28 100644 --- a/Debugger/debug_stub.S +++ b/Debugger/debug_stub.S @@ -75,7 +75,8 @@ * x = ['0','F'] for R0-R15, '!' for User CPSR * * mAA..AA,LLLL Read LLLL bytes at address AA..AA hex data or ENN - * MAA..AA,LLLL: Write LLLL bytes at address AA.AA OK or ENN + * MAA..AA,LLLL:bb..bb + * Write LLLL bytes at address AA.AA OK or ENN * * c Resume at current address SNN ( signal NN) * cAA..AA Continue at address AA..AA SNN @@ -122,8 +123,6 @@ * Additional commands from GDB Reference Appendix D.2 */ -/* FIXME: Format for Write bytes 'M' is incomplete */ - #define __ASSEMBLY__ #include "debug_stub.h" #include "debug_macros.h" @@ -145,6 +144,21 @@ cmp r0, #MSGBUF_SEPCHAR .endm +/* _check_msgargument + * Look for argument ':' + * On entry: + * bufferptr: points to the parameter buffer [can't be R0] + * On exit: + * R0: destroyed + * bufferptr: points to the next character location in the parameter buffer + * Flags: Updated + */ + + .macro _check_msgargument bufferptr + ldrb r0, [\bufferptr], #1 /* get separator */ + cmp r0, #MSGBUF_ARGCHAR + .endm + /* _check_msgassignment * Look for assignment '=' * On entry: @@ -636,8 +650,7 @@ __dbg__cmdParamLen: */ __dbg__procCmdOk: _dbg_outputMsgStatusOk - bl dbg__putDebugMsg /* Send error response to the GDB server */ - ldmfd sp!, {pc} + b __dbg__sendDebugMsgExit /* __dbg__procCmdParamError * Common subroutine exit stub to handle Command Parameter Error for Command Handlers @@ -646,19 +659,26 @@ __dbg__procCmdOk: */ __dbg__procCmdParamError: _dbg_outputMsgStatusErrCode MSG_UNKNOWNPARAM - bl dbg__putDebugMsg /* Send error response to the GDB server */ - ldmfd sp!, {pc} + b __dbg__sendDebugMsgExit -/* __dbg__procCmdReturnLengthError - * Common subroutine exit stub to handle Command Return Length Error for Command Handlers +/* __dbg__procCmdReturnInputLengthError + * Common subroutine exit stub to handle Command Input Length Error for Command Handlers * DO NOT CALL THIS STUB DIRECTLY! It Assumes that the return address is in the stack. * */ -__dbg__procCmdReturnLengthError: - _dbg_outputMsgStatusErrCode MSG_ERRLENGTH - bl dbg__putDebugMsg /* Send error response to the GDB server */ - ldmfd sp!, {pc} +__dbg__procCmdReturnInputLengthError: + _dbg_outputMsgStatusErrCode MSG_ERRINLENGTH + b __dbg__sendDebugMsgExit + +/* __dbg__procCmdReturnOutputLengthError + * Common subroutine exit stub to handle Command Return Output Error for Command Handlers + * DO NOT CALL THIS STUB DIRECTLY! It Assumes that the return address is in the stack. + * + */ +__dbg__procCmdReturnOutputLengthError: + _dbg_outputMsgStatusErrCode MSG_ERROUTLENGTH + b __dbg__sendDebugMsgExit /* __dbg__procBreakpointAddrError * Common subroutine exit stub to handle Breakpoint Address Error for Breakpoint Insert/Remove Handlers @@ -667,6 +687,8 @@ __dbg__procCmdReturnLengthError: */ __dbg__procBreakpointAddrError: _dbg_outputMsgStatusErrCode MSG_UNKNOWNBRKPT + +__dbg__sendDebugMsgExit: bl dbg__putDebugMsg /* Send error response to the GDB server */ ldmfd sp!, {pc} @@ -843,8 +865,8 @@ _dbg__cmd_ReadMem: bne __dbg__procCmdParamError /* Can't find ',' */ mov r0, r1 /* move buffer pointer to R0 for subsequent processing */ bl ascii2halfword /* convert ASCII length to Hex (in R0), R1 has address of next buffer char */ - cmp r0, #CMD_MEM_MAXNUMBYTES - bhi __dbg__procCmdReturnLengthError /* Requested Length greater than buffer size, return error */ + cmp r0, #CMD_MEM_MAXREADBYTES /* Don't overflow our buffer (2 x CMD_MEM_MAXREADBYTES) */ + bhi __dbg__procCmdReturnOutLengthError /* Requested Length greater than buffer size, return error */ mov r4, r0 /* Keep numbytes in R4 */ /* FIXME: Should validate the address? */ @@ -859,6 +881,42 @@ _dbg__cmd_ReadMem: ldmfd sp!, {pc} +/* _dbg__cmd_WriteMem + * Write Memory Contents Command Handler + * On entry: + * r0: parameter buffer pointer (contents after '$' and '') + * AA..AA,LLLL::bb..bb + * On exit: + * r0, r1, r2, r3, r4: destroyed + */ +_dbg__cmd_WriteMem: + stmfd sp!, {lr} + bl __dbg__cmdParamLen + cmp r1, #CMD_MEM_WRITE_MINPARAMLEN /* Check for correct (minimum) length */ + blo __dbg__procCmdParamError /* Unexpected input, report error */ + sub r4, r1, #CMD_MEM_WRITE_MINPARAMLEN /* R4: Number of ASCII Hex chars for byte writes */ + bl ascii2word /* convert ASCII address location to Hex (in R0), R1 has address of next buffer char */ + mov r3, r0 /* Keep Address location in R3 */ + _check_msgseparator r1 + bne __dbg__procCmdParamError /* Can't find ',' */ + mov r0, r1 /* move buffer pointer to R0 for subsequent processing */ + bl ascii2halfword /* convert ASCII length to Hex (in R0), R1 has address of next buffer char */ + cmp r0, r4, asr #1 /* is Number of bytes to write == (number of ASCII Hex Chars / 2)? */ + bne __dbg__procCmdParamError /* Number of bytes does not match argument length */ + cmp r0, #CMD_MEM_MAXWRITEBYTES /* Don't overflow our buffer (2 x CMD_MEM_MAXWRITEBYTES) */ + bhi __dbg__procCmdReturnInLengthError /* Requested Length greater than buffer size, return error */ + moveq r4, r0 /* Keep numbytes in R4 */ + /* FIXME: Should validate the address? */ + _check_msgargument r1 + bne __dbg__procCmdParamError /* Can't find ':' */ + +1: mov r0, r1 + bl ascii2byte /* convert ASCII Hex value into byte value */ + strb r0, [r3], #1 /* Store into memory location */ + subs r4, r4, #1 + bne 1b + b __dbg__procCmdOk + /* _dbg__proc_brkpt_params * Process Breakpoint Parameters * On entry: diff --git a/Debugger/debug_stub.h b/Debugger/debug_stub.h index dce47fc..09750be 100644 --- a/Debugger/debug_stub.h +++ b/Debugger/debug_stub.h @@ -50,7 +50,8 @@ #define MSG_SEGMENTSIZE (USB_BUFSIZE - USB_GDBMSG_START) /* 61 bytes per segment */ #define MSGBUF_SIZE (MSG_SEGMENTSIZE*MSG_NUMSEGMENTS) /* Debug Message Buffer Size, 61 x 3 = 183 chars = ~80 bytes of actual data */ #define MSGBUF_CHKSUMOFFSET 3 /* to be subtracted from message length */ -#define MSGBUF_OVERHEADLEN 6 /* For calculating max message data length (include ASCIIZ char) */ +#define MSGBUF_IN_OVERHEADLEN 5 /* For calculating max message data length (include ASCIIZ char) */ +#define MSGBUF_OUT_OVERHEADLEN 6 /* For calculating max message data length (include ASCIIZ char) */ #define MSGBUF_CTRLC 0x03 /* For Out of Band Signaling: not implemented yet */ #define MSGBUF_STARTCHAR '$' @@ -62,6 +63,7 @@ #define MSGBUF_SETCHAR '=' #define MSGBUF_CHKSUMCHAR '#' #define MSGBUF_SEPCHAR ',' +#define MSGBUF_ARGCHAR ':' #define MSGBUF_MSGERROR -1 /*@}*/ @@ -87,10 +89,12 @@ #define CMD_REG_SETALL_PARAMLEN (CMD_REG_NUMREGS*CMD_REG_REGPARAMLEN) #define CMD_NUMITEMS_PARAMLEN 4 /* 16-bit ASCII Hex Value */ #define CMD_MEM_READ_PARAMLEN (CMD_REG_REGPARAMLEN + CMD_NUMITEMS_PARAMLEN + 1) /* Address length is equivalent to reg param len */ -#define CMD_MEM_WRITE_PARAMLEN (CMD_REG_REGPARAMLEN + CMD_NUMITEMS_PARAMLEN + 1) /* Address length is equivalent to reg param len */ +#define CMD_MEM_WRITE_MINPARAMLEN (CMD_REG_REGPARAMLEN + CMD_NUMITEMS_PARAMLEN + 2) /* Address length is equivalent to reg param len */ #define CMD_MEM_SEPCHAR_OFFSET CMD_REG_REGPARAMLEN /* Address length is equivalent to reg param len */ -#define CMD_MEM_MAXBUFLEN (MSGBUF_SIZE - MSGBUF_OVERHEADLEN) -#define CMD_MEM_MAXNUMBYTES (CMD_MEM_MAXBUFLEN/2) +#define CMD_MEM_MAXOUTBUFLEN (MSGBUF_SIZE - MSGBUF_OUT_OVERHEADLEN) +#define CMD_MEM_MAXREADBYTES (CMD_MEM_MAXOUTBUFLEN/2) +#define CMD_MEM_MAXINBUFLEN (MSGBUF_SIZE - MSGBUF_IN_OVERHEADLEN) +#define CMD_MEM_MAXWRITEBYTES ((CMD_MEM_MAXINBUFLEN - CMD_MEM_WRITE_MINPARAMLEN)/2) /*@}*/ /** @name Debug Breakpoint Command Constants. @@ -215,11 +219,13 @@ ENUM_END(dbg_state_t) * Debugger Error Message Enums. * The enums must be consecutive, starting from 1 */ +/* FIXME: Need to validate against the ecos-generic-stub.c Error enums */ ENUM_BEGIN ENUM_VALASSIGN(MSG_ERRIMPL, 0) /**< Stub (not implemented) Error. */ +ENUM_VAL(MSG_ERRINLENGTH) /**< Message Write Length Error. */ ENUM_VAL(MSG_ERRCHKSUM) /**< Checksum Error. */ +ENUM_VAL(MSG_ERROUTLENGTH) /**< Message Read Length Error. */ ENUM_VAL(MSG_ERRFORMAT) /**< Message Format Error. */ -ENUM_VAL(MSG_ERRLENGTH) /**< Message Output Length Error. */ ENUM_VAL(MSG_UNKNOWNCMD) /**< Unrecognized Command Error. */ ENUM_VAL(MSG_UNKNOWNPARAM) /**< Unrecognized Parameter Error. */ ENUM_VAL(MSG_UNKNOWNBRKPT) /**< Unrecognized Breakpoint Error. */ -- cgit v1.2.3