DSPRelated.com
Forums

C54X C structure packing

Started by John December 10, 2009
Anyone know how to force the C54X C compiler to pack C structures with
short and long types?

Thanks,

John
John wrote:
> Anyone know how to force the C54X C compiler to pack C structures with > short and long types? > > Thanks, > > John
See if is supports this: http://publib.boulder.ibm.com/infocenter/macxhelp/v6v81/index.jsp?topic=/com.ibm.vacpp6m.doc/compiler/ref/rnpgpack.htm -- Les Cargill
John <sampson164@gmail.com> writes:

> Anyone know how to force the C54X C compiler to pack C structures with > short and long types?
In gcc there is a -fpack-struct compiler option. Seems like there was something similar in the TI codegen tools - perhaps a PRAGMA? -- Randy Yates % "She has an IQ of 1001, she has a jumpsuit Digital Signal Labs % on, and she's also a telephone." mailto://yates@ieee.org % http://www.digitalsignallabs.com % 'Yours Truly, 2095', *Time*, ELO
On Dec 10, 7:29&#4294967295;pm, Les Cargill <lcargil...@comcast.net> wrote:
> John wrote: > > Anyone know how to force the C54X C compiler to pack C structures with > > short and long types? > > > Thanks, > > > John > > See if is supports this:http://publib.boulder.ibm.com/infocenter/macxhelp/v6v81/index.jsp?top... > > -- > Les Cargill
Nope
On Dec 10, 8:26&#4294967295;pm, Randy Yates <ya...@ieee.org> wrote:
> John <sampson...@gmail.com> writes: > > Anyone know how to force the C54X C compiler to pack C structures with > > short and long types? > > In gcc there is a -fpack-struct compiler option. Seems like there was > something similar in the TI codegen tools - perhaps a PRAGMA? > -- > Randy Yates &#4294967295; &#4294967295; &#4294967295; &#4294967295; &#4294967295; &#4294967295; &#4294967295; &#4294967295; &#4294967295; &#4294967295; &#4294967295;% "She has an IQ of 1001, she has a jumpsuit > Digital Signal Labs &#4294967295; &#4294967295; &#4294967295; &#4294967295; &#4294967295; &#4294967295; &#4294967295;% &#4294967295; &#4294967295; &#4294967295; &#4294967295; &#4294967295; &#4294967295;on, and she's also a telephone." > mailto://ya...@ieee.org &#4294967295; &#4294967295; &#4294967295; &#4294967295; &#4294967295;%http://www.digitalsignallabs.com% &#4294967295; &#4294967295; &#4294967295; &#4294967295;'Yours Truly, 2095', *Time*, ELO &#4294967295;
I have searched the TI docs for that. John
John wrote:
> On Dec 10, 7:29 pm, Les Cargill <lcargil...@comcast.net> wrote: >> John wrote: >>> Anyone know how to force the C54X C compiler to pack C structures with >>> short and long types? >>> Thanks, >>> John >> See if is supports this:http://publib.boulder.ibm.com/infocenter/macxhelp/v6v81/index.jsp?top... >> >> -- >> Les Cargill > > Nope
Bummer. Check to see what it does - I bet it packs 'em on 16 bit boundaries - iow: typedef struct { unsigned char a; unsigned char b; long c; } magilla; would result in the offset of "c" being two machine words to the right of the start of struct. I simply don't remember any more, it's been too long. Oh, if they'd only defined the behavior of bit fields in 'C', the world would be a much better place. -- Les Cargill
John <sampson164@gmail.com> writes:

> Anyone know how to force the C54X C compiler to pack C structures with > short and long types?
John, The minimum addressable unit of the 54x is 16 bits! (Doh!) -- Randy Yates % "Though you ride on the wheels of tomorrow, Digital Signal Labs % you still wander the fields of your mailto://yates@ieee.org % sorrow." http://www.digitalsignallabs.com % '21st Century Man', *Time*, ELO
Randy Yates <yates@ieee.org> writes:

> John <sampson164@gmail.com> writes: > >> Anyone know how to force the C54X C compiler to pack C structures with >> short and long types? > > John, > > The minimum addressable unit of the 54x is 16 bits! (Doh!)
Wups. Never mind.... -- Randy Yates % "So now it's getting late, Digital Signal Labs % and those who hesitate mailto://yates@ieee.org % got no one..." http://www.digitalsignallabs.com % 'Waterfall', *Face The Music*, ELO
Randy Yates  <yates@ieee.org> wrote:

>The minimum addressable unit of the 54x is 16 bits! (Doh!)
Whoa. A clear example of an engineer issuing a spec before 10:00 a.m., and/or without his morning coffee. Steve

John wrote:
> Anyone know how to force the C54X C compiler to pack C structures with > short and long types?
Roll your own convertor of a structure to an array of bytes and back; with explicit conversion of each of the fields. This solves usual problem with packing and alignment. VLV