Hi folks, i've tried to enable KGDB on evbarm. I've managed to get it compiled and i think it *should* work, but when i try to connect to it, it just isn't responding. It might well be that that is due to the wrong architecture compiled gdb, but even on `cu' i see no communication going on. Note that the patch is also adding DDB entry on startup when the RB_KDB flag is set but neither when using the framebuffer nor when using the tty console i see any activity nor dialog. It might thus be related? The current work in progress patch is attached. Any ideas? What am i doing wrong? Is something not initialized correctly? Has anyone managed to get into DDB and have a working keyboard too? With regards, Reinoud ---------- Index: conf/RPI =================================================================== RCS file: /cvsroot/src/sys/arch/evbarm/conf/RPI,v retrieving revision 1.31 diff -u -p -r1.31 RPI --- conf/RPI 17 Apr 2013 19:04:19 -0000 1.31 +++ conf/RPI 10 May 2013 19:32:37 -0000 @@ -136,10 +136,10 @@ options DEBUG #options LOCKDEBUG #options IPKDB # remote kernel debugging #options VERBOSE_INIT_ARM # verbose bootstraping messages -options DDB # in-kernel debugger -options DDB_ONPANIC=1 -options DDB_HISTORY_SIZE=100 # Enable history editing in DDB -#options KGDB +#options DDB # in-kernel debugger +#options DDB_ONPANIC=1 +#options DDB_HISTORY_SIZE=100 # Enable history editing in DDB +options KGDB,KGDB_PLCOMUNIT=0,KGDB_DEVRATE=115200,KGDB_CONMODE=0xB00 makeoptions DEBUG="-g" # compile full symbol table options SYMTAB_SPACE=800000 options PLCONSOLE Index: rpi/rpi_machdep.c =================================================================== RCS file: /cvsroot/src/sys/arch/evbarm/rpi/rpi_machdep.c,v retrieving revision 1.35 diff -u -p -r1.35 rpi_machdep.c --- rpi/rpi_machdep.c 19 Mar 2013 22:16:55 -0000 1.35 +++ rpi/rpi_machdep.c 10 May 2013 19:32:37 -0000 @@ -139,9 +139,18 @@ int plcomcnspeed = PLCONSPEED; int plcomcnmode = PLCONMODE; #endif +#include "opt_ddb.h" +#ifdef DDB +#include <arm/db_machdep.h> +#endif + #include "opt_kgdb.h" #ifdef KGDB +#if (NPLCOM == 0) +#error Enable plcom0 for KGDB support +#endif #include <sys/kgdb.h> +static void kgdb_port_init(void); #endif /* Smallest amount of RAM start.elf could give us. */ @@ -521,6 +530,9 @@ initarm(void *arg) cpu_reset_address = bcm2835_system_reset; +#ifdef KGDB + kgdb_port_init(); +#endif #ifdef VERBOSE_INIT_ARM printf("done.\n"); #endif @@ -538,6 +550,19 @@ initarm(void *arg) boothowto |= BOOTHOWTO; #endif +#ifdef KGDB + if (boothowto & RB_KDB) { + kgdb_debug_init = 1; + kgdb_connect(1); + } +#endif + +#ifdef DDB + db_machine_init(); + if (boothowto & RB_KDB) + Debugger(); +#endif + /* we've a specific device_register routine */ evbarm_device_register = rpi_device_register; @@ -574,6 +599,37 @@ consinit(void) #endif } +#ifdef KGDB +#if !defined(KGDB_PLCOMUNIT) || !defined(KGDB_DEVRATE) || !defined(KGDB_CONMODE) +#error Specify KGDB_PLCOMUNIT, KGDB_DEVRATE and KGDB_CONMODE for KGDB. +#endif + +void +static kgdb_port_init(void) +{ + static int kgdbsinit_called = 0; + static struct plcom_instance rpi_pi = { + .pi_type = PLCOM_TYPE_PL011, + .pi_flags = PLC_FLAG_32BIT_ACCESS, + .pi_iot = &bcm2835_bs_tag, + .pi_size = BCM2835_UART0_SIZE + }; + int res; + + if (kgdbsinit_called != 0) + return; + + kgdbsinit_called = 1; + + rpi_pi.pi_iobase = consaddr; + + res = plcom_kgdb_attach(&rpi_pi, KGDB_DEVRATE, BCM2835_UART0_CLK, + KGDB_CONMODE, KGDB_PLCOMUNIT); + if (res) + panic("KGDB uart can not be initialized."); +} +#endif + #if NGENFB > 0 static bool rpi_fb_parse_mode(const char *s, uint32_t *pwidth, uint32_t *pheight) ----------
Attachment:
pgpSdytqe3_26.pgp
Description: PGP signature