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

我用的是F28377s,官网下载的controlSUIT,底层驱动从里面调用的,按道理用没有错误,但是编译之后出现了如下错误,希望熟悉F28X系列的大佬指点一下,谢谢!

Problem:

Description Resource Path Location Type
#20 identifier "CanaRegs" is undefined F2837xS_can.c /My_test/drv/source line 32 C/C++ Problem

F2837XS_can.c中的代码:

……

CanaRegs.CAN_CTL.bit.Init = 1;  //这句报错!

……

F2837XS_Can_defines.h中的代码:

#define CAN_CTL_INIT 0x00000001 // Initialization
#define CAN_CTL_IE0 0x00000002 // Interrupt Enable 0
#define CAN_CTL_SIE 0x00000004 // Status Interrupt Enable
#define CAN_CTL_EIE 0x00000008 // Error Interrupt Enable
#define CAN_CTL_DAR 0x00000020 // Disable Automatic-Retransmission
#define CAN_CTL_CCE 0x00000040 // Configuration Change Enable
#define CAN_CTL_TEST 0x00000080 // Test Mode Enable
#define CAN_CTL_IDS 0x00000100 // Interruption Debug Support Enable
#define CAN_CTL_ABO 0x00000200 // Auto-Bus On Enable
#define CAN_CTL_PMD_S 10
#define CAN_CTL_PMD_M 0x00003C00 // Parity/SECDED Enable
#define CAN_CTL_SWR 0x00008000 // Software Reset Enable
#define CAN_CTL_INITDBG 0x00010000 // Debug Mode Status
#define CAN_CTL_IE1 0x00020000 // Interrupt Enable 1
#define CAN_CTL_PDR 0x01000000 // Power Down Mode Request
#define CAN_CTL_WUBA 0x02000000 // Wake Up on Bus Activity

应该已经定义了啊,为什么错误显示未定义?

Seven Han:是缺少F2837xS_can.h么。

Problem:

Description Resource Path Location Type
#20 identifier "CanaRegs" is undefined F2837xS_can.c /My_test/drv/source line 32 C/C++ Problem

F2837XS_can.c中的代码:

……

CanaRegs.CAN_CTL.bit.Init = 1;  //这句报错!

……

F2837XS_Can_defines.h中的代码:

#define CAN_CTL_INIT 0x00000001 // Initialization
#define CAN_CTL_IE0 0x00000002 // Interrupt Enable 0
#define CAN_CTL_SIE 0x00000004 // Status Interrupt Enable
#define CAN_CTL_EIE 0x00000008 // Error Interrupt Enable
#define CAN_CTL_DAR 0x00000020 // Disable Automatic-Retransmission
#define CAN_CTL_CCE 0x00000040 // Configuration Change Enable
#define CAN_CTL_TEST 0x00000080 // Test Mode Enable
#define CAN_CTL_IDS 0x00000100 // Interruption Debug Support Enable
#define CAN_CTL_ABO 0x00000200 // Auto-Bus On Enable
#define CAN_CTL_PMD_S 10
#define CAN_CTL_PMD_M 0x00003C00 // Parity/SECDED Enable
#define CAN_CTL_SWR 0x00008000 // Software Reset Enable
#define CAN_CTL_INITDBG 0x00010000 // Debug Mode Status
#define CAN_CTL_IE1 0x00020000 // Interrupt Enable 1
#define CAN_CTL_PDR 0x01000000 // Power Down Mode Request
#define CAN_CTL_WUBA 0x02000000 // Wake Up on Bus Activity

应该已经定义了啊,为什么错误显示未定义?

mangui zhang:直接打开CCS导入controlSUITE里面的工程编译看看应该没有错
你这个是不是拷贝到其他地方了导致库文件找不见了
可以将相关文件拷贝到你的工程下然后在工程属性下设计搜索路径

Problem:

Description Resource Path Location Type
#20 identifier "CanaRegs" is undefined F2837xS_can.c /My_test/drv/source line 32 C/C++ Problem

F2837XS_can.c中的代码:

……

CanaRegs.CAN_CTL.bit.Init = 1;  //这句报错!

……

F2837XS_Can_defines.h中的代码:

#define CAN_CTL_INIT 0x00000001 // Initialization
#define CAN_CTL_IE0 0x00000002 // Interrupt Enable 0
#define CAN_CTL_SIE 0x00000004 // Status Interrupt Enable
#define CAN_CTL_EIE 0x00000008 // Error Interrupt Enable
#define CAN_CTL_DAR 0x00000020 // Disable Automatic-Retransmission
#define CAN_CTL_CCE 0x00000040 // Configuration Change Enable
#define CAN_CTL_TEST 0x00000080 // Test Mode Enable
#define CAN_CTL_IDS 0x00000100 // Interruption Debug Support Enable
#define CAN_CTL_ABO 0x00000200 // Auto-Bus On Enable
#define CAN_CTL_PMD_S 10
#define CAN_CTL_PMD_M 0x00003C00 // Parity/SECDED Enable
#define CAN_CTL_SWR 0x00008000 // Software Reset Enable
#define CAN_CTL_INITDBG 0x00010000 // Debug Mode Status
#define CAN_CTL_IE1 0x00020000 // Interrupt Enable 1
#define CAN_CTL_PDR 0x01000000 // Power Down Mode Request
#define CAN_CTL_WUBA 0x02000000 // Wake Up on Bus Activity

应该已经定义了啊,为什么错误显示未定义?

Young Hu:

回复 mangui zhang:

#define CAN_CTL_INIT 0x00000001 // Initialization
#define CAN_CTL_IE0 0x00000002 // Interrupt Enable 0
#define CAN_CTL_SIE 0x00000004 // Status Interrupt Enable
#define CAN_CTL_EIE 0x00000008 // Error Interrupt Enable
#define CAN_CTL_DAR 0x00000020 // Disable Automatic-Retransmission
#define CAN_CTL_CCE 0x00000040 // Configuration Change Enable
#define CAN_CTL_TEST 0x00000080 // Test Mode Enable
#define CAN_CTL_IDS 0x00000100 // Interruption Debug Support Enable
#define CAN_CTL_ABO 0x00000200 // Auto-Bus On Enable
#define CAN_CTL_PMD_S 10
#define CAN_CTL_PMD_M 0x00003C00 // Parity/SECDED Enable
#define CAN_CTL_SWR 0x00008000 // Software Reset Enable
#define CAN_CTL_INITDBG 0x00010000 // Debug Mode Status
#define CAN_CTL_IE1 0x00020000 // Interrupt Enable 1
#define CAN_CTL_PDR 0x01000000 // Power Down Mode Request
#define CAN_CTL_WUBA 0x02000000 // Wake Up on Bus Activity
这个是宏定义,与CanaRegs结构体没有任何关系。
打开例程试试吧

Problem:

Description Resource Path Location Type
#20 identifier "CanaRegs" is undefined F2837xS_can.c /My_test/drv/source line 32 C/C++ Problem

F2837XS_can.c中的代码:

……

CanaRegs.CAN_CTL.bit.Init = 1;  //这句报错!

……

F2837XS_Can_defines.h中的代码:

#define CAN_CTL_INIT 0x00000001 // Initialization
#define CAN_CTL_IE0 0x00000002 // Interrupt Enable 0
#define CAN_CTL_SIE 0x00000004 // Status Interrupt Enable
#define CAN_CTL_EIE 0x00000008 // Error Interrupt Enable
#define CAN_CTL_DAR 0x00000020 // Disable Automatic-Retransmission
#define CAN_CTL_CCE 0x00000040 // Configuration Change Enable
#define CAN_CTL_TEST 0x00000080 // Test Mode Enable
#define CAN_CTL_IDS 0x00000100 // Interruption Debug Support Enable
#define CAN_CTL_ABO 0x00000200 // Auto-Bus On Enable
#define CAN_CTL_PMD_S 10
#define CAN_CTL_PMD_M 0x00003C00 // Parity/SECDED Enable
#define CAN_CTL_SWR 0x00008000 // Software Reset Enable
#define CAN_CTL_INITDBG 0x00010000 // Debug Mode Status
#define CAN_CTL_IE1 0x00020000 // Interrupt Enable 1
#define CAN_CTL_PDR 0x01000000 // Power Down Mode Request
#define CAN_CTL_WUBA 0x02000000 // Wake Up on Bus Activity

应该已经定义了啊,为什么错误显示未定义?

mangui zhang:

回复 Young Hu:

他说报错的是这句CanaRegs.CAN_CTL.bit.Init = 1;//这句报错!
建议在工程中敲这句配置看看能否自动补全

Problem:

Description Resource Path Location Type
#20 identifier "CanaRegs" is undefined F2837xS_can.c /My_test/drv/source line 32 C/C++ Problem

F2837XS_can.c中的代码:

……

CanaRegs.CAN_CTL.bit.Init = 1;  //这句报错!

……

F2837XS_Can_defines.h中的代码:

#define CAN_CTL_INIT 0x00000001 // Initialization
#define CAN_CTL_IE0 0x00000002 // Interrupt Enable 0
#define CAN_CTL_SIE 0x00000004 // Status Interrupt Enable
#define CAN_CTL_EIE 0x00000008 // Error Interrupt Enable
#define CAN_CTL_DAR 0x00000020 // Disable Automatic-Retransmission
#define CAN_CTL_CCE 0x00000040 // Configuration Change Enable
#define CAN_CTL_TEST 0x00000080 // Test Mode Enable
#define CAN_CTL_IDS 0x00000100 // Interruption Debug Support Enable
#define CAN_CTL_ABO 0x00000200 // Auto-Bus On Enable
#define CAN_CTL_PMD_S 10
#define CAN_CTL_PMD_M 0x00003C00 // Parity/SECDED Enable
#define CAN_CTL_SWR 0x00008000 // Software Reset Enable
#define CAN_CTL_INITDBG 0x00010000 // Debug Mode Status
#define CAN_CTL_IE1 0x00020000 // Interrupt Enable 1
#define CAN_CTL_PDR 0x01000000 // Power Down Mode Request
#define CAN_CTL_WUBA 0x02000000 // Wake Up on Bus Activity

应该已经定义了啊,为什么错误显示未定义?

user5313019:

回复 Young Hu:

您好,我用的是F28377s,controlSUITE中以工程文件形式打不开这些例程,所以我就把程序拷出来,自己编译

Problem:

Description Resource Path Location Type
#20 identifier "CanaRegs" is undefined F2837xS_can.c /My_test/drv/source line 32 C/C++ Problem

F2837XS_can.c中的代码:

……

CanaRegs.CAN_CTL.bit.Init = 1;  //这句报错!

……

F2837XS_Can_defines.h中的代码:

#define CAN_CTL_INIT 0x00000001 // Initialization
#define CAN_CTL_IE0 0x00000002 // Interrupt Enable 0
#define CAN_CTL_SIE 0x00000004 // Status Interrupt Enable
#define CAN_CTL_EIE 0x00000008 // Error Interrupt Enable
#define CAN_CTL_DAR 0x00000020 // Disable Automatic-Retransmission
#define CAN_CTL_CCE 0x00000040 // Configuration Change Enable
#define CAN_CTL_TEST 0x00000080 // Test Mode Enable
#define CAN_CTL_IDS 0x00000100 // Interruption Debug Support Enable
#define CAN_CTL_ABO 0x00000200 // Auto-Bus On Enable
#define CAN_CTL_PMD_S 10
#define CAN_CTL_PMD_M 0x00003C00 // Parity/SECDED Enable
#define CAN_CTL_SWR 0x00008000 // Software Reset Enable
#define CAN_CTL_INITDBG 0x00010000 // Debug Mode Status
#define CAN_CTL_IE1 0x00020000 // Interrupt Enable 1
#define CAN_CTL_PDR 0x01000000 // Power Down Mode Request
#define CAN_CTL_WUBA 0x02000000 // Wake Up on Bus Activity

应该已经定义了啊,为什么错误显示未定义?

user5313019:

回复 mangui zhang:

您好,谢谢您的回答,我是dsp新手,请问怎么配置啊具体代码是什么?

Problem:

Description Resource Path Location Type
#20 identifier "CanaRegs" is undefined F2837xS_can.c /My_test/drv/source line 32 C/C++ Problem

F2837XS_can.c中的代码:

……

CanaRegs.CAN_CTL.bit.Init = 1;  //这句报错!

……

F2837XS_Can_defines.h中的代码:

#define CAN_CTL_INIT 0x00000001 // Initialization
#define CAN_CTL_IE0 0x00000002 // Interrupt Enable 0
#define CAN_CTL_SIE 0x00000004 // Status Interrupt Enable
#define CAN_CTL_EIE 0x00000008 // Error Interrupt Enable
#define CAN_CTL_DAR 0x00000020 // Disable Automatic-Retransmission
#define CAN_CTL_CCE 0x00000040 // Configuration Change Enable
#define CAN_CTL_TEST 0x00000080 // Test Mode Enable
#define CAN_CTL_IDS 0x00000100 // Interruption Debug Support Enable
#define CAN_CTL_ABO 0x00000200 // Auto-Bus On Enable
#define CAN_CTL_PMD_S 10
#define CAN_CTL_PMD_M 0x00003C00 // Parity/SECDED Enable
#define CAN_CTL_SWR 0x00008000 // Software Reset Enable
#define CAN_CTL_INITDBG 0x00010000 // Debug Mode Status
#define CAN_CTL_IE1 0x00020000 // Interrupt Enable 1
#define CAN_CTL_PDR 0x01000000 // Power Down Mode Request
#define CAN_CTL_WUBA 0x02000000 // Wake Up on Bus Activity

应该已经定义了啊,为什么错误显示未定义?

user5313019:

回复 mangui zhang:

我直接打开了E:\ti\controlSUITE\device_support\f2833x\v142\DSP2823x_examples_ccsv5\watchdog,编译还是出现了一样的问题

赞(0)
未经允许不得转载:TI中文支持网 » 我用的是F28377s,官网下载的controlSUIT,底层驱动从里面调用的,按道理用没有错误,但是编译之后出现了如下错误,希望熟悉F28X系列的大佬指点一下,谢谢!
分享到: 更多 (0)