summaryrefslogtreecommitdiff
path: root/Debugger/debug_stub.S
diff options
context:
space:
mode:
authorTC Wan2010-12-02 10:23:37 +0800
committerTC Wan2010-12-02 10:23:37 +0800
commit825dba78c19d206f765a61506851a3cebf4cffb8 (patch)
treec324f868f387e688414179b6d39a06d88a4d4c51 /Debugger/debug_stub.S
parente222748d4f2241b2b357c1dc6b1b734ebdde6525 (diff)
changed the license clause, misc cleanups
The armdebug project is now dual licensed to make it easier to integrate with the LEGO NXT firmware. You can choose either to use the GPLv2 or the LEGO Open Source License to integrate this into other projects. Misc cleanups: Removed types.h Moved Debugger Macros into its own file to improve readability. Added COPYING, LEGO license and GPL license texts.
Diffstat (limited to 'Debugger/debug_stub.S')
-rw-r--r--Debugger/debug_stub.S199
1 files changed, 8 insertions, 191 deletions
diff --git a/Debugger/debug_stub.S b/Debugger/debug_stub.S
index 030ce40..ec6432e 100644
--- a/Debugger/debug_stub.S
+++ b/Debugger/debug_stub.S
@@ -1,3 +1,7 @@
+/** @file debug_stub.S
+ * @brief ARM Breakpoint Debugger support routines
+ *
+ */
/* Copyright (C) 2007-2010 the NxOS developers
*
@@ -5,8 +9,8 @@
*
* See AUTHORS for a full list of the developers.
*
- * Redistribution of this file is permitted under
- * the terms of the GNU Public License (GPL) version 2.
+ * See COPYING for redistribution license
+ *
*/
/* GDB sparc-stub.c comments header included below to document GDB Server Remote protocol */
@@ -108,6 +112,7 @@
#define __ASSEMBLY__
#include "debug_stub.h"
+#include "debug_macros.h"
.bss
.align 4
@@ -183,194 +188,6 @@ debug_cmdJumpTable:
.extern dbg__getDebugMsg /* Read a message from the communications link */
.extern dbg__putDebugMsg /* Write a message to the communications link */
-/* _dbg_jumpTableHandler
- * Call Jump Table Routine based on Index
- * On entry:
- * jumptableaddr is the address (constant) of the Jump Table
- * jumpreg is the register used to perform the indirect jump
- * indexreg contains jump table index value
- */
- .macro _dbg_jumpTableHandler jumptableaddr, jumpreg, indexreg
-
- ldr \jumpreg, =\jumptableaddr
- ldr \jumpreg, [\jumpreg, \indexreg, lsl #2]
- mov lr, pc
- bx \jumpreg /* Call Command Handler Routine */
- .endm
-
-
-/* _dbg_stpcpy
- * _dbg_stpcpy macro
- * On entry:
- * deststrptr: Destination string [Cannot be R0]
- * sourcestrptr: Source string [Cannot be R0]
- * On exit:
- * deststrptr: Pointer to NULL character in destination string
- * R0: destroyed
- */
- .macro _dbg_stpcpy deststrptr, sourcestrptr
-1: ldrb r0, [\sourcestrptr], #1
- strb r0, [\deststrptr], #1
- teq r0, #0
- bne 1b
- sub \deststrptr, \deststrptr, #1 /* Adjust Destination string pointer to point at NULL character */
- .endm
-
-/* _dbg_outputMsgValidResponse
- * Return Message with valid response ('+$')
- * On exit:
- * R0: destroyed
- * R1: points to NULL character after the prefix
- * R2: destroyed
- */
- .macro _dbg_outputMsgValidResponse
- ldr r1, =debug_OutMsgBuf
- ldr r2, =debug_ValidResponsePrefix
- _dbg_stpcpy r1, r2
- .endm
-
-
-/* _dbg_outputMsgStatusOk
- * Return Message with Ok ('+OK') status
- * On exit:
- * R0: destroyed
- * R1: destroyed
- * R2: destroyed
- */
- .macro _dbg_outputMsgStatusOk
- ldr r1, =debug_OutMsgBuf
- ldr r2, =debug_OkResponse
- _dbg_stpcpy r1, r2
- .endm
-
-/* _dbg_outputMsgStatusErr
- * Return Message with Error ('-ENN') status
- * On entry:
- * R0: register containing error value (byte)
- * On exit:
- * R0: destroyed
- * R1: destroyed
- * R2: destroyed
- * R3: destroyed
- */
- .macro _dbg_outputMsgStatusErr
- mov r3, r0
- ldr r1, =debug_OutMsgBuf
- ldr r2, =debug_ErrorResponsePrefix
- _dbg_stpcpy r1, r2
- mov r0, r3
- bl byte2ascii /* R1 points to NULL character after the prefix */
- .endm
-
-/* _dbg_outputMsgStatusSig
- * Return Message with Signal ('+SNN') status
- * On entry:
- * R0: register containing error value (byte)
- * On exit:
- * R0: destroyed
- * R1: destroyed
- * R2: destroyed
- * R3: destroyed
- */
- .macro _dbg_outputMsgStatusSig
- mov r3, r0
- ldr r1, =debug_OutMsgBuf
- ldr r2, =debug_SignalResponsePrefix
- _dbg_stpcpy r1, r2
- mov r0, r3
- bl byte2ascii /* R1 points to NULL character after the prefix */
- .endm
-
-/* _index2dbgstackaddr
- * Convert debugger stack index to Debugger Stack register address
- *
- * On entry:
- * indexreg contains debugger stack index value (0-max entries)
- * On exit:
- * indexreg: Breakpoint index (preserved)
- * addrreg: Debugger Stack Register Address
- */
- .macro _index2dbgstackaddr indexreg, addrreg
- ldr \addrreg, =__debugger_stack_bottom__
- add \addrreg, \addrreg, \indexreg, lsl #2 /* Calculate Debugger Stack Register Address */
- .endm
-
-/* _index2bkptindex_addr
- * Convert Breakpoint index to breakpoing entry address
- *
- * On entry:
- * indexreg contains breakpoint index value
- * On exit:
- * indexreg: Breakpoint index (preserved)
- * addrreg: Breakpoint Entry Address
- */
- .macro _index2bkptindex_addr indexreg, addrreg
- ldr \addrreg, =__breakpoints_start__
- add \addrreg, \addrreg, \indexreg, lsl #3 /* Calculate Breakpoint Entry Address */
- .endm
-
-/* _dbg_getstate
- * Get Debugger State
- * On exit:
- * reg: Debugger State enum
- */
- .macro _dbg_getstate reg
- ldr \reg, =debug_state
- ldr \reg, [\reg]
- .endm
-
-/* _dbg_setstate
- * Set Debugger State to given value
- * On exit:
- * r0, r1: destroyed
- */
- .macro _dbg_setstate state
- ldr r0, =\state
- ldr r1, =debug_state
- str r0, [r1]
- .endm
-
-/* _dbg_getcurrbkpt_index
- * Get current breakpoint index
- * On exit:
- * reg: Breakpoint index
- */
- .macro _dbg_getcurrbkpt_index reg
- ldr \reg, =debug_curr_breakpoint
- ldr \reg, [\reg]
- .endm
-
-/* _dbg_setcurrbkpt_index
- * Set current breakpoint index
- * On exit:
- * r1: destroyed
- */
- .macro _dbg_setcurrbkpt_index reg
- ldr r1, =debug_curr_breakpoint
- str \reg, [r1]
- .endm
-
-/* _dbg_getabortedinstr_addr
- * Get aborted instruction address
- * On exit:
- * reg: aborted instruction address
- */
- .macro _dbg_getabortedinstr_addr reg
- ldr \reg, =__debugger_stack_bottom__
- ldr \reg, [\reg]
- .endm
-
-/* _dbg_setabortedinstr_addr
- * Set aborted instruction address
- * On exit:
- * r1: destroyed
- */
- .macro _dbg_setabortedinstr_addr reg
- ldr r1, =__debugger_stack_bottom__
- str \reg, [r1]
- .endm
-
-
/* The Debugger Interface can handle a total of (n-1) Breakpoint States and 1 Single Stepping State,
* where n is a power of 2. The value of n is given by __breakpoints_num__ defined in the linker file.
@@ -1273,7 +1090,7 @@ _dbg_next_instruction_addr:
beq _next_instr_is_arm
_next_instr_is_thumb:
add r5, r2, #2 /* set next Thumb instruction address */
- _is_thumb_branch_instr r0 /* check if the current instruction is a branch instruction */
+ /*_is_thumb_branch_instr r0 */ /* check if the current instruction is a branch instruction */
_next_instr_is_arm:
add r5, r2, #4 /* Is ARM, set next ARM instruction address */
@@@@@@@@@