Ti CC1310 SDK版本相容
在開發Ti CC1310
應用的時候遇到了SDK
版本相容問題。早期的應用都是從SDK 1.60
版本的例子中修改得來的,最近在升級到SDK 2.x
版本的時候遇到了編譯不通過的問題。主要是某些變數名的定義改變了。
但是,翻遍了程式碼也沒找打一個SDK
版本巨集。
於是只能通過ti/devices/cc13x0/driverlib/driverlib_release.h
檔案裡面的DRIVERLIB_RELEASE_BUILD
的版本號來進行區分,根據數字的不同來使用不同的程式碼,例子如下:
#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
/* * =============================== 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
其他的就是動態連結庫的位置不同,導致連結的時候報告找不到連結庫,需要重新設定一下,或者簡單的移除一些找不到的庫即可,例子中並沒有用到全部的連結庫。