使用 clang 编译器(v3.2.1.LTS)时、在编译任何基于 CC1310的示例代码时遇到一些问题。 由于 Alan Phipps 在 TI 最近新增了内容(在此处增加了 CMake)、因此我的最终目标是使用 CMake 来构建我的代码。 我认为 CCS 和 CMake 之间存在相同的错误、但现在我们可以忽略 CMake 部分。
在 CCS 中打开`rfPacketRx`演示时、我最初可以使用 TI v20.2.7LTS 编译器毫无问题地进行编译、但是、如果我转到工程属性并更新编译器以使用 TI Clang v3.2.1.LTS、我开始收到错误消息、说不允许`naked`函数中的参数引用。 (也通过 CMake 调用编译时会出现相同的错误)
/home/stephen/ti/simplelink_cc13x0_sdk_4_20_02_07/source/ti/devices/cc13x0/driverlib/cpu.h:373:28: error: parameter references not allowed in naked functions : "r" (ui32NewBasepri) ^ /home/stephen/ti/simplelink_cc13x0_sdk_4_20_02_07/source/ti/devices/cc13x0/driverlib/cpu.h:366:38: note: attribute is here __STATIC_INLINE void __attribute__ ((naked))
在挖入文件时、很明显未定义或使用`__TI_Compiler_version__`宏。
//***************************************************************************** // //! \brief Update the interrupt priority disable level. //! //! Use this function to change the level of priority that will disable //! interrupts with a lower priority level. //! //! \param ui32NewBasepri is the new basis priority level to set. //! //! \return None // //***************************************************************************** #if defined(DOXYGEN) __STATIC_INLINE void CPUbasepriSet(uint32_t ui32NewBasepri) { // This function is written in assembly. See cpu.h for compiler specific implementation. } #elif defined(__IAR_SYSTEMS_ICC__) __STATIC_INLINE void CPUbasepriSet(uint32_t ui32NewBasepri) { // Set the BASEPRI register. __asm(" msr BASEPRI, r0\n"); } #elif defined(__CC_ARM) || defined(__ARMCC_VERSION) __asm __STATIC_INLINE void CPUbasepriSet(uint32_t ui32NewBasepri) { // Set the BASEPRI register. msr BASEPRI, r0; bx lr } #elif defined(__TI_COMPILER_VERSION__) __STATIC_INLINE void CPUbasepriSet(uint32_t ui32NewBasepri) { // Set the BASEPRI register. __asm(" msr BASEPRI, r0\n"); } #else #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wattributes" __STATIC_INLINE void __attribute__ ((naked)) CPUbasepriSet(uint32_t ui32NewBasepri) { // Set the BASEPRI register. __asm volatile (" msr BASEPRI, %0\n" " bx lr\n" : /* No output */ : "r" (ui32NewBasepri) ); } #pragma GCC diagnostic pop #endif
我可以自行手动定义版本宏(yikes)、再进一步一点、但随后有编译器警告、说明示例源代码中使用了非 ticlang 支持的传统 pragma。 我将在开始时解决这个问题、但我想弄清楚为什么编译器版本未设置。
非常感谢任何帮助。 谢谢!
-斯蒂芬