[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [lwip-users] Problem With dns.c Using 32-Bit Compilers
From: |
Jonathan Larmour |
Subject: |
Re: [lwip-users] Problem With dns.c Using 32-Bit Compilers |
Date: |
Fri, 18 Jan 2008 14:32:22 +0000 |
User-agent: |
Thunderbird 1.5.0.12 (X11/20070530) |
Nicolas Pinault wrote:
> John Keil a écrit :
>>
>> Unfortunately, TI's compiler does not support any kind of structure packing
>> for their C6000 DSP's (no #pragma pack, or anything similar). This is
>> always a bit of a headache when interfacing to other devices, but
>> fortunately hasn't caused us too many problems with lwIP. In fact, the
>> dns.c file is one of the few we have to modify (there are also overlays of
>> 32-bit structures made on non-32-bit aligned arrays in dns.c, which don't
>> work for us).
I'm surprised you don't have trouble elsewhere in lwIP since structure
packing is used extensively in core structures!
> The problem with these DSP is that whatever the size of the operand, (8,
> 16 or 32 bits), the compiler allways use 32bit "accesses". This is due
> to the fact that these DSPs can manipulate only 32bit registers. Memory
> accesses are also only 32bit accesses.
Despite the optimal width of memory accesses the C6x does support a load
byte (ldb) instruction (very possibly implemented in silicon as a 32-bit
read with a mask and shift to cope with the memory access constraints).
Either way, it doesn't prevent a compiler supporting a packed structure and
knowing it will have to assume it and all its members are potentially
unaligned.
Jifl
--
eCosCentric Limited http://www.eCosCentric.com/ The eCos experts
Barnwell House, Barnwell Drive, Cambridge, UK. Tel: +44 1223 245571
Registered in England and Wales: Reg No 4422071.
------["Si fractum non sit, noli id reficere"]------ Opinions==mine