TI中文支持网
TI专业的中文技术问题搜集分享网站

CCS6.1版本C2000编译器28377D器件无法支持__attribute__问题,移植EtherCAT从站代码,无法编译成功

CCS版本:6.1

DSP:28377D

问题:移植EtherCAT从站代码,代码中带有巨多的__attribute__((aligned(1), packed))宏定义,在CCS6.1上也勾选了GCC选项(Build->advanced options->language options->enable support for gcc externsions),重新编译后仍旧存在如下提示:

\EtherCAT\include\esc.h", line 167: error #1167: invalid attribute for "struct <unnamed>"

难道C2000不支持__attribute__编译么??

10#:

可以把167行附近的代码都贴出来看一下吗?另外,编译器版本是多少?

CCS版本:6.1

DSP:28377D

问题:移植EtherCAT从站代码,代码中带有巨多的__attribute__((aligned(1), packed))宏定义,在CCS6.1上也勾选了GCC选项(Build->advanced options->language options->enable support for gcc externsions),重新编译后仍旧存在如下提示:

\EtherCAT\include\esc.h", line 167: error #1167: invalid attribute for "struct <unnamed>"

难道C2000不支持__attribute__编译么??

andy sun:

回复 10#:

代码如下:

/** STRUCT_PACKED_START: Is defined before the typedef struct construct to pack the generic structures if necessary */#ifndef STRUCT_PACKED_START#define STRUCT_PACKED_START #endif

/** STRUCT_PACKED_END: Is defined after the typedef struct {} construct to pack the generic structures if necessary */#ifndef STRUCT_PACKED_END#define STRUCT_PACKED_END __attribute__((aligned(1), packed))#endif

typedef struct STRUCT_PACKED_START{ UINT32 AddressLength; /**< \brief Address and Length*/#define SM_ADDRESS_MASK 0x0000FFFF /**< \brief Address mask*/#define SM_LENGTH_MASK 0xFFFF0000 /**< \brief Length mask*/#define SM_LENGTH_SHIFT 16 /**< \brief Length shift*/

UINT32 Settings[1]; /**< \brief Register values 0x0804 : 0x0807*/

/*Defines to access :* – SM Control register 0x0804* – SM Status register 0x0805* – SM Active register 0x0806* – SM PDI Control register 0x0807** all defines are based on 0x0804*/

/*SyncManger control (0x0804) access*/#define SM_SETTING_CONTROL_OFFSET 0 /**< \brief Offset to value of register 0x0804*/#define SM_SETTING_ACTIVATE_OFFSET 0 /**< \brief Offset to value of register 0x0806*/#define SM_SETTING_CONTROL_MASK 0x0000FFFF /**< \brief Mask to get all SyncManager control values*/#define SM_SETTING_MODE_MASK 0x00000002 /**< \brief SyncManager mode mask*/#define SM_SETTING_MODE_THREE_BUFFER_VALUE 0x00000000 /**< \brief SyncManager 3Buffer mode value*/#define SM_SETTING_MODE_ONE_BUFFER_VALUE 0x00000002 /**< \brief SyncManager 1Buffer mode value*/#define SM_SETTING_DIRECTION_MASK 0x0000000C /**< \brief SyncManager direction mask*/#define SM_SETTING_DIRECTION_READ_VALUE 0x00000000 /**< \brief SyncManager read direction*/#define SM_SETTING_DIRECTION_WRITE_VALUE 0x00000004 /**< \brief SyncManager write direction*/#define SM_SETTING_WATCHDOG_VALUE 0x00000040 /**< \brief SyncManager watchdog value*//*SyncManger status (0x0805) access*/#define SM_STATUS_MBX_BUFFER_FULL 0x00000800 /**< \brief Indicates in one buffer mode if buffer was completely written*/

/*SyncManger activate (0x0806) access*/#define SM_SETTING_ENABLE_VALUE 0x00010000 /**< \brief SyncManager enable value*/#define SM_SETTING_ENABLE_SHIFT 16 /**< \brief SyncManager enable shift*/#define SM_SETTING_REPAET_REQ_MASK 0x00020000 /**< \brief SyncManager repeat request mask*/#define SM_SETTING_REPEAT_REQ_SHIFT 16 /**< \brief SyncManager repeat request shift*/

/*SyncManger PDI Control (0x0807) access*/#define SM_SETTING_PDI_DISABLE 0x01000000 /**< \brief Bit0 of register 0x0807 (if 1 SM is disabled from PDI)*/#define SM_SETTING_REPEAT_ACK 0x02000000 /**< \brief Bit1 of register 0x0807*/

}STRUCT_PACKED_ENDTSYNCMAN;

编译器版本:C2800 Compiler Tools 6.4.2 

                       C/C++ GCC Cross Compiler Support  8.5.0.201409172108

CCS版本:6.1

DSP:28377D

问题:移植EtherCAT从站代码,代码中带有巨多的__attribute__((aligned(1), packed))宏定义,在CCS6.1上也勾选了GCC选项(Build->advanced options->language options->enable support for gcc externsions),重新编译后仍旧存在如下提示:

\EtherCAT\include\esc.h", line 167: error #1167: invalid attribute for "struct <unnamed>"

难道C2000不支持__attribute__编译么??

10#:

回复 andy sun:

具体哪一行是176行呢?要将报错信息与相应的代码对应起来呀。

CCS版本:6.1

DSP:28377D

问题:移植EtherCAT从站代码,代码中带有巨多的__attribute__((aligned(1), packed))宏定义,在CCS6.1上也勾选了GCC选项(Build->advanced options->language options->enable support for gcc externsions),重新编译后仍旧存在如下提示:

\EtherCAT\include\esc.h", line 167: error #1167: invalid attribute for "struct <unnamed>"

难道C2000不支持__attribute__编译么??

andy sun:

回复 10#:

}STRUCT_PACKED_END  <—- 176行

CCS版本:6.1

DSP:28377D

问题:移植EtherCAT从站代码,代码中带有巨多的__attribute__((aligned(1), packed))宏定义,在CCS6.1上也勾选了GCC选项(Build->advanced options->language options->enable support for gcc externsions),重新编译后仍旧存在如下提示:

\EtherCAT\include\esc.h", line 167: error #1167: invalid attribute for "struct <unnamed>"

难道C2000不支持__attribute__编译么??

10#:

回复 andy sun:

OK, C2000不支持单字节对齐,请参考这个帖子最后两个回复:

http://www.deyisupport.com/question_answer/microcontrollers/c2000/f/56/t/108961.aspx

CCS版本:6.1

DSP:28377D

问题:移植EtherCAT从站代码,代码中带有巨多的__attribute__((aligned(1), packed))宏定义,在CCS6.1上也勾选了GCC选项(Build->advanced options->language options->enable support for gcc externsions),重新编译后仍旧存在如下提示:

\EtherCAT\include\esc.h", line 167: error #1167: invalid attribute for "struct <unnamed>"

难道C2000不支持__attribute__编译么??

CAI DANSE:

回复 andy sun:

兄弟,解决没有?我也遇到同样的问题。

CCS版本:6.1

DSP:28377D

问题:移植EtherCAT从站代码,代码中带有巨多的__attribute__((aligned(1), packed))宏定义,在CCS6.1上也勾选了GCC选项(Build->advanced options->language options->enable support for gcc externsions),重新编译后仍旧存在如下提示:

\EtherCAT\include\esc.h", line 167: error #1167: invalid attribute for "struct <unnamed>"

难道C2000不支持__attribute__编译么??

lei qin37:

回复 CAI DANSE:

同遇到这问题,题主可以说下解决方案吗? 您的帮助是我们学习前进的巨大动力啊,哈哈

赞(0)
未经允许不得转载:TI中文支持网 » CCS6.1版本C2000编译器28377D器件无法支持__attribute__问题,移植EtherCAT从站代码,无法编译成功
分享到: 更多 (0)