aboutsummaryrefslogtreecommitdiff
path: root/AT91SAM7S256/armdebug/Debugger
diff options
context:
space:
mode:
authorTC Wan2010-12-02 17:49:40 +0800
committerTC Wan2010-12-02 17:49:40 +0800
commitdb39d3ab16c967fede452c6eda6f023ae53a1654 (patch)
tree2b2a999792d0d4e97b2e55167bb5a95eedf431aa /AT91SAM7S256/armdebug/Debugger
parent6434b7466f3ba860396b9b14bb47320c19d04473 (diff)
parentbc6e53a15ec74e9f1c9e54227a21064cb8565954 (diff)
Merge branch 'master' of ssh://svc.cs.usm.my/~/gitrepo-bare/armdebug
Diffstat (limited to 'AT91SAM7S256/armdebug/Debugger')
-rw-r--r--AT91SAM7S256/armdebug/Debugger/_c_arm_macros.h97
-rw-r--r--AT91SAM7S256/armdebug/Debugger/debug_comm.S8
-rw-r--r--AT91SAM7S256/armdebug/Debugger/debug_macros.h252
-rw-r--r--AT91SAM7S256/armdebug/Debugger/debug_stub.S239
-rw-r--r--AT91SAM7S256/armdebug/Debugger/debug_stub.h7
-rw-r--r--AT91SAM7S256/armdebug/Debugger/types.h46
-rw-r--r--AT91SAM7S256/armdebug/Debugger/undef_handler.S3
7 files changed, 320 insertions, 332 deletions
diff --git a/AT91SAM7S256/armdebug/Debugger/_c_arm_macros.h b/AT91SAM7S256/armdebug/Debugger/_c_arm_macros.h
index f356a25..025542e 100644
--- a/AT91SAM7S256/armdebug/Debugger/_c_arm_macros.h
+++ b/AT91SAM7S256/armdebug/Debugger/_c_arm_macros.h
@@ -3,21 +3,25 @@
*
*/
-/* Copyright (C) 2007,2009 the NxOS developers
+/* Copyright (C) 2010 the NxOS developers
+ *
+ * Module Developed by: TC Wan <tcwan@cs.usm.my>
+ *
* Thanks to Bartli (forum post @ embdev.net ARM programming with GCC/GNU tools forum)
*
* 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
+ *
*/
-#ifndef __NXOS_BASE_C_ARM_MACROS__
-#define __NXOS_BASE_C_ARM_MACROS__
+#ifndef __C_ARM_MACROS__
+#define __C_ARM_MACROS__
+
#ifdef __ASSEMBLY__
-#define NULL 0x0 /* Stick the definition here instead of making types.h messy */
+#define NULL 0x0
#define FALSE 0
#define TRUE ~FALSE
@@ -38,71 +42,7 @@
enum_val name
#define ENUM_END(enum_name)
-/** Macro to define driver ioctl table
- * First five table entries are predefined
- * 0: init
- * 1: shutdown
- * 2: sleep
- * 3: wakeup
- * 4: poll
- *
- */
-#define DRIVER_IOCTL(driver) \
-/* Dummy sleep and wakeup routines for now */ ;\
- .set driver ## _sleep, NULL ;\
- .set driver ## _wakeup, NULL ;\
- .set driver ## _poll, NULL ;\
-.data ;\
- .align 4 ;\
- .global driver ## _ioctl ;\
-driver ## _ioctl: ;\
- .word driver ## _init ;\
- .word driver ## _shutdown ;\
- .word driver ## _sleep ;\
- .word driver ## _wakeup ;\
- .word driver ## _poll ;\
- .set num_ ## driver ## _cmds, 5
-
-/** Macro to define additional driver ioctl commands
- * Be careful to follow the sequence defined for the CMD enums
- * The first CMD should have an enum value of 5
- *
- */
-#define DRIVER_CMD(driver, cmd) \
- .word driver ## _ ## cmd ;\
- .set num_ ## driver ## _cmds, num_ ## driver ## _cmds + 1
-
-/** Macro to define driver state
- * MUST BE DEFINED AFTER DRIVER_IOCTL section
- * @param driver name of driver
- * @param driverenum enum value of driver (in [31:25])
- *
- * The number of commands for driver (in [24:17]) -- derived from num_driver_cmds
- *
- * Format of driver_state table:
- * driver signature (driverenum << 24 | numcommands << 16)
- * driver parameters (per device instance)
- */
-#define DRIVER_STATE(driver, driverenum) \
-.bss ;\
- .global driver ## _state ;\
-driver ## _state: ;\
- .set driver ## _signature, (driverenum << 24) | (num_ ## driver ## _cmds << 16) ;\
- .word NULL /* driver_signature */
-
-
-/** Macro to define actual driver routine in .S
- * On entry:
- * r0 - address of driver_state
- * r1-r3 - parameters (variable)
- * r12 - number of parameters (IPC scratch register)
- * Stack - parameters (variable)
- */
-#define DRIVER_ROUTINE(driver, cmd) \
- .global driver ## _ ## cmd ## ;\
-driver ## _ ## cmd ## :
-
-#else
+#else /* C Defines */
/** Macro to control typedef generation
*
*/
@@ -137,13 +77,12 @@ driver ## _ ## cmd ## :
#endif
+/* Example of how to use the ENUM definition macros
ENUM_BEGIN
-ENUM_VAL(INIT) /**< Driver Init Routine. */
-ENUM_VAL(SHUTDOWN) /**< Driver Shutdown Routine. */
-ENUM_VAL(SLEEP) /**< Driver Sleep Routine. */
-ENUM_VAL(WAKEUP) /**< Driver Wakeup Routine. */
-ENUM_VAL(POLL) /**< Driver Poll Routine. */
-ENUM_END(nx_driver_default_cmd)
-
+ENUM_VAL(INIT)
+ENUM_VAL(RESET)
+ENUM_VAL(CONFIGURED)
+ENUM_END(enum_label)
+*/
-#endif /* __NXOS_BASE_C_ARM_MACROS__ */
+#endif /* __C_ARM_MACROS__ */
diff --git a/AT91SAM7S256/armdebug/Debugger/debug_comm.S b/AT91SAM7S256/armdebug/Debugger/debug_comm.S
index af69391..857c3ea 100644
--- a/AT91SAM7S256/armdebug/Debugger/debug_comm.S
+++ b/AT91SAM7S256/armdebug/Debugger/debug_comm.S
@@ -1,3 +1,7 @@
+/** @file debug_comm.S
+ * @brief GDB Server communications 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
+ *
*/
#define __ASSEMBLY__
diff --git a/AT91SAM7S256/armdebug/Debugger/debug_macros.h b/AT91SAM7S256/armdebug/Debugger/debug_macros.h
new file mode 100644
index 0000000..416022e
--- /dev/null
+++ b/AT91SAM7S256/armdebug/Debugger/debug_macros.h
@@ -0,0 +1,252 @@
+/** @file debug_macros.h
+ * @brief internal macros used by debug_stub routines
+ *
+ */
+
+/* Copyright (C) 2007-2010 the NxOS developers
+ *
+ * Module Developed by: TC Wan <tcwan@cs.usm.my>
+ *
+ * See AUTHORS for a full list of the developers.
+ *
+ * See COPYING for redistribution license
+ *
+ */
+
+#ifndef __DEBUG_MACROS_H__
+#define __DEBUG_MACROS_H__
+
+
+
+/** @addtogroup debug_macros */
+/*@{*/
+
+/* _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_thumbDecodeEntry
+ * Load Thumb Instruction Decoder Entry
+ * On entry:
+ * instrreg is the register to load the instruction into
+ * instrmask is the register to load the instruction mask into
+ * codehandler is the register to load the code handling routine into
+ * indexreg contains decode table index value
+ * NOTE: instrreg, instrmask, codehandler must be in increasing register number order
+ */
+ .macro _dbg_thumbDecodeEntry instrreg, instrmask, codehandler, indexreg
+
+ ldr \instrmask, =debug_thumbDecodeTable /* Temporary register */
+ add \instrmask, \instrmask, \indexreg, lsl #3
+ ldm \instrmask, {\instrreg, \codehandler} /* LSHW: IID, MSHW: IBM */
+ mov \instrmask, \instrreg, lsr #16
+ and \instrreg, \instrreg, #HLFWRD0
+ .endm
+
+/* _dbg_armDecodeEntry
+ * Load ARM Instruction Decoder Entry
+ * On entry:
+ * instrreg is the register to load the instruction into
+ * instrmask is the register to load the instruction mask into
+ * codehandler is the register to load the code handling routine into
+ * indexreg contains decode table index value
+ * NOTE: instrreg, instrmask, codehandler must be in increasing register number order
+ */
+ .macro _dbg_armDecodeEntry instrreg, instrmask, codehandler, indexreg
+
+ ldr \instrmask, =debug_thumbDecodeTable /* Temporary register */
+ add \instrmask, \instrmask, \indexreg, lsl #3
+ add \instrmask, \instrmask, \indexreg, lsl #2 /* 12 byte entries */
+ ldm \instrmask, {\instrreg, \instrmask, \codehandler}
+ .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
+
+/* _getdbgregisterfromindex
+ * Retrieve register contents from debugger stack given index
+ *
+ * On entry:
+ * indexreg contains debugger stack index value (0-max entries)
+ * On exit:
+ * indexreg: Breakpoint index (preserved)
+ * contentsreg: Register Contents for given index
+ */
+ .macro _getdbgregisterfromindex indexreg, contentsreg
+ ldr \contentsreg, =__debugger_stack_bottom__
+ ldr \contentsreg, [\contentsreg, \indexreg, lsl #2]
+ .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
+
+
+ /*@}*/
+
+#endif /* __DEBUG_MACROS_H__ */
diff --git a/AT91SAM7S256/armdebug/Debugger/debug_stub.S b/AT91SAM7S256/armdebug/Debugger/debug_stub.S
index 030ce40..cc901ef 100644
--- a/AT91SAM7S256/armdebug/Debugger/debug_stub.S
+++ b/AT91SAM7S256/armdebug/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
@@ -170,9 +175,36 @@ debug_cmdJumpTable:
* The IHA is always 4 bytes.
*/
-/* ARM Instruction Decode Table */
-
-/* Thumb Instruction Decode Table */
+/* ARM Instruction Decode Table
+ * .word IID, IBM, IHA (12 bytes)
+ */
+debug_armDecodeTable:
+ .word 0x0000f000, 0x0c00f000, _arm_data_instr_handler /* Data Processing instr with Rd = R15 */
+ .word 0x012fff10, 0x0ffffff0, _arm_bx_blx_handler /* BX or BLX */
+ .word 0x0410f000, 0x0410f000, _arm_ldr_pc_handler /* LDR with Rd = PC */
+/* .word 0x06000010, 0x0e000010, _arm_undef_handler */ /* Undefined instr: shouldn't occur, as it would've been trapped already */
+ .word 0x08108000, 0x0e108000, _arm_ldm_pc_handler /* LDM {pc} */
+ .word 0x0a000000, 0x0e000000, _arm_b_bl_handler /* B or BL. Note v4t does not have BLX instr */
+ .word 0x0c000000, 0x0c000000, _arm_coproc_swi_handler /* Coprocessor instr or SWI */
+ .word 0x0,0x0,0x0 /* Null Entry */
+
+/* Thumb Instruction Decode Table
+ * .hword IID, IBM
+ * .word IHA (8 bytes)
+ */
+debug_thumbDecodeTable:
+ .hword 0x4700, 0xff07
+ .word _thumb_bx_blx_handler /* BX or BLX. Note: b7 (H1) is not matched in the mask */
+ .hword 0xbd00, 0xff00
+ .word _thumb_poppc_handler /* PUSH/POP, specifically POP {Rlist,PC} */
+ .hword 0xd000, 0xf000
+ .word _thumb_bcond_swi_handler /* B<cond> or SWI */
+ .hword 0xe000, 0xf800
+ .word _thumb_b_handler /* B */
+ .hword 0xf000, 0xf000
+ .word _thumb_long_b_handler /* Long BL or BLX (4 bytes) Note: b11 (H) indicates 1st or 2nd instr */
+ .hword 0x0,0x0
+ .word 0x0 /* Null Entry */
.code 32
@@ -183,194 +215,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.
@@ -659,8 +503,8 @@ _dbg__procRegister:
_dbg_outputOneRegValue:
stmfd sp!, {lr}
add r2, r0, #DBGSTACK_USERREG_INDEX /* Convert register index to Debug Stack index */
- _index2dbgstackaddr r2, r0 /* Calculate address pointer to relevant register, result in R0 */
- ldr r0, [r0] /* Retrieve Register contents into R0 */
+ _getdbgregisterfromindex r2, r0 /* Retrieve Register contents into R0 */
+ ldr r0, [r0]
bl word2ascii /* Convert and put hex chars into Output Message Buffer */
ldmfd sp!, {pc}
@@ -1244,8 +1088,7 @@ _dbg_next_instruction_addr:
*/
mov r2, #DBGSTACK_USERCPSR_INDEX /* Retrieve User CPSR */
- _index2dbgstackaddr r2, r0 /* Calculate address pointer to relevant register, result in R0 */
- ldr r0, [r0] /* Retrieve Register contents into R0 */
+ _getdbgregisterfromindex r2, r0 /* Retrieve Register contents into R0 */
and r4, r0, #CPSR_THUMB /* store Thumb Mode status in R4 */
_dbg_getabortedinstr_addr r2 /* Retrieve aborted instruction address */
@@ -1273,7 +1116,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 */
@@@@@@@@@
diff --git a/AT91SAM7S256/armdebug/Debugger/debug_stub.h b/AT91SAM7S256/armdebug/Debugger/debug_stub.h
index 311fa93..897c2b8 100644
--- a/AT91SAM7S256/armdebug/Debugger/debug_stub.h
+++ b/AT91SAM7S256/armdebug/Debugger/debug_stub.h
@@ -9,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
+ *
*/
#ifndef __DEBUG_STUB_H__
@@ -18,9 +18,6 @@
#include "_c_arm_macros.h"
-#ifndef __ASSEMBLY__
-#include "types.h"
-#endif
/** @addtogroup debugger */
/*@{*/
diff --git a/AT91SAM7S256/armdebug/Debugger/types.h b/AT91SAM7S256/armdebug/Debugger/types.h
deleted file mode 100644
index 3a1d4cb..0000000
--- a/AT91SAM7S256/armdebug/Debugger/types.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/** @file types.h
- * @brief Basic type definitions for the Arm7 platform.
- */
-
-/* Copyright (c) 2007,2008 the NxOS developers
- *
- * 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.
- */
-
-#ifndef __NXOS_BASE_TYPES_H__
-#define __NXOS_BASE_TYPES_H__
-
-/** @addtogroup typesAndUtils */
-/*@{*/
-
-typedef unsigned char U8; /**< Unsigned 8-bit integer. */
-typedef signed char S8; /**< Signed 8-bit integer. */
-typedef unsigned short U16; /**< Unsigned 16-bit integer. */
-typedef signed short S16; /**< Signed 16-bit integer. */
-typedef unsigned long U32; /**< Unsigned 32-bit integer. */
-typedef signed long S32; /**< Signed 32-bit integer. */
-
-#ifndef __SIZE_TYPE__
-#define __SIZE_TYPE__ U32 /**< Used to go conform with gcc, otherwise we are
- risking an error because of conflicting types for size_t */
-#endif
-typedef __SIZE_TYPE__ size_t; /**< Abstract size type, needed by the memory allocator. */
-
-typedef U8 bool; /**< Boolean data type. */
-#define FALSE (0) /**< False boolean value. */
-#define TRUE (!FALSE) /**< True boolean value. */
-
-#ifndef NULL
-/** Definition of the NULL pointer. */
-#define NULL ((void*)0)
-#endif
-
-/** A function that takes no arguments and returns nothing. */
-typedef void (*nx_closure_t)(void);
-
-/*@}*/
-
-#endif
diff --git a/AT91SAM7S256/armdebug/Debugger/undef_handler.S b/AT91SAM7S256/armdebug/Debugger/undef_handler.S
index 34bca92..385bf0c 100644
--- a/AT91SAM7S256/armdebug/Debugger/undef_handler.S
+++ b/AT91SAM7S256/armdebug/Debugger/undef_handler.S
@@ -19,6 +19,7 @@
.extern dbg__thumb_bkpt_handler
.extern dbg__arm_bkpt_handler
+ .extern default_undef_handler
.global undef_handler
@@ -69,5 +70,3 @@ _is_arm:
mov pc, lr /* Invoke Debugger State (Supervisor Mode) */
-default_undef_handler:
- b default_undef_handler /* Infinite loop */