public inbox for ecos-discuss@sourceware.org
 help / color / mirror / Atom feed
* Re: [ECOS]How to run testprograms for lwip
@ 2009-07-30  9:11 David Fernandez
  2009-07-30 11:02 ` Sergei Gavrikov
  0 siblings, 1 reply; 10+ messages in thread
From: David Fernandez @ 2009-07-30  9:11 UTC (permalink / raw)
  To: ecos-discuss; +Cc: Sergei Gavrikov, Simon Kallweit

> #if defined(CYGFUN_LWIP_IP_FORWARD)
> # define IP_FORWARD 1
> #else
> # define IP_FORWARD 0
> #endif
>
> FYI: There are a few defines like this
>
> #define FOO defined(CYG_FOO)
>
> in lwipopts.h. Small testcase:
>
> #define CYG_FOO 1
> #define FOO defined(CYG_FOO)
>
> main ()
> {
> int foo = FOO;
> }
>
> It cannot be linked. FOO is not boolean ;-) I can check the same
> "rvalues" then and send a patch if you want.
>

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.

That is simpler than defining another macro, and if the option is
disabled, the macro would be defined, but its value would be 0.

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

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

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [ECOS]How to run testprograms for lwip
  2009-07-30  9:11 [ECOS]How to run testprograms for lwip David Fernandez
@ 2009-07-30 11:02 ` Sergei Gavrikov
  2009-07-30 11:11   ` Simon Kallweit
  0 siblings, 1 reply; 10+ messages in thread
From: Sergei Gavrikov @ 2009-07-30 11:02 UTC (permalink / raw)
  To: David Fernandez; +Cc: ecos-discuss, Simon Kallweit

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 <pkgconf/bar.h>

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 <pkgconf/net_lwip.h>
#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
:-)

Sergei

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

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [ECOS]How to run testprograms for lwip
  2009-07-30 11:02 ` Sergei Gavrikov
@ 2009-07-30 11:11   ` Simon Kallweit
  0 siblings, 0 replies; 10+ messages in thread
From: Simon Kallweit @ 2009-07-30 11:11 UTC (permalink / raw)
  To: Sergei Gavrikov; +Cc: David Fernandez, ecos-discuss

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 <pkgconf/bar.h>
> 
> 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 <pkgconf/net_lwip.h>
> #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

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [ECOS]How to run testprograms for lwip
  2009-07-29 12:25       ` Sergei Gavrikov
@ 2009-07-29 12:32         ` Simon Kallweit
  0 siblings, 0 replies; 10+ messages in thread
From: Simon Kallweit @ 2009-07-29 12:32 UTC (permalink / raw)
  To: Sergei Gavrikov; +Cc: Bob.Brusa, MailingList:ecos-discuss ;

Sergei Gavrikov wrote:
> Hi Simon,
> 
> Thank you for your contribution. I tried to built lwIP's with SNMP
> support using your snapshot. Unfortunately, I ran in a problem with CPP
> defines for eCos (lwipopts.h).

Glad there are people starting to test the port :)

> mib2.c:70:
> #define SNMP_SYSSERVICES ((1 << 6) | (1 << 3) | ((IP_FORWARD) << 2))
> 
> mib2.c:766:
> static const s32_t sysservices = SNMP_SYSSERVICES;
> 
> lwipopts.h:102:
> #define IP_FORWARD                  defined(CYGFUN_LWIP_IP_FORWARD)
> 
> So, the above init will become itself:
> 
> static const s32_t sysservices = ((1 << 6) | (1 << 3) | ((defined(CYGFUN_LWIP_IP_FORWARD)) << 2))
> 
> May be the below should be used in lwipopts.h?
> 
> #if defined(CYGFUN_LWIP_IP_FORWARD)
> # define IP_FORWARD 1
> #else
> # define IP_FORWARD 0
> #endif

That's exactly the right fix. There are already some other defines which 
use that scheme in lwipopts.h (CYGFUN_LWIP_PAP_SUPPORT is such an example).

> FYI: There are a few defines like this
> 
> #define FOO defined(CYG_FOO)
> 
> in lwipopts.h. Small testcase:
> 
> #define CYG_FOO 1
> #define FOO defined(CYG_FOO)
> 
> main ()
> {
>   int foo = FOO;
> }
> 
> It cannot be linked. FOO is not boolean ;-) I can check the same
> "rvalues" then and send a patch if you want.

As I have not used SNMP myself yet, it had to be expected that there are 
some issues left. If you can provide a patch that'd be great!

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

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [ECOS]How to run testprograms for lwip
  2009-07-23 12:25     ` Simon Kallweit
  2009-07-24 15:51       ` Robert Brusa
@ 2009-07-29 12:25       ` Sergei Gavrikov
  2009-07-29 12:32         ` Simon Kallweit
  1 sibling, 1 reply; 10+ messages in thread
From: Sergei Gavrikov @ 2009-07-29 12:25 UTC (permalink / raw)
  To: Simon Kallweit; +Cc: Bob.Brusa, MailingList:ecos-discuss ;

Simon Kallweit wrote:
> Well, I can't really help you with that. Also, it seems you are using 
> the current lwip port available in the CVS (or ecos 3.0). I have not 
> used that port, as it was rather dated, so I ported a newer lwip 
> version. You could try my port too, a snapshot is available:
> 
> http://download.westlicht.ch/lwip-20090722.tar.gz

Hi Simon,

Thank you for your contribution. I tried to built lwIP's with SNMP
support using your snapshot. Unfortunately, I ran in a problem with CPP
defines for eCos (lwipopts.h).

mib2.c:70:
#define SNMP_SYSSERVICES ((1 << 6) | (1 << 3) | ((IP_FORWARD) << 2))

mib2.c:766:
static const s32_t sysservices = SNMP_SYSSERVICES;

lwipopts.h:102:
#define IP_FORWARD                  defined(CYGFUN_LWIP_IP_FORWARD)

So, the above init will become itself:

static const s32_t sysservices = ((1 << 6) | (1 << 3) | ((defined(CYGFUN_LWIP_IP_FORWARD)) << 2))

May be the below should be used in lwipopts.h?

#if defined(CYGFUN_LWIP_IP_FORWARD)
# define IP_FORWARD 1
#else
# define IP_FORWARD 0
#endif

FYI: There are a few defines like this

#define FOO defined(CYG_FOO)

in lwipopts.h. Small testcase:

#define CYG_FOO 1
#define FOO defined(CYG_FOO)

main ()
{
  int foo = FOO;
}

It cannot be linked. FOO is not boolean ;-) I can check the same
"rvalues" then and send a patch if you want.

Regards,

Sergei

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

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [ECOS]How to run testprograms for lwip
  2009-07-23 12:25     ` Simon Kallweit
@ 2009-07-24 15:51       ` Robert Brusa
  2009-07-29 12:25       ` Sergei Gavrikov
  1 sibling, 0 replies; 10+ messages in thread
From: Robert Brusa @ 2009-07-24 15:51 UTC (permalink / raw)
  To: Simon Kallweit; +Cc: MailingList:ecos-discuss ;

On Thu, 23 Jul 2009 14:27:59 +0200, Simon Kallweit  
<simon.kallweit@intefo.ch> wrote:

> Robert Brusa wrote:
>> yes, I see some messages on ser1. It appears every few seconds, but I  
>> get the impression there is no answer comming back. I also hooked my PC  
>> to the LAN with wireshark and there as well, I see nothing originating  
>> from my board.
>
> What are the messages?
>
>> tcpecho: When attempting to connect to my board (where tcpecho is  
>> running) with telnet 192.168.0.222 I get the message
>>  telnet: Unable to connect to remote host: No route to host
>
> I guess you configured the IP address statically on your board. Please  
> make sure that the board is in the same network. For example, if you use  
> 192.168.1.0/24 as your network, you won't be able to ping 192.168.0.222  
> unless you have defined some routing or a separate IP address in the  
> 192.168.0.0/24 network.
>
>> I have the feeling its a hardware problem. The LEDs on the switch I am  
>> connected to with this board also remain dark all the time.
>
> Well, I can't really help you with that. Also, it seems you are using  
> the current lwip port available in the CVS (or ecos 3.0). I have not  
> used that port, as it was rather dated, so I ported a newer lwip  
> version. You could try my port too, a snapshot is available:
>
> http://download.westlicht.ch/lwip-20090722.tar.gz
>
> Simon


Hi Simon
Thanks for the link. I have downloaded the file and will check it out when  
I return from vacations - which start in a few minutes :-)
   Robert

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

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [ECOS]How to run testprograms for lwip
  2009-07-23 12:19   ` Robert Brusa
@ 2009-07-23 12:25     ` Simon Kallweit
  2009-07-24 15:51       ` Robert Brusa
  2009-07-29 12:25       ` Sergei Gavrikov
  0 siblings, 2 replies; 10+ messages in thread
From: Simon Kallweit @ 2009-07-23 12:25 UTC (permalink / raw)
  To: Bob.Brusa; +Cc: MailingList:ecos-discuss ;

Robert Brusa wrote:
> yes, I see some messages on ser1. It appears every few seconds, but I 
> get the impression there is no answer comming back. I also hooked my PC 
> to the LAN with wireshark and there as well, I see nothing originating 
> from my board.

What are the messages?

> tcpecho: When attempting to connect to my board (where tcpecho is 
> running) with telnet 192.168.0.222 I get the message
> 
> telnet: Unable to connect to remote host: No route to host

I guess you configured the IP address statically on your board. Please 
make sure that the board is in the same network. For example, if you use 
192.168.1.0/24 as your network, you won't be able to ping 192.168.0.222 
unless you have defined some routing or a separate IP address in the 
192.168.0.0/24 network.

> I have the feeling its a hardware problem. The LEDs on the switch I am 
> connected to with this board also remain dark all the time.

Well, I can't really help you with that. Also, it seems you are using 
the current lwip port available in the CVS (or ecos 3.0). I have not 
used that port, as it was rather dated, so I ported a newer lwip 
version. You could try my port too, a snapshot is available:

http://download.westlicht.ch/lwip-20090722.tar.gz

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

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [ECOS]How to run testprograms for lwip
  2009-07-23 10:02 ` Simon Kallweit
@ 2009-07-23 12:19   ` Robert Brusa
  2009-07-23 12:25     ` Simon Kallweit
  0 siblings, 1 reply; 10+ messages in thread
From: Robert Brusa @ 2009-07-23 12:19 UTC (permalink / raw)
  To: Simon Kallweit; +Cc: MailingList:ecos-discuss ;

On Thu, 23 Jul 2009 12:04:32 +0200, Simon Kallweit  
<simon.kallweit@intefo.ch> wrote:

> Robert Brusa wrote:
>> Hi
>> I have included the package lwip_tcpip in my library and now I want to  
>> run
>> the test programs that come with it. But how? Take e.g. tcpecho. I built
>> it using my library, then download it into my at91sam7x256-based board  
>> and
>> run it. Nothing happens. What should happen? What "special actions" am I
>> supposed to do? Thanks for help.
>
> Do you see any diagnostic output on the serial port?
>
> TCP echo test will simply echo everything that's sent to the open test  
> port. You can for example use telnet or netcat to send some strings to  
> the device and get the echo responses.
>
> Simon


Hi Simon
yes, I see some messages on ser1. It appears every few seconds, but I get  
the impression there is no answer comming back. I also hooked my PC to the  
LAN with wireshark and there as well, I see nothing originating from my  
board.

tcpecho: When attempting to connect to my board (where tcpecho is running)  
with telnet 192.168.0.222 I get the message

telnet: Unable to connect to remote host: No route to host

I have the feeling its a hardware problem. The LEDs on the switch I am  
connected to with this board also remain dark all the time.
    Robert

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

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [ECOS]How to run testprograms for lwip
  2009-07-23  9:50 Robert Brusa
@ 2009-07-23 10:02 ` Simon Kallweit
  2009-07-23 12:19   ` Robert Brusa
  0 siblings, 1 reply; 10+ messages in thread
From: Simon Kallweit @ 2009-07-23 10:02 UTC (permalink / raw)
  To: Bob.Brusa; +Cc: MailingList:ecos-discuss ;

Robert Brusa wrote:
> Hi
> I have included the package lwip_tcpip in my library and now I want to run
> the test programs that come with it. But how? Take e.g. tcpecho. I built
> it using my library, then download it into my at91sam7x256-based board and
> run it. Nothing happens. What should happen? What "special actions" am I
> supposed to do? Thanks for help.

Do you see any diagnostic output on the serial port?

TCP echo test will simply echo everything that's sent to the open test 
port. You can for example use telnet or netcat to send some strings to 
the device and get the echo responses.

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

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [ECOS]How to run testprograms for lwip
@ 2009-07-23  9:50 Robert Brusa
  2009-07-23 10:02 ` Simon Kallweit
  0 siblings, 1 reply; 10+ messages in thread
From: Robert Brusa @ 2009-07-23  9:50 UTC (permalink / raw)
  To: ecos-discuss

Hi
I have included the package lwip_tcpip in my library and now I want to run
the test programs that come with it. But how? Take e.g. tcpecho. I built
it using my library, then download it into my at91sam7x256-based board and
run it. Nothing happens. What should happen? What "special actions" am I
supposed to do? Thanks for help.
     Robert

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

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2009-07-30 11:11 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-07-30  9:11 [ECOS]How to run testprograms for lwip David Fernandez
2009-07-30 11:02 ` Sergei Gavrikov
2009-07-30 11:11   ` Simon Kallweit
  -- strict thread matches above, loose matches on Subject: below --
2009-07-23  9:50 Robert Brusa
2009-07-23 10:02 ` Simon Kallweit
2009-07-23 12:19   ` Robert Brusa
2009-07-23 12:25     ` Simon Kallweit
2009-07-24 15:51       ` Robert Brusa
2009-07-29 12:25       ` Sergei Gavrikov
2009-07-29 12:32         ` Simon Kallweit

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).