在开发Ti CC1310
应用的时候遇到了SDK
版本兼容问题。早期的应用都是从SDK 1.60
版本的例子中修改得来的,最近在升级到SDK 2.x
版本的时候遇到了编译不通过的问题。主要是某些变量名的定义改变了。
但是,翻遍了代码也没找打一个SDK
版本宏。
于是只能通过ti/devices/cc13x0/driverlib/driverlib_release.h
文件里面的DRIVERLIB_RELEASE_BUILD
的版本号来进行区分,根据数字的不同来使用不同的代码,例子如下:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
#include <ti/devices/cc13x0/driverlib/driverlib_release.h> /*SDK 1_60_00_21*/ #if (DRIVERLIB_RELEASE_BUILD <= 50218) const DisplaySharp_HWAttrs displaySharpHWattrs = { .spiIndex = CC1310_LAUNCHXL_SPI0, .csPin = CC1310_LAUNCHXL_LCD_CS, .extcominPin = CC1310_LAUNCHXL_LCD_EXTCOMIN, .powerPin = CC1310_LAUNCHXL_LCD_POWER, .enablePin = CC1310_LAUNCHXL_LCD_ENABLE, .pixelWidth = BOARD_DISPLAY_SHARP_SIZE, .pixelHeight = BOARD_DISPLAY_SHARP_SIZE, .displayBuf = sharpDisplayBuf, }; #else /*SDK 2_10_02_10*/ const DisplaySharp_HWAttrsV1 displaySharpHWattrs = { .spiIndex = CC1310_LAUNCHXL_SPI0, .csPin = CC1310_LAUNCHXL_LCD_CS, .powerPin = CC1310_LAUNCHXL_LCD_POWER, .enablePin = CC1310_LAUNCHXL_LCD_ENABLE, .pixelWidth = BOARD_DISPLAY_SHARP_SIZE, .pixelHeight = BOARD_DISPLAY_SHARP_SIZE, .displayBuf = sharpDisplayBuf, }; #endif |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
/* * =============================== RF Driver =============================== */ #include <ti/drivers/rf/RF.h> /*SDK 1_60_00_21*/ #if (DRIVERLIB_RELEASE_BUILD <= 50218) const RFCC26XX_HWAttrs RFCC26XX_hwAttrs = { .hwiCpe0Priority = ~0, .hwiHwPriority = ~0, .swiCpe0Priority = 0, .swiHwPriority = 0, }; #else /*SDK 2_10_02_10*/ const RFCC26XX_HWAttrsV2 RFCC26XX_hwAttrs = { .hwiPriority = ~0, /* Lowest HWI priority */ .swiPriority = 0, /* Lowest SWI priority */ .xoscHfAlwaysNeeded = true, /* Keep XOSC dependency while in stanby */ .globalCallback = NULL, /* No board specific callback */ .globalEventMask = 0 /* No events subscribed to */ }; #endif |
其他的就是动态链接库的位置不同,导致链接的时候报告找不到链接库,需要重新设置一下,或者简单的移除一些找不到的库即可,例子中并没有用到全部的链接库。