Little Endian ARM fails on 1st TCP datagram

Ralf Corsepius ralf.corsepius at
Mon Aug 18 06:29:55 UTC 2008

On Sun, 2008-08-17 at 23:49 -0400, Gene Smith wrote:
> I am trying to bring up a new ARM bsp. ARP is working but when any TCP 
> packet comes in it is dropped. With netdemo I see a TCP error:
> "Bad offset in TCP header"
> This is referring to the 4 bit header length field in the TCP header. 
> Looking at the code with that parses this field, it either assumes big 
> or little endian, depending on a BYTE_ORDER macro. It seems to be 
> looking at it as big endian but my processor is definitely little.
> I am not sure where this is actually set. Looking around, it seems to 
> depend on a defined value __ARMEL__ or __ARMEB__ which I can't find 
> defined anywhere in the RTEMS tree.
GCC defines these internally, depending upon the cflags being passed to it.

[Current arm-rtems-gcc supports little endian only.]

> I did find a couple of mailing list threads that mention what seems like 
> this problem, such as this:
> But it clains it is fixed in newlib-1.13 and rtems4.8 uses 1.15.
Well, actually this newlib issue is not related to your issue with the
RTEMS toolchains, because this file is doesn't exist (and thus is not
being used by RTEMS) in RTEMS newlib.

>  So I am 
> not sure if the problem has come back or was never really fixed or I am 
> doing something else wrong.
Are you using the rpms or a home-grown toolchain? The symptoms you
describe could be related to you using a vanilla newlib without RTEMS


More information about the users mailing list