This is the mail archive of the ecos-discuss@sources.redhat.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Still on ethernet configuration


On Wed, Oct 16, 2002 at 04:26:56AM +0000, Cristiano Pereira wrote:
> Hi again,
> 
> I debugged through the ioctl function and found out that the code
> is crashing when function i82559_configure returns (at the return 0
> statement, which means it executed successfully) from the call
> executed at the function i82559_start. Any clue why this happens?

Crashing on a return statement normally means stack corruption. Try
using the bt command to look at the stack frames in gdb. Try looking
at it at different points in the run. Hopefully you will see it OK at
one point and corrupt at another. You then know the problem happens
somewhere in between, or its some other thread :-(

          Andrew


> 
> Another thing which a noticed and let me curious is that when I issue
> the command "info threads" on gdb during the debugging I get the
> following answer:
> 
> (gdb) info threads
>  5 thread 4  0xc0052070 in hal_thread_switch_context () at heaps.cxx:19
>  4 thread 3  0xc0052070 in hal_thread_switch_context () at heaps.cxx:19
>  3 thread 2  0xc0052070 in hal_thread_switch_context () at heaps.cxx:19
>  2 thread 1  idle_thread_main (data=1243983)
>    at /opt/ecoscvs/packages/kernel/current/src/common/thread.cxx:1226
> * 1 thread 5  i82559_start (sc=0xc00693fc,
>    enaddr=0x100000 'ÿ' <repeats 200 times>..., flags=16385)
>    at 
> /opt/ecoscvs/packages/devs/eth/intel/i82559/current/src/if_i82559.c:1625
> 
> As far as I understood there are 5 threads running in my system. One
> is the network thread, the other is the net_init thread which I
> created (see the code below) and the third should be the idle thread,
> right? Why are there 5 threads then?
> 
> Here is my whole code (it's quite small but has been giving me big
> headache):
> 
> #include <stdio.h>
> #include <cyg/kernel/kapi.h>
> #include <pkgconf/net.h>
> #include <network.h>
> 
> #define STACK_SIZE 4096
> 
> 
> cyg_thread thread_s; /* space for two thread objects */
> char stack[STACK_SIZE];
> 
> /* now the handler for the threads */
> cyg_handle_t thread_handle;
> 
> /* and now variables for the procedure which is the thread */
> 
> void
> net_test(cyg_addrword_t p);
> 
> static struct bootp bootp_info;
> 
> void cyg_start(void)
> {
>    diag_printf("creating thread\n");
>    cyg_thread_create(10,
>                      net_test,          // entry
>                      0,                 // entry parameter
>                      "Network test",    // Name
>                      &stack,            // Stack
>                      STACK_SIZE,        // Size
>                      &thread_handle,    // Handle
>                      &thread_s          // Thread data structure
>            );
>    cyg_thread_resume(thread_handle);  // Start it
>    cyg_scheduler_start();
> }
> 
> void
> net_test(cyg_addrword_t p)
> {
>  diag_printf("net_test created\n");
> 
>  cyg_thread_delay(5);
> 
>  build_bootp_record(&bootp_info,
>    "128.195.11.220",
>    "255.255.255.0",
>    "128.195.11.255",
>    "128.195.11.1",
>    "");
> 
>  diag_printf("called init_net\n");
>  init_net("eth0", &bootp_info);
>  diag_printf("returned from init_net\n");
> }
> 
> Thanks in advance,
> Cristiano.

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]