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.

[参考译文] CODECOMPOSER:帮助解决 TI 提供的头文件和源文件中的一些随机编译错误

Guru**** 2560390 points
Other Parts Discussed in Thread: C2000WARE

请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

https://e2e.ti.com/support/microcontrollers/c2000-microcontrollers-group/c2000/f/c2000-microcontrollers-forum/999219/codecomposer-help-with-some-random-compilation-errors-in-headers-and-source-files-provided-by-ti

器件型号:CODECOMPOSER
主题中讨论的其他器件:C2000WARE

你好!

这里是随机的、但是在编译代码时、我从一些头文件和源文件中得到了一组错误、我之前从未提到过这些错误。 TI 提供的默认代码。

我不确定是否出现了错误、但以下是错误:

">>编译失败
subdir_rules.mk:16:目标'MPM_CPU1.obj'的配方失败
"C:/ti/F2837xD GCB/Device_support/F2837xD_headers/include/F2837xD_device.h"、第46行:警告#48-D:不兼容的宏"EALLOW"重新定义(声明在"C:\ti\c2000Ware_3_04_00_00\driverlib\f2837xd\driverlib\driverlib\cp2000\driverxd\driverlib\cf2837xd\driverh"的第106行)
"C:/ti/F2837xD GCB/Device_support/F2837xD_headers/include/F2837xD_device.h"、第47行:警告#48-D:不兼容的宏"EDIS"重新定义(在"C:\ti\c2000Ware_3_04_00_00\driverlib\f2837xd\driverlib\cp2000"的第117行声明)
"C:\ti\F2837xD GCB\Device_support\F2837xD_common\include\F2837xD_examples.h"、第301行:警告#48-D:宏"Device_cal"的重新定义不兼容(声明在"C:\ti\c2000\C2000Ware_3_04_00_00\driverlib\driver2837lib\driververtl\driverlib\driverlib\driververtxd\driverlib.lib\driver2837xd\driverlib\driverlib\driverlib
"C:\ti\F2837xD GCB\Device_support\F2837xD_common\include\F2837xD_GlobalPrototypes.h"、第76行:错误#41:预期标识符
"C:\ti\F2837xD GCB\Device_support\F2837xD_common\include\F2837xD_GlobalPrototypes.h"、第76行:错误#80:期望指定类型
"C:\ti\F2837xD GCB\Device_support\F2837xD_common\include\F2837xD_GlobalPrototypes.h"、第76行:错误#91:不允许函数返回函数"

这些错误位于我自己的代码中、因此我可以修复这些错误。 但我不确定如何处理上述警告和错误! 可能是我的书面用户代码中的某个内容导致他们消除了错误? 是否有关于这些问题的发生方式以及如何解决这些问题的建议?

祝你一切顺利、
Joel

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    Joel、

    查看出现这种情况的第一个错误消息、因为有问题的2个头文件都定义了 EALLOW。  现在、这两个头文件都来自 C2000Ware、当我查看它们时、我可以看到它们在定义周围有#ifndef、因此不应发生此错误。  但是、当我查看 构建输出中头文件 F2837xD_device.h 的路径时、我可以看到它来自 C2000Ware 外部的文件夹。  因此、我猜测有人从 C2000Ware 的旧版本中复制了此文件、该版本的定义周围没有#ifndef。

    让我进一步解释一下。  如果我查看 C2000Ware 随附的 F2837xd_device.h (在您的计算机上、这将位于 C:\ti\c2000Ware_3_04_00_00\device_support\f2837xd\headers\include 中)、我可以看到 EALLOW 的#define 被#ifndef 包裹  

    #ifndef EALLOW
    #define EALLOW __asm (" EALLOW ")
    #endif

    同样、如果我查看 C2000Ware 随附的 cpu.h 文件、我会看到

    #ifndef EALLOW
    #ifndef __TMS320C28XX_CLA__
    #define EALLOW __EALLOW ()
    其他
    #define EALLOW __meallow()
    #endif //__TMS320C28XX_CLA__
    #endif // EALLOW

    因此、问题似乎是您从  C:/ti/F2837xD GCB/Device_support/F2837xD_headers/include 而不是从 C2000Ware 内的头文件( C:\ti\c2000\C2000Ware_3_04_00_00\device_support\f2837xd\headers\include)提取 F2837xD_device.h 文件。

    修复要放入正确文件的 include 路径会解决该错误。

    对于我、我 向我的搜索路径添加了${C2000WARE_ROOT}/device_support/f2837xd/headers/include、如下所示  


    此致、

    John

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    您好、Joel、

    正如 John 提到的,包含“F2837xD_DEVICE.h”的标头似乎不来自 C2000Ware 文件夹。

    C2000Ware v3.04.00.00的最新版本在定义周围确实有#ifndef。

    您能告诉我您正在使用的 C2000Ware 版本吗?

    此致

    Siddharth

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    尊敬的 John:  

    非常感谢-这似乎解决了我的问题! 但是、当我从 C2000Ware 文件夹中将头文件和公共资源包含到我的目录中时、我现在会收到一组新的错误。 这次、.C 源文件中出现错误:


    ****为项目 HV_MPM1构建配置 CPU1_RAM ****

    "C:\\ti\\ccs1020\\ccs\\utils\bin\\gmake"-k -j 4 all -O

    编译文件:"../device/F2837xD_CodeStartBranch.asm
    调用:C2000编译器
    "c:/ti/ccs1020/ccs/tools/compiler/ti-cgt-c2000_20.2.2.LTS/bin/cl2000 /Users/joel-/workspace_v10/HV_MPM1/libraries/DCL /Users/joel-/workspace_v10/HV_MPM1/device /Users/joel-/workspace_v10/HV_MPM1/CPU1_RAM/syscfg -v28 -ml -mt --cla_support=cla1 -float_support=fpu32 -tmu_support=vcu_support=vcu2 -off -include_path="C:/ti/c2000/C2000Ware_3_04_00_00/device_support/f2837xd/headers/include /ti/c2000/C2000Ware_3_04_00_00/libraries/calibration/hrpwm/f2837xd/include /ti/c2000/C2000Ware_3_04_00_00/driverlib/f2837xd/driverlib /device/F2837xD_CodeStartBranch.asm -include_display_support=expression_exclus-board_code.htm"-/ti/c2000/C2000Ware_3_04_00_00/device_support/f2837xd/common/include /Users/joel-/workspace_v10/HV_MPM1 /ti/ccs1020/ccs/tools/compiler/ti-cgt-c2000_20.2.2.LTS/include -exclus_express-board_exclus_ep-code.htm"-board_express-board_express-board-express-cn_expression_board-cn_expression-board-cn_expression-ine-board-cn_board-cn_expression-cn_express-cn_expression-cn_guest-cn_over-d_code.htm-intrab-over-intrab-board-board-board-board-over-dual-board-cn_codest_debotherboard.cn_guest_debotion-cn-cn-cn-cn_guest_deband_deband_debature=inature=inature=d_guest-cn"-in
    已完成构建:"./device/F2837xD_CodeStartBranch.asm

    构建文件:"../CLA_Fly.cla"
    调用:C2000编译器
    "c:/ti/ccs1020/ccs/tools/compiler/ti-cgt-c2000_20.2.2.LTS/bin/cl2000 /Users/joel-/workspace_v10/HV_MPM1/libraries/DCL /Users/joel-/workspace_v10/HV_MPM1/device /Users/joel-/workspace_v10/HV_MPM1/CPU1_RAM/syscfg -v28 -ml -mt --cla_support=cla1 -float_support=fpu32 -tmu_support=tmu0 -vcu_support=vcu2 -off -include_path="C:/ti/c2000/C2000Ware_3_04_00_00/device_support/f2837xd/headers/include /ti/c2000/C2000Ware_3_04_00_00/libraries/calibration/hrpwm/f2837xd/include /ti/c2000/C2000Ware_3_04_00_00/driverlib/f2837xd/driverlib -include_display_support=float_guide-/ti/c2000/C2000Ware_3_04_00_00/device_support/f2837xd/common/include -include_display_ine-board_pred_guide-ine-board.cn"-/Users/joel-/workspace_v10/HV_MPM1 /ti/ccs1020/ccs/tools/compiler/ti-cgt-c2000_20.2.2.LTS/include -intrab_guide-board_guide-ine-ine-ine-board_supd_guidep-ine-ine_guide-ine-ine-ine-ine-board.cp_suppf-nature=ctrab_guide-board.cp_guide-ine-ine-ine-ine-ine-ine-ine-board.cp_guide-ine_guide-ine-ine-bi-f_guide-ine-bi-f_guide-bi-f_guide-bi-f_guide-bi-f_guide-bi-f_guest-ine-ine-ine-bi-f_guide-ine-ine-
    完成构建:"../CLA_Fly.CLA"

    编译文件:"../MPM_CPU1.c"
    调用:C2000编译器
    "c:/ti/ccs1020/ccs/tools/compiler/ti-cgt-c2000_20.2.2.LTS/bin/cl2000 /ti/c2000/C2000Ware_3_04_00_00/device_support/f2837xd/common/include /Users/joel-/workspace_v10/HV_MPM1/libraries/DCL /Users/joel-/workspace_v10/HV_MPM1 /Users/joel-/workspace_v10/HV_MPM1/device /ti/ccs1020/ccs/tools/compiler/ti-cgt-c2000_20.2.2.LTS/include /Users/joel-/workspace_v10/HV_MPM1/CPU1_RAM/syscfg -v28 -ml -mt --cla_support=cla1 -float_support=fpu32 -tmu_support=tmu0 -vcu_support=vcu2 -off -include_path="C:/ti/c2000/C2000Ware_3_04_00_00/device_support/f2837xd/headers/include /ti/c2000/C2000Ware_3_04_00_00/libraries/calibration/hrpwm/f2837xd/include /ti/c2000/C2000Ware_3_04_00_00/driverlib/f2837xd/driverlib -include_display_support=dcpu1.htm-display_suppress-board_guide-ine-board_guide-ine-d_guide-ine-pf-nature=dcpu1.htm-board_supd.pref_board_board.cpu.cpu1.htm-board_supd_suppress-board-board_ep-board_supd_supd_board_supd_epinflu.cpu.cpu.cpu.cpu1.htm-board-board-board_supd_supd_supd_suppf-nature_guide_ep-cn_ep-cn_guide_guide_guide_ep-cn_ep-cn-cn_ep-cn-cn-cn-cn-cn_guest-cn-cn_guide_guide_ep-cn-

    >>编译失败
    subdir_rules.mk:16:目标'MPM_CPU1.obj'的配方失败
    "C:\ti\c2000Ware_3_04_00_00\device_support\f2837xd\common\include\F2837xD_GlobalPrototypes.h"、第127行:错误#41:预期标识符
    "C:\ti\c2000Ware_3_04_00_00\device_support\f2837xd\common\include\F2837xD_GlobalPrototypes.h"、第127行:错误#80:预期类型说明符
    "C:\ti\c2000Ware_3_04_00_00\device_support\f2837xd\common\include\F2837xD_GlobalPrototypes.h"、第127行:错误#91:不允许函数返回函数
    3在编译"./MPM_CPU1.c"时检测到错误。
    gmake:***[MPM_CPU1.obj]错误1.
    gmake:目标"全部"不会由于错误而重新生成。

    ****构建完成****

    您能帮我解决这些错误吗?

    祝你一切顺利、

    Joel

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    您好、Joel、

    问题可能是由于 driverlib 和公共路径都包含 在同一个项目中、 因此 IDLE 函 数会解析为 cpu.h 中的宏、而不是 SYSCTL 文件。

    您可以在工程属性中预处理符号"_dual_headers"、因为它使用的是具有源文件 driverlib 和位字段样式的工程。 这将在 cpu.h 中为您重新定义双宏,以便将 idle() API 解析为正确的文件。

    此致

    Siddharth

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    您好 Siddharth、

    这似乎解决了它... 再也不会出错了! 嗯、一组新的错误、但嘿

    它是否像字面上所说的那样简单、只需预置+按钮并键入_dual_headers、其他什么都没有? 请参阅以下内容:

    这似乎是有效的,但似乎太简单了-通常没有什么是简单的,但我会接受它!

    感谢您的帮助! 非常感谢 John 和 Siddharth。

    Joel

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    您好、Joel、

    很高兴它得到了解决。 我将把这个线程标记为已关闭。

    此致

    Siddharth