Building BLE Projects on Linux

From Texas Instruments Wiki
Jump to: navigation, search

Bluetooth Low Energy Wiki Main Page


This page will describe how to build BLE Stack v2.x projects on Linux. Please note that building the BLE-Stack SDK is not officially supported on Linux host platforms, but some projects have been tested and are building successfully. The contents of this wiki are therefore considered experimental.

For building on Mac OSX, please see this page.

Environment

This wiki page is developed using the tools listed below:
OS: Ubtuntu 14.04 LTS 64 bit
IDE: CCS v6.1.1.00022
BLE Stack Version: v2.1
Wine version: v1.6.2

Prerequisites

It is expected that the user has an understanding of the Linux environment and command line, as well as how to modify CCS projects.

Installing Tools

  1. Download and Install CCS v6.1 from this link: http://processors.wiki.ti.com/index.php/Download_CCS
  2. Install Wine using apt
    • sudo apt-get install wine

Installing the BLE Stack

  1. Download the BLE stack (latest version is v2.1) from here: http://www.ti.com/tool/ble-stack?DCMP=wbu-blestack&HQS=ble-stack
  2. Install the BLE stack using wine
  3. Copy files from the wine C drive to home folder. Note that the folder ~/ti should already exist from the CCS install
    • cd ~/ti
    • cp -r ../.wine/drive_c/ti/simplelink/ .
    • cp -r ../.wine/drive_c/Program\ Files\ \(x86\)/Texas\ Instruments/Boundary/ .
    • Do not copy the TI-RTOS version bundled with the BLE-Stack, this is a Windows only version. We will install the Linux version below and use that one.

Installing TI-RTOS

  1. Download the TI-RTOS v2.13.00.06 (this is the version currently supported by BLE-Stack v.2.1.x) for Linux.
    • Since CCS searches for RTOS/XDC tools products when it starts, it should be detected with a restart of CCS.

Building a Sample Project

  1. Import a project from BLE stack into CCS Workspace
    • Project -> import CCS projects -> project search directory
    • Use the file explorer to choose the CCS project for SimpleBLEPeripheral (~/ti/simplelink/ble_cc26xx_2_01_00_44423/Projects/ble/SimpleBLEPeripheral/CC26xx/CCS)
    • The import tool should find two projects one for the application and stack.
  2. Change the pre and post build steps on the Stack Project
    • Right click on Stack project -> Properties -> Build -> Steps
    • Use wine to invoke the libsearch.exe:
    • wine ${ORG_PROJ_DIR}/../../../../../../tools/LibSearch/libSearch.exe ${ORG_PROJ_DIR}/buildConfig.opt ${ORG_PROJ_DIR}/../../../../../../tools/LibSearch/parameters.xml ${ORG_PROJ_DIR}/../../../../../Libraries/CC26xx/IAR/ ${ORG_PROJ_DIR}/../../Lib/CC2640Stack.a FlashROM
    • Use wine to invoke the boundary tool:
    • wine "/home/YOUR_USR/ti/Boundary/Boundary.exe" -prj "ccs" -chip "CC2640" -lcf "${ORG_PROJ_DIR}/../../../../../common/cc26xx/CCS/cc26xx_ble_stack.cmd" -map "${PROJECT_LOC}/${ConfigName}/${ProjName}.map" -xml "/home/YOUR_USR/ti/Boundary/BoundaryConfig.xml" -cc "${ORG_PROJ_DIR}/../../../CCS/Config/ccsCompilerDefines.bcfg" -lnk "${ORG_PROJ_DIR}/../../../CCS/Config/ccsLinkerDefines.cmd"
    • Note that you will need to change YOUR_USR above to your user name
  3. Change paths in Linked resources
    Linked Resources Stack
    • Right click on Stack project -> Properties -> Resource -> Linked Resources
    • The old project files may have set some of the variables to paths starting with C:/ti... these should be changed to a the new path in your Linux home folder.
    • I had to change the CC26XXWARE variable to /home/YOUR_USR/ti/tirtos_simplelink_2_13_00_06/products/cc26xxware_2_21_01_15600
  4. Change capitalization issues.
    • It appears that the project settings need to be slightly tweaked due to some capitalization issues
    • Try to build the stack project, you will get errors saying that included files can't be opened. This can be caused by an incorrectly capitalized include path in the compiler or an incorrectly capitalized #include statement
    • Lets address the #include statements first
      • I had to change osal.h to OSAL.h in OnBoard.h
      • I also had to change board.h to Board.h in bleUserConfig.h
    • Now, open the compiler includes: Right click on Stack project -> Properties -> Build -> Include Options
      • Change "${ORG_PROJ_DIR}/../../../../../../../Projects/ble/ICall/include" --> "${ORG_PROJ_DIR}/../../../../../../../Projects/ble/ICall/Include"
      • There may be some that are missed here, you can resolve these issues by finding the file that CCS can't open and look for errors in its included path. To find the file just open a file explorer and press ctrl+f or use a command line tool
  5. Change the application project
    • Note that the application project relies on the RTOS install. Make sure it is recognized by CCS here: Right click on Stack project -> Properties -> General -> RTSC
    Application RTOS Config
    • Make sure the linked resources don't point to any C:/ drive paths
    Application Linked Resources
    • Change capitalization errors as per step 4