[ECOS] Problem when debugging via gdb over ethernet

Guenter Ebermann guenter.ebermann@gmx.at
Thu Jun 5 09:36:00 GMT 2008


Hello,

I would propose the following change in eth_drv.c.

Had the problem when debugging with gdb over ethernet and a diag_printf (which
would then be redirected to the gdb-stub sitting in RedBoot ROMRAM) is used
during the ethernet driver is stopped my system crashed (using FEC driver on
MPC5200).

I found a config option which already exists and is used in the same way in other
files where the ethernet driver is stopped/reconfigured temporary.
I think it should be also used in this case.

The suspeced code is called from my RAM application indirectly from init_net() in
bootp_support.c.

Sorry my patch is against our local CVS repository. Our company restriced cvs access
to the outside. Anyway, I checked the place the code is on dev-head over WebCVS
http://ecos.sourceware.org/cgi-bin/cvsweb.cgi/ecos/packages/io/eth/current/src/net/eth_drv.c?annotate=1.33&cvsroot=ecos
in line 539.

--- packages/io/eth/current/src/net/eth_drv.c	6 Feb 2007 14:41:01 -0000	1.1.1.2
+++ packages/io/eth/current/src/net/eth_drv.c	5 Jun 2008 09:14:40 -0000
@@ -535,16 +535,36 @@ eth_drv_ioctl(struct ifnet *ifp, u_long 
                  * If interface is marked up and it is stopped, then
                  * start it.
                  */
                 eth_drv_start(sc);
             } else {
+#ifdef CYGPKG_NET_FORCE_SERIAL_CONSOLE
+                int orig_console =
+                    CYGACC_CALL_IF_SET_CONSOLE_COMM(
+                        CYGNUM_CALL_IF_SET_COMM_ID_QUERY_CURRENT);
+
+                /*
+                 * Force default serial console during system initialization
+                 * This avoids problems with debug messages occurring while
+                 * the networking subsystem is being setup.
+                 */
+                CYGACC_CALL_IF_SET_CONSOLE_COMM(0);
+#endif
                 /*
                  * Reset the interface to pick up changes in any other
                  * flags that affect hardware registers.
                  */
                 eth_drv_stop(sc);
                 eth_drv_start(sc);
+
+#ifdef CYGPKG_NET_FORCE_SERIAL_CONSOLE
+                /*
+                 * Revert to the original console, which might be a network
+                 * connection
+                 */
+                CYGACC_CALL_IF_SET_CONSOLE_COMM(orig_console);
+#endif
             }
             /*
              * Assumption: drivers should initialize hardware in
              * non-promiscuous mode. If promiscuous mode has been 
              * requested, ask the driver to enable it now.

What do you think?

best regards,
Guenter Ebermann
-- 
Psssst! Schon vom neuen GMX MultiMessenger gehört?
Der kann`s mit allen: http://www.gmx.net/de/go/multimessenger

-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss



More information about the Ecos-discuss mailing list