aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTat-Chee Wan (USM)2011-02-14 11:50:09 +0800
committerTat-Chee Wan (USM)2011-02-14 11:50:09 +0800
commit503cd98f98975ac0996dfdb39986bb7265104216 (patch)
tree0bdd569adf21949360899e4a34157d71c9e22425
parent9452b23df87eda9479991947502c951834f3c5fd (diff)
added hooks to invoke debugger from nxt firmware comm module
-rw-r--r--AT91SAM7S256/SAM7S256/gcc/Makefile5
-rw-r--r--AT91SAM7S256/Source/c_comm.c14
-rw-r--r--AT91SAM7S256/Source/c_comm.h3
3 files changed, 19 insertions, 3 deletions
diff --git a/AT91SAM7S256/SAM7S256/gcc/Makefile b/AT91SAM7S256/SAM7S256/gcc/Makefile
index 002539c..cbaef77 100644
--- a/AT91SAM7S256/SAM7S256/gcc/Makefile
+++ b/AT91SAM7S256/SAM7S256/gcc/Makefile
@@ -18,7 +18,7 @@ THUMB_SOURCES = c_button.c c_cmd.c c_comm.c c_display.c c_input.c c_ioctrl.c \
errno.c sbrk.c strtod.c sscanf.c \
Cstartup_SAM7.c
-ASM_ARM_SOURCE = Cstartup.S undef_handler.S debug_stub.S debug_comm.S
+ASM_ARM_SOURCE = Cstartup.S undef_handler.S debug_stub.S debug_comm.S debug_runlooptasks.S
ASM_THUMB_SOURCE =
vpath %.c $(SRCDIR)
@@ -29,10 +29,11 @@ vpath %.S $(CPUINCDIR) $(DBGDIR)
INCLUDES = -I../../armdebug/Debugger
MCU = arm7tdmi
+DEBUG_DEFINES = -D__ARMDEBUG__
STARTOFUSERFLASH_DEFINES = -DSTARTOFUSERFLASH_FROM_LINKER=1
VERSION_DEFINES = -DCUSTOM_FIRMWAREVERSION=\"$(CUSTOM_FIRMWAREVERSION)\"
DEFINES = -DPROTOTYPE_PCB_4 -DNEW_MENU -DROM_RUN -DVECTORS_IN_RAM \
- $(STARTOFUSERFLASH_DEFINES) $(VERSION_DEFINES)
+ $(STARTOFUSERFLASH_DEFINES) $(VERSION_DEFINES) $(DEBUG_DEFINES)
OPTIMIZE = -Os -fno-strict-aliasing \
-ffunction-sections -fdata-sections
WARNINGS = -Wall -W -Wundef -Wno-unused -Wno-format
diff --git a/AT91SAM7S256/Source/c_comm.c b/AT91SAM7S256/Source/c_comm.c
index ee0c6ae..bebf5f3 100644
--- a/AT91SAM7S256/Source/c_comm.c
+++ b/AT91SAM7S256/Source/c_comm.c
@@ -26,6 +26,9 @@
#include "d_bt.h"
#include <string.h>
#include <ctype.h>
+#ifdef __ARMDEBUG__
+#include "debug_stub.h"
+#endif
enum
{
@@ -422,6 +425,16 @@ UWORD cCommInterprete(UBYTE *pInBuf, UBYTE *pOutBuf, UBYTE *pLength, UBYTE C
}
break;
+#ifdef __ARMDEBUG__
+ case DEBUG_CMD:
+ {
+ ReturnStatus = cCommHandleDebug(&(pInBuf[0]), CmdBit, MsgLength); /* Pass everything (incl. message command byte) to function */
+ /* Check that Debug Command does not expect reply */
+ assert ((pInBuf[0]) & NO_REPLY_BIT);
+ *pLength = 0;
+ }
+ break;
+#endif
default:
{
@@ -476,7 +489,6 @@ UWORD cCommInterprete(UBYTE *pInBuf, UBYTE *pOutBuf, UBYTE *pLength, UBYTE C
return(ReturnStatus);
}
-
UWORD cCommInterpreteCmd(UBYTE Cmd, UBYTE *pInBuf, UBYTE *pOutBuf, UBYTE *pLength, UBYTE CmdBit, UWORD MsgLength)
{
ULONG FileLength;
diff --git a/AT91SAM7S256/Source/c_comm.h b/AT91SAM7S256/Source/c_comm.h
index a1e112c..9003b24 100644
--- a/AT91SAM7S256/Source/c_comm.h
+++ b/AT91SAM7S256/Source/c_comm.h
@@ -67,6 +67,9 @@ enum
DIRECT_CMD = 0x00,
SYSTEM_CMD = 0x01,
REPLY_CMD = 0x02,
+#ifdef __ARMDEBUG__
+ DEBUG_CMD = 0x0d,
+#endif
NO_REPLY_BIT = 0x80
};