From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6846 invoked by alias); 1 Sep 2009 15:46:06 -0000 Received: (qmail 6837 invoked by uid 22791); 1 Sep 2009 15:46:05 -0000 X-SWARE-Spam-Status: No, hits=-1.8 required=5.0 tests=AWL,BAYES_00,SARE_MSGID_LONG40,SPF_PASS X-Spam-Check-By: sourceware.org Received: from mail-px0-f204.google.com (HELO mail-px0-f204.google.com) (209.85.216.204) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 01 Sep 2009 15:46:00 +0000 Received: by pxi42 with SMTP id 42so82572pxi.20 for ; Tue, 01 Sep 2009 08:45:59 -0700 (PDT) MIME-Version: 1.0 Received: by 10.142.75.15 with SMTP id x15mr85126wfa.152.1251819958898; Tue, 01 Sep 2009 08:45:58 -0700 (PDT) In-Reply-To: <4A9D3FB5.4000707@intefo.ch> References: <4A9D119A.1020605@intefo.ch> <4A9D168D.20800@intefo.ch> <4A9D1AFF.90605@intefo.ch> <4A9D23B9.2080201@intefo.ch> <4A9D3FB5.4000707@intefo.ch> Date: Tue, 01 Sep 2009 15:46:00 -0000 Message-ID: From: Mandeep Sandhu To: Simon Kallweit Cc: ecos-discuss Content-Type: text/plain; charset=ISO-8859-1 X-IsSubscribed: yes Mailing-List: contact ecos-discuss-help@ecos.sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: ecos-discuss-owner@ecos.sourceware.org Subject: Re: [ECOS] ecos + lwip X-SW-Source: 2009-09/txt/msg00029.txt.bz2 On Tue, Sep 1, 2009 at 9:07 PM, Simon Kallweit wrote: > Mandeep Sandhu wrote: >> >> On Tue, Sep 1, 2009 at 7:08 PM, Simon Kallweit >> wrote: >>> >>> Mandeep Sandhu wrote: >>> sys_thread_new() will use preallocated memory for the stack, while >>> cyg_lwip_thread_new() will take the stack as an argument. Therefore by >>> default you should use cyg_lwip_thread_new(). When using sys_thread_new() >>> the ecos should fail when all preallocated memory is used. >> >> But sys_thread_new() also takes stacksize as an argument. It passes >> the same value >> to cyg_lwip_thread_new() after validating it. So I guess it should be ok. > > Yes, sys_thread_new() takes a stacksize argument, but no pointer to the > actual memory. The current code uses a statically allocated buffer for all > lwip's internal stacks, but it is not large enough to hold additional stacks > from users, hence the cyg_lwip_thread_new() API where the user can provide a > pointer to the actual stack memory to be used. > > Your application should FAIL when using sys_thread_new() with the following > message: > > "Not enough memory to allocate the thread's stack. You may want to use > cyg_lwip_thread_new() instead of sys_thread_new() so you can provide > external stack memory." I dont see this message. > > This message should pop up unless you have asserts disabled?!? No. They're enabled. > > Maybe I should add an option in the CDL to enlarge the statically allocated > internal stack memory so users could allocate threads with sys_thread_new(). > But I don't personally like it, as you may waste memory. > cyg_lwip_thread_new() does solve this problem by forcing you to allocate the > stack memory yourself. > > Please try to use cyg_lwip_thread_new() and tell me if that works. I'll do that now. Thanks for tips. Also I noted one more thing. My thread which calls netif_find() is executed _BEFORE_ I see the netif_add() messages!!! Could this be a thread synchronization issue? Should I wait for the netif init() to complete? Regards, -mandeep > > Simon > -- Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss