Hello,
I want to use a "packed" attribute for struct type. The manual (compiler version 4.4) says that it support variaous attributes.
but i faces below error message( gcc option is enabled).
struct __attribute__((__packed__)) test{ char c1; int t; };
--.> error : invalid atttibute for "struct test"
Another attriutes such asaligned or deprecated don't have any issue. Only "parked" attribute has the error.
How can I slove it?
Thank you.
----- dev environment-----
ccs 5.x
compiler v4.4
DSP : C55x
--------------- from compiler version 4.4----------------
5.14.4 T ype Attributes The following type attributes are supported: aligned, deprecated, packed, transparent_union, and unused. Members of a packed structure are stored as closely to each other as possible, omitting additional bytes of padding usually added to preserve word-alignment. For example, assuming a word-size of 4 bytes ordinarily has 3 bytes of padding between members c1 and i, and another 3 bytes of trailing padding after member c2, leading to a total size of 12 bytes: struct unpacked_struct { char c1; int i; char c2;}; However, the members of a packed struct are byte-aligned. Thus the following does not have any bytes of padding between or after members and totals 6 bytes: struct __attribute__((__packed__)) packed_struct { char c1; int i; char c2; }; Subsequently, packed structures in an array are packed together without trailing padding between array elements.