From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4908 invoked by alias); 30 Jul 2009 11:11:31 -0000 Received: (qmail 4897 invoked by uid 22791); 30 Jul 2009 11:11:29 -0000 X-SWARE-Spam-Status: No, hits=-1.8 required=5.0 tests=AWL,BAYES_00,RCVD_IN_JMF_BR,SPF_HELO_PASS X-Spam-Check-By: sourceware.org Received: from mail04.solnet.ch (HELO mail04.solnet.ch) (212.101.4.138) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 30 Jul 2009 11:11:20 +0000 Received: from mail04.solnet.ch ([127.0.0.1]) by localhost (mail04.solnet.ch [127.0.0.1]) (SolNet-Check, port 10024) with LMTP id NTj368JJO9yR; Thu, 30 Jul 2009 11:11:16 +0000 (UTC) Received: from beta.intefo.ch (static-212-101-18-64.adsl.solnet.ch [212.101.18.64]) by mail04.solnet.ch (Postfix) with ESMTP id 1F7A387C2A; Thu, 30 Jul 2009 11:11:16 +0000 (UTC) Received: from beta.intefo.ch ([127.0.0.1]) by localhost (beta.intefo.ch [127.0.0.1]) (amavisd-new, port 10024) with LMTP id AXK6JfCgpCW3; Thu, 30 Jul 2009 13:11:15 +0200 (CEST) Received: from [192.168.1.20] (simon.intefo.ch [192.168.1.20]) by beta.intefo.ch (Postfix) with ESMTP id 6F1737700AF; Thu, 30 Jul 2009 13:11:15 +0200 (CEST) Message-ID: <4A718064.7090706@intefo.ch> Date: Thu, 30 Jul 2009 11:11:00 -0000 From: Simon Kallweit User-Agent: Thunderbird 2.0.0.22 (X11/20090608) MIME-Version: 1.0 To: Sergei Gavrikov CC: David Fernandez , ecos-discuss@ecos.sourceware.org References: <20090730110312.GA11789@sg-ubuntu.local> In-Reply-To: <20090730110312.GA11789@sg-ubuntu.local> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit 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]How to run testprograms for lwip X-SW-Source: 2009-07/txt/msg00271.txt.bz2 Sergei Gavrikov wrote: > On Thu, Jul 30, 2009 at 10:10:53AM +0100, David Fernandez wrote: >> May be I'm wrong, but I think that the macro CYG_FUN_LWIP_IP_FORWARD >> is not only defined, but defined as 1 if the option is enabled. May be >> that what you want is to use the macro directly instead of the >> preprocessor operator applied to it. > > As fae as I remember, that depends on CDL flavor type. The value can be > either not defined at all, or it can be defined as > > #define CYG_FOO 1 > > or it can be defined as > > #define CYG_FOO 1 > #define CYG_FOO_1 > >> That is simpler than defining another macro, and if the option is >> disabled, the macro would be defined, but its value would be 0. > > Sure. But goal is do not tweak the ported sources, so there are the same > odd wrappers. > >> You might want to check it this way though, in case the lwip is >> included, but those CDL options are not active for some reason... >> which may be impossible, but here you are. >> >> #ifndef CYG_FUN_LWIP_IP_FORWARD >> #define IP_FORWARD 0 >> #else >> #define IP_FORWARD CYG_FUN_LWIP_IP_FORWARD >> #endif > > It's resonable. And I would prefer yet another way (CDL way): > > cdl_package CYGPKG_BAR { > ... > cdl_option CYGOPT_HAVE_FOO { > display "Foo feature" > flavor bool > default_value 1 > # Original bar sources want it: > define HAVE_FOO > description " > Enable this option to use foo feature." > } > ... > } > > Then in > > will apear or won't > > #define CYGOPT_HAVE_FOO 1 > #define HAVE_FOO 1 > > In our case we would include at the end of lwipopts.h an inclusion > > #ifdef __ECOS__ > # include > #endif > > and it will be contain, e.g. > > #define CYGFUN_IP_FORWARD 1 > #define IP_FORWARD 1 > > or nothing. Etc. > > May be I wrong too. So, it seems for me it's a time to re-read CDL guide > :-) I think there are a few pitfalls we have to deal here. CDL does only emit the #defines when the boolean is true, otherwise it won't emit #defines (also true for additional defines). If we want to go that route, we would have to make sure that the CDL's defaults are also the defaults of the lwip's opts.h file, which in my opinion is not a good solution to maintain. But I think what we could do is something like cdl_option CYGOPT_IP_FORWARD { display "IP forwarding" flavor bool default_value 1 define IP_FORWARD } and then in lwipopts.h only have: #ifndef IP_FORWARD # define IP_FORWARD 0 #endif That would probably make things a bit easier. I don't know if it would work as a general solution though, would have to check that. But I'm just getting ready for my holidays :) 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