This is the mail archive of the
ecos-discuss@sources.redhat.com
mailing list for the eCos project.
Re: Network programming for eCos under linux
- To: "Trenton D. Adams" <tadams at theone dot dnsalias dot com>
- Subject: Re: [ECOS] Network programming for eCos under linux
- From: Grant Edwards <grante at visi dot com>
- Date: Wed, 8 Aug 2001 10:11:14 -0500
- Cc: 'Andrew Lunn' <andrew dot lunn at ascom dot ch>,'eCos Discussion' <ecos-discuss at sourceware dot cygnus dot com>
- References: <20010808093506.B3658@biferten.ma.tech.ascom.ch> <000901c1201a$5c7e1590$090110ac@TRENT>
On Wed, Aug 08, 2001 at 08:56:52AM -0600, Trenton D. Adams wrote:
> > Watch out for endianness issues. i386 linux is little endian.
> > Whats the endianness of your target? Things like this affects
> > network code.
>
> This shouldn't pose a problem since I've configured my ARM as
> little-endian. However, htons (), htonl (), etc should solve that
> problem anyhow, shouldn't it? I mean as far networking code goes that
> is. I would obviously have to be careful about data types between the
> two if they were different. It's nice to have the ARM with 32-bit
> little-endian! Makes my life a lot easier since I'm sending data to a
> PC.
You're headed for trouble. I work on software where the author
"knew" data was being sent from one little endian machine to
another over the network. Unfortunately one of the ends is now
big-endian, and it's now a royal PITA to maintain this stuff.
Unfortunalyte there aren't standard host-to-little-endian and
little-endian-to-host macros.
> What about threads? How do those work under Linux? Are they similar at
> all?
The set of mechanisms is similar, but the details are
different. For example, roughly the same set of calls to
synchronize threads exists, but the data types and calling
conventions are different.
If you only use a small set of features, wrapping the Linux
calls to make them look like eCos calls would be a viable
option. An eCos emulator that runs on top of one of the
popular Unix threading libraries would be an interesting
project. You couldn't accurately emulate the scheduling
algorithm, but for some applications it could be useful.
--
Grant Edwards
grante@visi.com