For what you are trying to do it sounds like you are really looking for a '#pragma pack' directive, which does not exist within the TI code generation tools, which means there is not a way to override the default byte padding that goes into such structures that I am aware of.

Alex

I tried two pragma directives:

    1. #pragma STRUCT_ALIGN(MyStructType, 1)

    2. #pragma DATA_ALIGN(S1, 1)

But sizeof(S1) remains 12 (I expect to get 7)

These pragmas are for aligning the entire object to a particular boundary in memory, they do not impact the content of the object, just what address it starts at. Note that setting an alignment of 1 means it is going to align to a single byte boundary which is the minimal addressable unit size for C6x devices already, so it effectively does nothing.

上面为我在TI社区摘取的部分内容,关于pragma STRUCT_ALIGN 和pragma pack,TI 工程师已清晰描述pragma STRUCT_ALIGN和pragma DATA_ALIGN的作用,即do not impact the content of the object, just what address it starts at,只影响存放地址,并不影响结构内容和大小。而影响结构大小的是pragma pack。