This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

RM48HDK平台CCS结构体字节对齐总是咨询

硬件平台:RM48HDK  软件平台:5.4.0.00091  编译器:TI V5.0.6

我在程序中想对一个结构体增加单字节对齐属性,增加方式如下:

1、参照《ARM Optimizing C-C++ Compiler v5.1 User's Guide.pdf》,96页

#pragma PACK (1)

struct BootSec

{  

  unsigned char    BS_jmpBoot[3]; 

...

 };

编译报错: #163-D unrecognized #pragma 

2、参照《ARM Optimizing C-C++ Compiler v5.1 User's Guide.pdf》,117页

struct __attribute__((__packed__)) BootSec

  unsigned char    BS_jmpBoot[3];

...

};

编译报错:Type #237 variable "__packed__" was declared with a never-completed type

3、参照《ARM Optimizing C-C++ Compiler v5.1 User's Guide.pdf》,31页

在编译选项里将--align_structs设置为1了,但是实际运行效果发现此结构体并未以字节方式对齐

上面三种方式皆无法实现,难道我参考的PDF文件说法错误,请告知有效的实现方式,谢谢!