problem with -mstructure-size-boundary=8 and network stack

Joel Sherrill joel.sherrill at OARcorp.com
Sun Apr 29 15:10:30 UTC 2012


Changing the structure alignment rules from the default is a tar pit you don't want to enter lightly. You will be incompatible with the structures used in libc for one. You will have to build your own toolchain with the alignment options and then may still trip across code in odd places like drivers that break.

There is precedence in the community for doing this and we take patches but remember you need a toolchain built with libraries using this alignment. It will likely not change the alignment of malloc'ed memory, settings for preferred data element alignment or stack alignment.

Doable but can impact many places.

--joel

Gedare Bloom <gedare at rtems.org> wrote:

>Hi Jason,
>
>Apart from your problem, which it looks like Mick answered, I'd like
>to point out that the network stack in 4.10 is quite old. You can rig
>it to do what you need eventually, but its age sometimes shows.
>Current development is bringing an updated network stack to RTEMS in
>4.11.
>
>Unless you have a particular reason for using a release branch it's
>recommended to use the development head (i.e. 4.11 right now) for
>developing new BSPs.  Part of the reason is that new BSPs are not
>typically merged into release branches, so your work would eventually
>have to be forward-ported if you want to release it and have it
>maintained / available to others. Also the development branch tends to
>include many newer features and more up-to-date bug-fixes that can
>ease the pain of new development.
>
>Anyhow good luck!
>Gedare
>
>On Sun, Apr 29, 2012 at 6:38 AM, Mick Davis <mickd at goanna.iinet.net.au> wrote:
>> Hi
>>
>> You have to adjust the frames between your driver and the stack so that the
>> bytes after the ethernet header are word aligned.
>>
>> The size of the ethernet header is better defined by ETHER_HDR_LEN, there
>> could be alignment bytes included when using sizeof( struct ether_header )
>> that won't exist in the real data.
>>
>> Check a few of the existing network drivers, there are examples for these
>> issues.
>>
>> We've run RTEMS using both minimum alignments without problem once we got
>> our network driver fixed for these.
>>
>>
>> On 29/04/12 17:02, JIANGJason wrote:
>>>
>>>
>>> HI all,
>>> I am working on a porting of RTEMS 4.10.2(tried 4.9.4 also) to a
>>> S3C2440/CS8900 based SBC, and with problem to let the network stack to work.
>>>
>>> (1) If  -mstructure-size-boundary=8 is used, data abort will be occur at
>>> ip_input.c:400 (the problem code is listed below) when there is a IP packet
>>> incoming, such as ICMP, or any other. The
>>>
>>> ip_input.c:400
>>> if (IA_SIN(ia)->sin_addr.s_addr == ip->ip_dst.s_addr) goto ours;
>>>
>>> (1) If  -mstructure-size-boundary=32 is used, any IP packet out send is in
>>> abnormal format. and wireshark told me that the packet it captured are all
>>> "Bogus IP header length (0, must be at least 20)".
>>>
>>> I am not familiar with the IP stack itself, but it looks can not be easily
>>> solved by just change the compiling options. Anyone had the same problem
>>> before?
>>> ______________________
>>> Best Regards, Jason
>>>
>>>
>>> _______________________________________________
>>> rtems-users mailing list
>>> rtems-users at rtems.org
>>> http://www.rtems.org/mailman/listinfo/rtems-users
>>>
>>
>> --
>>
>> Mick Davis
>> Goanna Technologies Pty Ltd
>> +61 8 9444 2634
>>
>> _______________________________________________
>> rtems-users mailing list
>> rtems-users at rtems.org
>> http://www.rtems.org/mailman/listinfo/rtems-users
>
>_______________________________________________
>rtems-users mailing list
>rtems-users at rtems.org
>http://www.rtems.org/mailman/listinfo/rtems-users




More information about the users mailing list