请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。
器件型号:TMS320F28379D Thread 中讨论的其他器件:C2000WARE
工具与软件:
在 C2000Ware_5_02_00_00/libraries/flash_api/f2837xd/include/types.h 中、将条件声明为 false 和 true:
#if FALSE != 0 #define false FALSE #endif #if TRUE != 1 #define true TRUE #endif
在 C2000Ware_5_02_00_00/driverlib/f2837xd/driverlib/inc/hw_types.h 中、true 和 false 定义如下:
/* To fix Misra-C errors */ #ifndef TRUE #define TRUE ((bool) 1) #endif #ifndef FALSE #define FALSE ((bool) 0) #endif
在扩展上述代码时、这会导致以下编译器错误:
"/Applications/ti/c2000/C2000Ware_5_02_00_00/libraries/flash_api/f2837xd/include/Types.h", line 129: error #18: expected a ")" "/Applications/ti/c2000/C2000Ware_5_02_00_00/libraries/flash_api/f2837xd/include/Types.h", line 132: error #18: expected a ")"
这可通过以下源文件重现:
#include <driverlib.h> #include <Types.h>
编译时使用:
cl2000 --compile_only --c_file=flash_driver.c -DHAS_DRIVER_LIB -D_FLASH -D_LAUNCHXL_F28379D --include_path=/Applications/ti/c2000/C2000Ware_5_02_00_00/libraries/flash_api/f2837xd/include --include_path=/Applications/ti/c2000/C2000Ware_5_02_00_00/device_support/f2837xd/common/include --include_path=/Applications/ti/c2000/C2000Ware_5_02_00_00/device_support/f2837xd/headers/include --include_path=/Applications/ti/c2000/C2000Ware_5_02_00_00/driverlib/f2837xd/driverlib --include_path=/Applications/ti/ti-cgt-c2000_22.6.0.LTS/include --silicon_version=28 --large_memory_model --unified_memory --cla_support=cla1 --float_support=fpu32 --fp_mode=relaxed --tmu_support=tmu0 --vcu_support=vcu2 --display_error_number --symdebug:dwarf --c99 --gen_func_subsections --gen_data_subsections=on --opt_level=4 -DNASSERT --output_file=flash_driver.c.obj
是否有任何理由不在单个翻译单元中包含`driverlib.h`和`types.h`?