public inbox for ecos-discuss@sourceware.org
 help / color / mirror / Atom feed
* [ECOS] Problems with application to use lwIP
@ 2007-10-12 10:33 Øyvind Harboe
  2007-10-12 12:26 ` Andrew Lunn
  0 siblings, 1 reply; 6+ messages in thread
From: Øyvind Harboe @ 2007-10-12 10:33 UTC (permalink / raw)
  To: eCos Discussion

I'm trying to use lwIP, but I run into problems because lwIP uses
macros, e.g. #define read(a,b,c), which screws things up. I've seen
some posts about people wishing for/thinking about making lwIP more
compatible with a "standard" eCos TCP/IP stack.

Rather than try to adapt the code that is going to use lwIP(it
currently uses eCos FreeBSD + POSIX) or changing lwIP, I was wondering
if I could somehow pull off the following:

- Use the standard include files from eCos instead of lwIP include
files so application continues to compile fine.
- Link w/lwIP only instead of trying to compile with it.

This would require adding a .c file that implemented functions that
used the lwIP include files and exported function calls that were
compatible with lwIP.

Any thoughts on this approach?

lwIP is attractive to us as it is small enough to fit into the fastest
RAM available for our project, we do have enough RAM for FreeBSD, but
it is dog slow as it needs to use DRAM instead of SRAM.

-- 
Øyvind Harboe
http://www.zylin.com - eCos ARM & FPGA  developer kit

--
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] 6+ messages in thread

* Re: [ECOS] Problems with application to use lwIP
  2007-10-12 10:33 [ECOS] Problems with application to use lwIP Øyvind Harboe
@ 2007-10-12 12:26 ` Andrew Lunn
  2007-10-12 20:08   ` Øyvind Harboe
  0 siblings, 1 reply; 6+ messages in thread
From: Andrew Lunn @ 2007-10-12 12:26 UTC (permalink / raw)
  To: ?yvind Harboe; +Cc: eCos Discussion

On Fri, Oct 12, 2007 at 12:33:44PM +0200, ?yvind Harboe wrote:
> I'm trying to use lwIP, but I run into problems because lwIP uses
> macros, e.g. #define read(a,b,c), which screws things up. I've seen
> some posts about people wishing for/thinking about making lwIP more
> compatible with a "standard" eCos TCP/IP stack.
> 
> Rather than try to adapt the code that is going to use lwIP(it
> currently uses eCos FreeBSD + POSIX) or changing lwIP, I was wondering
> if I could somehow pull off the following:
> 
> - Use the standard include files from eCos instead of lwIP include
> files so application continues to compile fine.
> - Link w/lwIP only instead of trying to compile with it.
> 
> This would require adding a .c file that implemented functions that
> used the lwIP include files and exported function calls that were
> compatible with lwIP.
> 
> Any thoughts on this approach?

I've had a quick look. Most of it is straight forward. There is a
couple of problem though....

lwip has no recvmsg and sendmsg function. The missing sendmsg is the
bigger problem because eCos maps all send functions to it. So your
wrapper will need to implement it on top of what lwip
provides. However i don't think this is a big problem. It looks like
you can implement the functions needed for struct cyg_sock_ops. 

Implementing select looks a bit trickier. You are probably going to
have to make the lwip implementation of select in
/net/lwip_tcpip/current/src/api/socket.c conditional compiled so you
can remove it. However i think the necessary calls backs are there to
make an eCos style select work.

Overall, i think it is feasible, but you won't really know until you
try to implement it. Then the real details will become clear.

    Andrew

-- 
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] 6+ messages in thread

* Re: [ECOS] Problems with application to use lwIP
  2007-10-12 12:26 ` Andrew Lunn
@ 2007-10-12 20:08   ` Øyvind Harboe
  2007-10-12 21:03     ` Andrew Lunn
  0 siblings, 1 reply; 6+ messages in thread
From: Øyvind Harboe @ 2007-10-12 20:08 UTC (permalink / raw)
  To: ?yvind Harboe, eCos Discussion

On 10/12/07, Andrew Lunn <andrew@lunn.ch> wrote:
> On Fri, Oct 12, 2007 at 12:33:44PM +0200, ?yvind Harboe wrote:

[stuff deleted]


So I take it the trick is to implement something equivalent to
freebsd_tcpip/current/src/sys/kern/sockio.c for lwIP then?


I've tinkered a bit w/lwIP & FreeBSD:

- net/common requires a lot of bits and bobs in terms of include files
to compile. It seems pretty incestious w/the TCP/IP stack.
- Working notes here: http://ecosforge.com/ecosforge/trunk/wip/lwip

-- 
Øyvind Harboe
http://www.zylin.com - eCos ARM & FPGA  developer kit

--
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] 6+ messages in thread

* Re: [ECOS] Problems with application to use lwIP
  2007-10-12 20:08   ` Øyvind Harboe
@ 2007-10-12 21:03     ` Andrew Lunn
  2007-10-13  7:50       ` Øyvind Harboe
  0 siblings, 1 reply; 6+ messages in thread
From: Andrew Lunn @ 2007-10-12 21:03 UTC (permalink / raw)
  To: ?yvind Harboe; +Cc: eCos Discussion

On Fri, Oct 12, 2007 at 10:08:00PM +0200, ?yvind Harboe wrote:
> On 10/12/07, Andrew Lunn <andrew@lunn.ch> wrote:
> > On Fri, Oct 12, 2007 at 12:33:44PM +0200, ?yvind Harboe wrote:
> 
> [stuff deleted]
> 
> 
> So I take it the trick is to implement something equivalent to
> freebsd_tcpip/current/src/sys/kern/sockio.c for lwIP then?

Correct.

> I've tinkered a bit w/lwIP & FreeBSD:
> 
> - net/common requires a lot of bits and bobs in terms of include files
> to compile. It seems pretty incestious w/the TCP/IP stack.

Do you actually need net/common?

   Andrew

-- 
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] 6+ messages in thread

* Re: [ECOS] Problems with application to use lwIP
  2007-10-12 21:03     ` Andrew Lunn
@ 2007-10-13  7:50       ` Øyvind Harboe
  2007-10-13 15:06         ` Andrew Lunn
  0 siblings, 1 reply; 6+ messages in thread
From: Øyvind Harboe @ 2007-10-13  7:50 UTC (permalink / raw)
  To: ?yvind Harboe, eCos Discussion

[-- Attachment #1: Type: text/plain, Size: 942 bytes --]

On 10/12/07, Andrew Lunn <andrew@lunn.ch> wrote:
> On Fri, Oct 12, 2007 at 10:08:00PM +0200, ?yvind Harboe wrote:
> > On 10/12/07, Andrew Lunn <andrew@lunn.ch> wrote:
> > > On Fri, Oct 12, 2007 at 12:33:44PM +0200, ?yvind Harboe wrote:
> >
> > [stuff deleted]
> >
> >
> > So I take it the trick is to implement something equivalent to
> > freebsd_tcpip/current/src/sys/kern/sockio.c for lwIP then?
>
> Correct.

I'll read up on it.

Non-sequitor: I haven't read up on io/eth, but couldn't make it
compile w/lwIP without attached patch.



>
> > I've tinkered a bit w/lwIP & FreeBSD:
> >
> > - net/common requires a lot of bits and bobs in terms of include files
> > to compile. It seems pretty incestious w/the TCP/IP stack.
>
> Do you actually need net/common?

That's where tftpd is.

Perhaps tftpd does not belong in net/common?


-- 
Øyvind Harboe
http://www.zylin.com - eCos ARM & FPGA  developer kit

[-- Attachment #2: stadalonelwip.txt --]
[-- Type: text/plain, Size: 808 bytes --]

### Eclipse Workspace Patch 1.0
#P ecos
Index: io/eth/current/cdl/eth_drivers.cdl
===================================================================
RCS file: /cvs/ecos/ecos/packages/io/eth/current/cdl/eth_drivers.cdl,v
retrieving revision 1.20
diff -u -r1.20 eth_drivers.cdl
--- io/eth/current/cdl/eth_drivers.cdl	20 Mar 2003 15:44:39 -0000	1.20
+++ io/eth/current/cdl/eth_drivers.cdl	13 Oct 2007 07:46:13 -0000
@@ -174,7 +174,7 @@
     cdl_component CYGPKG_IO_ETH_DRIVERS_STAND_ALONE {
         display       "Support for stand-alone network stack."
         flavor        bool
-        active_if     !CYGPKG_NET
+        active_if     !CYGPKG_NET&&!CYGPKG_NET_LWIP
         requires      CYGINT_ISO_STRING_MEMFUNCS 
         default_value 1
         compile       stand_alone/eth_drv.c

[-- Attachment #3: Type: text/plain, Size: 148 bytes --]

-- 
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] 6+ messages in thread

* Re: [ECOS] Problems with application to use lwIP
  2007-10-13  7:50       ` Øyvind Harboe
@ 2007-10-13 15:06         ` Andrew Lunn
  0 siblings, 0 replies; 6+ messages in thread
From: Andrew Lunn @ 2007-10-13 15:06 UTC (permalink / raw)
  To: ?yvind Harboe; +Cc: eCos Discussion

> > Do you actually need net/common?
> 
> That's where tftpd is.
> 
> Perhaps tftpd does not belong in net/common?

Or you want to add cdl so you can compile individual parts.

> Index: io/eth/current/cdl/eth_drivers.cdl
> ===================================================================
> RCS file: /cvs/ecos/ecos/packages/io/eth/current/cdl/eth_drivers.cdl,v
> retrieving revision 1.20
> diff -u -r1.20 eth_drivers.cdl
> --- io/eth/current/cdl/eth_drivers.cdl	20 Mar 2003 15:44:39 -0000	1.20
> +++ io/eth/current/cdl/eth_drivers.cdl	13 Oct 2007 07:46:13 -0000
> @@ -174,7 +174,7 @@
>      cdl_component CYGPKG_IO_ETH_DRIVERS_STAND_ALONE {
>          display       "Support for stand-alone network stack."
>          flavor        bool
> -        active_if     !CYGPKG_NET
> +        active_if     !CYGPKG_NET&&!CYGPKG_NET_LWIP
>          requires      CYGINT_ISO_STRING_MEMFUNCS 
>          default_value 1
>          compile       stand_alone/eth_drv.c

My first feeling, without looking at the code, is that this is
wrong. lwip does compile with Ethernet drivers the last time i
tried...

        Andrew

-- 
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] 6+ messages in thread

end of thread, other threads:[~2007-10-13 15:06 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-10-12 10:33 [ECOS] Problems with application to use lwIP Øyvind Harboe
2007-10-12 12:26 ` Andrew Lunn
2007-10-12 20:08   ` Øyvind Harboe
2007-10-12 21:03     ` Andrew Lunn
2007-10-13  7:50       ` Øyvind Harboe
2007-10-13 15:06         ` Andrew Lunn

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).