Skip to contentSkip to conversation

MPC85xx KGDB support

PATCH New Chen Gong 3 participants 4 messages Nov 2, 2007 – Feb 5, 2008

lore
Share & tools
lore

Chen Gong

author
#0 lore raw

PATCH 1/1 MPC85xx KGDB support

---
 cpu/mpc85xx/Makefile         |    4 +-
 drivers/serial.c             |   28 +++++++++++++++++++
 include/configs/MPC8548CDS.h |    3 +-
 lib_ppc/kgdb.c               |   62 +++++++++++++++++++++++++++++++++---------
 4 files changed, 81 insertions(+), 16 deletions(-)
cpu/mpc85xx/Makefile +2 -2
index 32091fa..f5cb148 100644
@@ -28,7 +28,7 @@ include $(TOPDIR)/config.mk
 
 LIB	= $(obj)lib$(CPU).a
 
-START	= start.o resetvec.o
+START	= start.o resetvec.o kgdb.o
 COBJS	= traps.o cpu.o cpu_init.o speed.o interrupts.o \
 	  pci.o serial_scc.o commproc.o ether_fcc.o spd_sdram.o qe_io.o
 
@@ -39,7 +39,7 @@ START	:= $(addprefix $(obj),$(START))
 all:	$(obj).depend $(START) $(LIB)
 
 $(LIB):	$(OBJS)
-	$(AR) $(ARFLAGS) $@ $(OBJS)
+	$(AR) $(ARFLAGS) $@ $(OBJS) $(obj)kgdb.o
 
 #########################################################################
 
drivers/serial.c +28 -0
index 76425d8..42585d7 100644
@@ -307,6 +307,34 @@ serial_setbrg(void)
 }
 #endif
 
+#if defined(CONFIG_CMD_KGDB)
+void kgdb_serial_init (void)
+{
+	/* here presume you have been initialzed appropriate COM# */
+	_serial_puts("[on serial] ",CONFIG_KGDB_SER_INDEX);
+}
+
+void putDebugChar (int c)
+{
+	_serial_putc(c, CONFIG_KGDB_SER_INDEX);
+}
+
+void putDebugStr (const char *str)
+{
+	_serial_puts(str, CONFIG_KGDB_SER_INDEX);
+}
+
+int getDebugChar (void)
+{
+	return _serial_getc(CONFIG_KGDB_SER_INDEX);
+}
+
+void kgdb_interruptible (int yes)
+{
+	return;
+}
+#endif
+
 #if defined(CONFIG_SERIAL_MULTI)
 
 DECLARE_ESERIAL_FUNCTIONS(1);
include/configs/MPC8548CDS.h +2 -1
index 6083715..396feeb 100644
@@ -482,6 +482,7 @@ extern unsigned long get_clock_freq(void);
 #define CONFIG_CMD_PING
 #define CONFIG_CMD_I2C
 #define CONFIG_CMD_MII
+#define CONFIG_CMD_KGDB
 
 #if defined(CONFIG_PCI)
     #define CONFIG_CMD_PCI
@@ -529,7 +530,7 @@ extern unsigned long get_clock_freq(void);
 #define BOOTFLAG_WARM	0x02		/* Software reboot */
 
 #if defined(CONFIG_CMD_KGDB)
-#define CONFIG_KGDB_BAUDRATE	230400	/* speed to run kgdb serial port */
+#define CONFIG_KGDB_BAUDRATE	115200	/* speed to run kgdb serial port */
 #define CONFIG_KGDB_SER_INDEX	2	/* which serial port to use */
 #endif
 
lib_ppc/kgdb.c +49 -13

83 lines not on this page · raw message

Signature · 1 line
1.5.2
#1 lore raw

PATCH 1/1 MPC85xx KGDB support

I'm sorry to forget to add some description.

I want to add kgdb support for MPC85xx platform. With this patch, gdb can connect the board, but it seems there are some problems,such as setting breakpoint has no respond. I test it using MPC8548CDS board, because it has only one serial port, so maybe this is the one of the reasons. Anyone can help me to test it on the other board? If you want to do that, you need change the config file(in the include/configs/xxx.h) like I do. Any respond is welcome!

Quoted 193 lines

-----Original Message-----
From: Chen Gong-B11801
Sent: 2007?11?2? 11:16
To: u-boot-users at lists.sourceforge.net
Cc: Loeliger Jon-LOELIGER; Chen Gong-B11801
Subject: [PATCH] MPC85xx KGDB support

---
 cpu/mpc85xx/Makefile         |    4 +-
 drivers/serial.c             |   28 +++++++++++++++++++
 include/configs/MPC8548CDS.h |    3 +-
 lib_ppc/kgdb.c               |   62 
+++++++++++++++++++++++++++++++++---------
 4 files changed, 81 insertions(+), 16 deletions(-)
cpu/mpc85xx/Makefile +2 -2
index 32091fa..f5cb148 100644
@@ -28,7 +28,7 @@ include $(TOPDIR)/config.mk
 
 LIB	= $(obj)lib$(CPU).a
 
-START	= start.o resetvec.o
+START	= start.o resetvec.o kgdb.o
 COBJS	= traps.o cpu.o cpu_init.o speed.o interrupts.o \
 	  pci.o serial_scc.o commproc.o ether_fcc.o spd_sdram.o qe_io.o
 
@@ -39,7 +39,7 @@ START	:= $(addprefix $(obj),$(START))
 all:	$(obj).depend $(START) $(LIB)
 
 $(LIB):	$(OBJS)
-	$(AR) $(ARFLAGS) $@ $(OBJS)
+	$(AR) $(ARFLAGS) $@ $(OBJS) $(obj)kgdb.o
 
 
 ##############################################################

###########

drivers/serial.c index renamed from drivers/serial.c +0 -0

76425d8..42585d7 100644

drivers/serial.c +25 -0
@@ -307,6 +307,34 @@ serial_setbrg(void)  }  #endif
 
+#if defined(CONFIG_CMD_KGDB)
+void kgdb_serial_init (void)
+{
+	/* here presume you have been initialzed appropriate COM# */
+	_serial_puts("[on serial] ",CONFIG_KGDB_SER_INDEX); }
+
+void putDebugChar (int c)
+{
+	_serial_putc(c, CONFIG_KGDB_SER_INDEX); }
+
+void putDebugStr (const char *str)
+{
+	_serial_puts(str, CONFIG_KGDB_SER_INDEX); }
+
+int getDebugChar (void)
+{
+	return _serial_getc(CONFIG_KGDB_SER_INDEX);
+}
+
+void kgdb_interruptible (int yes)
+{
+	return;
+}
+#endif
+
 #if defined(CONFIG_SERIAL_MULTI)
 
 DECLARE_ESERIAL_FUNCTIONS(1);
(quoted diff) +0 -0

b/include/configs/MPC8548CDS.h index 6083715..396feeb 100644

include/configs/MPC8548CDS.h +0 -0
@@ -482,6 +482,7 @@ extern unsigned long 

get_clock_freq(void); #define CONFIG_CMD_PING #define CONFIG_CMD_I2C #define CONFIG_CMD_MII

include/configs/MPC8548CDS.h +1 -1
+#define CONFIG_CMD_KGDB
 
 #if defined(CONFIG_PCI)
     #define CONFIG_CMD_PCI
@@ -529,7 +530,7 @@ extern unsigned long get_clock_freq(void);
 #define BOOTFLAG_WARM	0x02		/* Software reboot */
 
 #if defined(CONFIG_CMD_KGDB)
-#define CONFIG_KGDB_BAUDRATE	230400	/* speed to run kgdb 

serial port */
+#define CONFIG_KGDB_BAUDRATE 115200 /* speed to run kgdb
serial port */
#define CONFIG_KGDB_SER_INDEX 2 /* which serial
port to use */
#endif

lib_ppc/kgdb.c index renamed from lib_ppc/kgdb.c +0 -0

78c2f0c..7acdebc 100644

lib_ppc/kgdb.c +0 -0
@@ -60,20 +60,46 @@ static struct hard_trap_info
 	unsigned int tt;		/* Trap type code for powerpc */
 	unsigned char signo;		/* Signal that we map 

this trap into */
} hard_trap_info[] = {

lib_ppc/kgdb.c +0 -2
-	{ 0x200, SIGSEGV },			/* machine check */
-	{ 0x300, SIGSEGV },			/* address 

error (store) */

lib_ppc/kgdb.c +0 -1
-	{ 0x400, SIGBUS },			/* instruction 

bus error */

lib_ppc/kgdb.c +50 -11
-	{ 0x500, SIGINT },			/* interrupt */
-	{ 0x600, SIGBUS },			/* alingment */
-	{ 0x700, SIGTRAP },			/* breakpoint trap */
-	{ 0x800, SIGFPE },			/* fpu unavail */
-	{ 0x900, SIGALRM },			/* decrementer */
-	{ 0xa00, SIGILL },			/* reserved */
-	{ 0xb00, SIGILL },			/* reserved */
-	{ 0xc00, SIGCHLD },			/* syscall */
-	{ 0xd00, SIGTRAP },			/* single-step/watch */
-	{ 0xe00, SIGFPE },			/* fp assist */
+#if defined(CONFIG_40x) || defined(CONFIG_BOOKE)
+	{ 0x100, SIGINT  },             /* critical input interrupt */
+	{ 0x200, SIGSEGV },             /* machine check */
+	{ 0x300, SIGSEGV },             /* data storage */
+	{ 0x400, SIGBUS  },             /* instruction storage */
+	{ 0x500, SIGINT  },             /* interrupt */
+	{ 0x600, SIGBUS  },             /* alignment */
+	{ 0x700, SIGILL  },             /* program */
+	{ 0x800, SIGILL  },             /* reserved */
+	{ 0x900, SIGILL  },             /* reserved */
+	{ 0xa00, SIGILL  },             /* reserved */
+	{ 0xb00, SIGILL  },             /* reserved */
+	{ 0xc00, SIGCHLD },             /* syscall */
+	{ 0xd00, SIGILL  },             /* reserved */
+	{ 0xe00, SIGILL  },             /* reserved */
+	{ 0xf00, SIGILL  },             /* reserved */
+	/*
+         * 0x1000  PIT
+         * 0x1010  FIT
+         * 0x1020  watchdog
+         * 0x1100  data TLB miss
+         * 0x1200  instruction TLB miss
+         */
+	{ 0x2002, SIGTRAP},             /* debug */
+#else
+	{ 0x200, SIGSEGV },		/* machine check */
+	{ 0x300, SIGSEGV },		/* address error (store) */
+	{ 0x400, SIGBUS },		/* instruction bus error */
+	{ 0x500, SIGINT },		/* interrupt */
+	{ 0x600, SIGBUS },		/* alingment */
+	{ 0x700, SIGTRAP },		/* breakpoint trap */
+	{ 0x800, SIGFPE },		/* fpu unavail */
+	{ 0x900, SIGALRM },		/* decrementer */
+	{ 0xa00, SIGILL },		/* reserved */
+	{ 0xb00, SIGILL },		/* reserved */
+	{ 0xc00, SIGCHLD },		/* syscall */
+	{ 0xd00, SIGTRAP },		/* single-step/watch */
+	{ 0xe00, SIGFPE },		/* fp assist */
 	{ 0, 0}				/* Must be last */
+#endif
 };
 
 static int
@@ -100,7 +126,12 @@ kgdb_enter(struct pt_regs *regs, kgdb_data *kdp)
 		/* Skip over breakpoint trap insn */
 		regs->nip += 4;
 	}
+#if defined(CONFIG_40x) || defined(CONFIG_BOOKE)
+	mtspr(SPRN_DBCR0, mfspr(SPRN_DBCR0) & ~DBCR_IC);
+	regs->msr &= ~MSR_DE;
+#else
 	regs->msr &= ~MSR_SE;
+#endif
 
 	/* reply to host that an exception has occurred */
 	kdp->sigval = computeSignal(regs->trap); @@ -130,7 
+161,12 @@ kgdb_exit(struct pt_regs *regs, kgdb_data *kdp)
 		break;
 
 	case KGDBEXIT_SINGLE:
+#if defined(CONFIG_40x) || defined(CONFIG_BOOKE)
+		mtspr(SPRN_DBCR0, mfspr(SPRN_DBCR0) | DBCR_IC);
+		regs->msr |= MSR_DE;
+#else
 		regs->msr |= MSR_SE;
+#endif
 #if 0
 		set_msr(msr | MSR_SE);
 #endif
--

1.5.2

#2 lore raw

PATCH 1/1 MPC85xx KGDB support

In reply to Chen Gong
Quoted 22 lines · Chen Gong

---

cpu/mpc85xx/Makefile         |    4 +-
drivers/serial.c             |   28 +++++++++++++++++++
include/configs/MPC8548CDS.h |    3 +-
lib_ppc/kgdb.c               |   62 ++++++++++++++++++++++++++++++++ 
+---------
4 files changed, 81 insertions(+), 16 deletions(-)
cpu/mpc85xx/Makefile +0 -0
index 32091fa..f5cb148 100644
@@ -28,7 +28,7 @@ include $(TOPDIR)/config.mk
 

LIB = $(obj)lib$(CPU).a

cpu/mpc85xx/Makefile +1 -1
-START	= start.o resetvec.o
+START	= start.o resetvec.o kgdb.o

COBJS = traps.o cpu.o cpu_init.o speed.o interrupts.o \
pci.o serial_scc.o commproc.o ether_fcc.o spd_sdram.o qe_io.o

cpu/mpc85xx/Makefile START := $(addprefix $(obj),$(START)) · line 42

Quoted 5 lines
cpu/mpc85xx/Makefile +1 -1
@@ -39,7 +39,7 @@ START	:= $(addprefix $(obj),$(START))
 all:	$(obj).depend $(START) $(LIB)
 
 $(LIB):	$(OBJS)
-	$(AR) $(ARFLAGS) $@ $(OBJS)
+	$(AR) $(ARFLAGS) $@ $(OBJS) $(obj)kgdb.o

these makefile changes seem bogus. There isn't a kgdb source file in cpu/mpc85xx/ (at least your patch isn't adding one).

Quoted 49 lines
cpu/mpc85xx/Makefile +0 -0
 #########################################################################
 
drivers/serial.c +28 -0
index 76425d8..42585d7 100644
@@ -307,6 +307,34 @@ serial_setbrg(void)
 }
 #endif
 
+#if defined(CONFIG_CMD_KGDB)
+void kgdb_serial_init (void)
+{
+	/* here presume you have been initialzed appropriate COM# */
+	_serial_puts("[on serial] ",CONFIG_KGDB_SER_INDEX);
+}
+
+void putDebugChar (int c)
+{
+	_serial_putc(c, CONFIG_KGDB_SER_INDEX);
+}
+
+void putDebugStr (const char *str)
+{
+	_serial_puts(str, CONFIG_KGDB_SER_INDEX);
+}
+
+int getDebugChar (void)
+{
+	return _serial_getc(CONFIG_KGDB_SER_INDEX);
+}
+
+void kgdb_interruptible (int yes)
+{
+	return;
+}
+#endif
+
 #if defined(CONFIG_SERIAL_MULTI)
 
 DECLARE_ESERIAL_FUNCTIONS(1);
include/configs/ renamed from include/configs/MPC8548CDS.h +0 -0

MPC8548CDS.h
index 6083715..396feeb 100644

include/configs/MPC8548CDS.h extern unsigned long get_clock_freq(void); · line 485

Quoted 4 lines
include/configs/MPC8548CDS.h +1 -0
@@ -482,6 +482,7 @@ extern unsigned long get_clock_freq(void);
 #define CONFIG_CMD_PING
 #define CONFIG_CMD_I2C
 #define CONFIG_CMD_MII
+#define CONFIG_CMD_KGDB

I dont think we want to turn this on by default.

Quoted 119 lines
include/configs/MPC8548CDS.h +0 -1
 #if defined(CONFIG_PCI)
    #define CONFIG_CMD_PCI
@@ -529,7 +530,7 @@ extern unsigned long get_clock_freq(void);
 #define BOOTFLAG_WARM	0x02		/* Software reboot */
 
 #if defined(CONFIG_CMD_KGDB)
-#define CONFIG_KGDB_BAUDRATE	230400	/* speed to run kgdb serial  

port */
+#define CONFIG_KGDB_BAUDRATE 115200 /* speed to run kgdb serial
port */
#define CONFIG_KGDB_SER_INDEX 2 /* which serial port to use */
#endif

lib_ppc/kgdb.c +39 -13
index 78c2f0c..7acdebc 100644
@@ -60,20 +60,46 @@ static struct hard_trap_info
 	unsigned int tt;		/* Trap type code for powerpc */
 	unsigned char signo;		/* Signal that we map this trap into */
 } hard_trap_info[] = {
-	{ 0x200, SIGSEGV },			/* machine check */
-	{ 0x300, SIGSEGV },			/* address error (store) */
-	{ 0x400, SIGBUS },			/* instruction bus error */
-	{ 0x500, SIGINT },			/* interrupt */
-	{ 0x600, SIGBUS },			/* alingment */
-	{ 0x700, SIGTRAP },			/* breakpoint trap */
-	{ 0x800, SIGFPE },			/* fpu unavail */
-	{ 0x900, SIGALRM },			/* decrementer */
-	{ 0xa00, SIGILL },			/* reserved */
-	{ 0xb00, SIGILL },			/* reserved */
-	{ 0xc00, SIGCHLD },			/* syscall */
-	{ 0xd00, SIGTRAP },			/* single-step/watch */
-	{ 0xe00, SIGFPE },			/* fp assist */
+#if defined(CONFIG_40x) || defined(CONFIG_BOOKE)
+	{ 0x100, SIGINT  },             /* critical input interrupt */
+	{ 0x200, SIGSEGV },             /* machine check */
+	{ 0x300, SIGSEGV },             /* data storage */
+	{ 0x400, SIGBUS  },             /* instruction storage */
+	{ 0x500, SIGINT  },             /* interrupt */
+	{ 0x600, SIGBUS  },             /* alignment */
+	{ 0x700, SIGILL  },             /* program */
+	{ 0x800, SIGILL  },             /* reserved */
+	{ 0x900, SIGILL  },             /* reserved */
+	{ 0xa00, SIGILL  },             /* reserved */
+	{ 0xb00, SIGILL  },             /* reserved */
+	{ 0xc00, SIGCHLD },             /* syscall */
+	{ 0xd00, SIGILL  },             /* reserved */
+	{ 0xe00, SIGILL  },             /* reserved */
+	{ 0xf00, SIGILL  },             /* reserved */
+	/*
+         * 0x1000  PIT
+         * 0x1010  FIT
+         * 0x1020  watchdog
+         * 0x1100  data TLB miss
+         * 0x1200  instruction TLB miss
+         */
+	{ 0x2002, SIGTRAP},             /* debug */
+#else
+	{ 0x200, SIGSEGV },		/* machine check */
+	{ 0x300, SIGSEGV },		/* address error (store) */
+	{ 0x400, SIGBUS },		/* instruction bus error */
+	{ 0x500, SIGINT },		/* interrupt */
+	{ 0x600, SIGBUS },		/* alingment */
+	{ 0x700, SIGTRAP },		/* breakpoint trap */
+	{ 0x800, SIGFPE },		/* fpu unavail */
+	{ 0x900, SIGALRM },		/* decrementer */
+	{ 0xa00, SIGILL },		/* reserved */
+	{ 0xb00, SIGILL },		/* reserved */
+	{ 0xc00, SIGCHLD },		/* syscall */
+	{ 0xd00, SIGTRAP },		/* single-step/watch */
+	{ 0xe00, SIGFPE },		/* fp assist */
 	{ 0, 0}				/* Must be last */
+#endif
 };
 

static int

lib_ppc/kgdb.c +10 -0
@@ -100,7 +126,12 @@ kgdb_enter(struct pt_regs *regs, kgdb_data *kdp)
 		/* Skip over breakpoint trap insn */
 		regs->nip += 4;
 	}
+#if defined(CONFIG_40x) || defined(CONFIG_BOOKE)
+	mtspr(SPRN_DBCR0, mfspr(SPRN_DBCR0) & ~DBCR_IC);
+	regs->msr &= ~MSR_DE;
+#else
 	regs->msr &= ~MSR_SE;
+#endif
 
 	/* reply to host that an exception has occurred */
 	kdp->sigval = computeSignal(regs->trap);
@@ -130,7 +161,12 @@ kgdb_exit(struct pt_regs *regs, kgdb_data *kdp)
 		break;
 
 	case KGDBEXIT_SINGLE:
+#if defined(CONFIG_40x) || defined(CONFIG_BOOKE)
+		mtspr(SPRN_DBCR0, mfspr(SPRN_DBCR0) | DBCR_IC);
+		regs->msr |= MSR_DE;
+#else
 		regs->msr |= MSR_SE;
+#endif
 #if 0
 		set_msr(msr | MSR_SE);
 #endif
Signature · 13 lines
1.5.2


-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a  
browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
U-Boot-Users mailing list
U-Boot-Users at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/u-boot-users
#3 lore raw

PATCH 1/1 MPC85xx KGDB support

In reply to Chen Gong
Quoted 7 lines · Chen Gong
---
 cpu/mpc85xx/Makefile         |    4 +-
 drivers/serial.c             |   28 +++++++++++++++++++
 include/configs/MPC8548CDS.h |    3 +-
 lib_ppc/kgdb.c               |   62 +++++++++++++++++++++++++++++++++---------
 4 files changed, 81 insertions(+), 16 deletions(-)

Do you have any response to Kumar's comments on this patch? I'd like to get it in for the next merge window, but we need to make sure it works, and that we've addressed any concerns (even if addressing them only requires explaining why you did it this way).

Andy