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.

[参考译文] TMS320F280039:对 C2000-CGT-v22.6.3 中 int16_t 和 uint16_t 类型的修改

Guru**** 2837190 points

Other Parts Discussed in Thread: C2000WARE

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

https://e2e.ti.com/support/microcontrollers/c2000-microcontrollers-group/c2000/f/c2000-microcontrollers-forum/1590089/tms320f280039-modifications-to-int16_t-and-uint16_t-type-in-c2000-cgt-v22-6-3

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

C2000ware 版本:6.00.01

在我的工程中、我同时使用了 bitfield 和 driverlib、并使用相对路径引用了它们的头文件、如下所示:

image.png

我发现、当我将编译器版本从 22.6.2 升级到 22.6.3 时、在开始出现编译错误之前可以正常编译的工程。

Building file: "../Sources/device.c"
Invoking: C2000 Compiler
"C:/ti/ccs1281/ccs/tools/compiler/ti-cgt-c2000_22.6.3.LTS/bin/cl2000" -v28 -ml -mt --cla_support=cla2 --float_support=fpu32 --idiv_support=idiv0 --isr_save_vcu_regs=off --tmu_support=tmu1 --vcu_support=vcrc -O0 --opt_for_speed=3 --fp_mode=relaxed --include_path="C:/ti/c2000/C2000Ware_6_00_01_00" --include_path="C:/ti/c2000/C2000Ware_6_00_01_00/utilities/clb_tool/clb_syscfg/systemc/include" --include_path="C:/Users/pcbcj/Git_Project/server_psu_54v_3200w_llc_28003x/Headers" --include_path="C:/Users/pcbcj/Git_Project/server_psu_54v_3200w_llc_28003x/FLASH_DEBUG/syscfg" --include_path="C:/ti/c2000/C2000Ware_6_00_01_00/device_support/f28003x/headers/include" --include_path="C:/ti/c2000/C2000Ware_6_00_01_00/driverlib/f28003x/driverlib" --include_path="C:/ti/c2000/C2000Ware_6_00_01_00/libraries/flash_api/f28003x/include/FlashAPI" --include_path="C:/ti/c2000/C2000Ware_6_00_01_00/libraries/calibration/hrpwm/f28003x/include" --include_path="C:/ti/c2000/C2000Ware_6_00_01_00/libraries/math/FPUfastRTS/c28/include" --include_path="C:/ti/c2000/C2000Ware_6_00_01_00/libraries/dsp/FPU/c28/examples/common" --include_path="C:/ti/c2000/C2000Ware_6_00_01_00/libraries/dsp/FPU/c28/include" --include_path="C:/Users/pcbcj/Git_Project/server_psu_54v_3200w_llc_28003x" --include_path="C:/ti/c2000/C2000Ware_6_00_01_00/libraries/math/CLAmath/c28/include" --include_path="C:/ti/ccs1281/ccs/tools/compiler/ti-cgt-c2000_22.6.3.LTS/include" --include_path="C:/ti/c2000/C2000Ware_6_00_01_00/libraries/dsp/VCU/c28/include" --advice:performance=all --define=FLASH --define=_FLASH --define=_DEBUG -g --float_operations_allowed=32 --fp_single_precision_constant --diag_suppress=303 --diag_suppress=148 --diag_warning=225 --diag_wrap=off --display_error_number --gen_func_subsections=on --abi=eabi --cla_signed_compare_workaround=on -k --preproc_with_compile --preproc_dependency="Sources/device.d_raw" --include_path="C:/Users/pcbcj/Git_Project/server_psu_54v_3200w_llc_28003x/FLASH_DEBUG/syscfg" --obj_directory="Sources" --cmd_file="syscfg/board.opt" --cmd_file="syscfg/c2000ware_libraries.opt"  "../Sources/device.c"
 
>> Compilation failure
Sources/subdir_rules.mk:9: recipe for target 'Sources/device.obj' failed
"C:\ti\c2000\C2000Ware_6_00_01_00\driverlib\f28003x\driverlib\cpu.h", line 61: error #148: declaration is incompatible with "volatile unsigned int IFR" (declared at line 55 of "C:/ti/c2000/C2000Ware_6_00_01_00/device_support/f28003x/headers/include/f28003x_device.h")
"C:\ti\c2000\C2000Ware_6_00_01_00\driverlib\f28003x\driverlib\cpu.h", line 68: error #148: declaration is incompatible with "volatile unsigned int IER" (declared at line 56 of "C:/ti/c2000/C2000Ware_6_00_01_00/device_support/f28003x/headers/include/f28003x_device.h")
"C:\ti\c2000\C2000Ware_6_00_01_00\driverlib\f28003x\driverlib\interrupt.h", line 481: warning #1853-D: declaration hides built-in function "__disable_interrupts"
"C:\ti\c2000\C2000Ware_6_00_01_00\driverlib\f28003x\driverlib\interrupt.h", line 482: warning #1853-D: declaration hides built-in function "__enable_interrupts"
"C:/ti/c2000/C2000Ware_6_00_01_00/driverlib/f28003x/driverlib/can.h", line 359: warning #169-D: argument of type "int16_t *" is incompatible with parameter of type "int *"
"C:/ti/c2000/C2000Ware_6_00_01_00/driverlib/f28003x/driverlib/can.h", line 407: warning #169-D: argument of type "int16_t *" is incompatible with parameter of type "int *"
"C:/ti/c2000/C2000Ware_6_00_01_00/driverlib/f28003x/driverlib/can.h", line 456: warning #169-D: argument of type "int16_t *" is incompatible with parameter of type "int *"
"C:/ti/c2000/C2000Ware_6_00_01_00/driverlib/f28003x/driverlib/can.h", line 497: warning #169-D: argument of type "int16_t *" is incompatible with parameter of type "int *"
"C:/ti/c2000/C2000Ware_6_00_01_00/driverlib/f28003x/driverlib/lin.h", line 696: warning #169-D: argument of type "int16_t *" is incompatible with parameter of type "int *"
"C:/Users/pcbcj/Git_Project/server_psu_54v_3200w_llc_28003x/Headers/device.h", line 379: error #148: declaration is incompatible with "Uint16 RamfuncsLoadStart" (declared at line 242 of "C:/Users/pcbcj/Git_Project/server_psu_54v_3200w_llc_28003x/Headers/f28003x_globalprototypes.h")
"C:/Users/pcbcj/Git_Project/server_psu_54v_3200w_llc_28003x/Headers/device.h", line 380: error #148: declaration is incompatible with "Uint16 RamfuncsLoadEnd" (declared at line 243 of "C:/Users/pcbcj/Git_Project/server_psu_54v_3200w_llc_28003x/Headers/f28003x_globalprototypes.h")
"C:/Users/pcbcj/Git_Project/server_psu_54v_3200w_llc_28003x/Headers/device.h", line 381: error #148: declaration is incompatible with "Uint16 RamfuncsLoadSize" (declared at line 244 of "C:/Users/pcbcj/Git_Project/server_psu_54v_3200w_llc_28003x/Headers/f28003x_globalprototypes.h")
"C:/Users/pcbcj/Git_Project/server_psu_54v_3200w_llc_28003x/Headers/device.h", line 382: error #148: declaration is incompatible with "Uint16 RamfuncsRunStart" (declared at line 245 of "C:/Users/pcbcj/Git_Project/server_psu_54v_3200w_llc_28003x/Headers/f28003x_globalprototypes.h")
"C:/Users/pcbcj/Git_Project/server_psu_54v_3200w_llc_28003x/Headers/device.h", line 383: error #148: declaration is incompatible with "Uint16 RamfuncsRunEnd" (declared at line 246 of "C:/Users/pcbcj/Git_Project/server_psu_54v_3200w_llc_28003x/Headers/f28003x_globalprototypes.h")
"C:/Users/pcbcj/Git_Project/server_psu_54v_3200w_llc_28003x/Headers/device.h", line 384: error #148: declaration is incompatible with "Uint16 RamfuncsRunSize" (declared at line 247 of "C:/Users/pcbcj/Git_Project/server_psu_54v_3200w_llc_28003x/Headers/f28003x_globalprototypes.h")
8 errors detected in the compilation of "../Sources/device.c".
gmake: *** [Sources/device.obj] Error 1

这是因为在版本 22.6.3 中、uint16_t 的定义从 unsigned int 更改为 unsigned short。 但是、在 C2000ware 中、Uint16 的定义仍然是 unsigned int。 因此、在使用以下头文件编译源文件时、我的工程会出错。

image.pngimage.png

虽然 int 和 short 在 C2000 中是等效的、但编译器认为它们是不同的类型并报告错误。

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

    在 28388D 中观察到新编译器 v22.6.3 存在相同的问题

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

    感谢您就此问题向我们发出通知。  我能够重现同样的行为。  我提交 EXT_EP-13044 来进行调查。  欢迎点击这个链接。

    谢谢。此致、

    -乔治

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

    以下路径中的_types.h 文件也有同样的问题。

    C:\ti\ccs1220\ccs\tools\compiler\ti-cgt-c2000_22.6.3.lts\include\machine

    V22.6.3. V22.6.0

    #if defined (__TMS320C28XX_CLA__)
    typedef short __int16_t;
    typedef unsigned short __uint16_t;
    typedef int __int32_t;
    typedef unsigned int _uint32_t;
    #else
    typedef 短路 __int16_t;
    typedef 无符号短整型 _uint16_t;
    typedef long __int32_t;
    typedef unsigned long _uint32_t;
    #endif

    ##if defined (__TMS320C28XX_CLA__)
    typedef short __int16_t;
    typedef unsigned short __uint16_t;
    typedef int __int32_t;
    typedef unsigned int _uint32_t;
    #else
    typedef int __int16_t;
    typedef unsigned int _uint16_t;
    typedef long __int32_t;
    typedef unsigned long _uint32_t;
    #endif

    将编译器版本升级到之后 22.6.3. 、出现错误。

    说明资源路径位置类型
    类型为“int16_t *“的#169-D 参数与类型为“int *的参数不兼容

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

    上述问题是 https://sir.ext.ti.com/jira/browse/EXT_EP-12834 修复的结果 
    将对 EXT_EP-12834 进行更新修复、并可以使用 EXT_EP-13044 进行跟踪

    同时、对于 22.6.3.LTS 和 25.11.0.LTS、可以使用以下权变措施:
    仅使用 stdint.h 中一致的类型定义

    或者从 include/machine/_types.h 中的 EXT_EP-12834 中撤消以下修复
    然后根据 spru514 用户指南使用 mklib.exe 重新构建 RTS 库。
    #else
    typedef short __int16_t;
    typedef unsigned short __uint16_t;
    取而代之的是:
    #else
    typedef int __int16_t;
    typedef unsigned int __uint16_t;