NOTICE: The Processors Wiki will End-of-Life on January 15, 2021. It is recommended to download any files or other content you may need that are hosted on processors.wiki.ti.com. The site is now set to read only.
TI Bluetooth Stack for WL18xx - Build Process
TI Bluetooth Stack - BluetopiaPM Getting Started Guide
TI Bluetooth Stack - Demo Guide
Contents
Introduction[edit]
The following guide contains detailed information on how to compile Bluetopia Platform Manager, the Bluetooth Protocol Stack, to AM335x, AM437x EVM or BeagleBone platforms.
To get started, download a ready-to-use distribution (WiLink™ 8 Linux Bluetooth Add-On) from:
Note: The same distribution can also be used to build projects for the CC256x platform.
The packages found in the link above above were cross-compiled with the Linaro GCC Toolchain that is included in Texas Instrument's AM335x Linux SDK or AM437x Linux SDK in Ubuntu 14.04.
If you are using a different cross-compiler or a different version of Texas Instrument's SDK then you may need to contact Texas Instrument's to determine if the packages above are binary-compatible with your development environment.
Build Process[edit]
General Information[edit]
If you haven't already done so, download a distribution from the link above and install it using the instructions found in the Bluetopia Platform Manager User's Guide. In this guide we rebuild Bluetopia Platform Manager distribution if changes are made to the sample applications or internal files, so that you can get started using Bluetooth with your WL18xx/CC256x device.
Build the Bluetopia PM[edit]
Note: Users with older versions than 4.0.3.0.1.0 use this link
Note: The following instructions are for users using add-on version 4.0.3.0.1.0 and above
Note You need to configure and build only if you made changes in the environment . (Sample Applications or internal files)
Configure the PM build[edit]
Browse to the installation folder, enter build folder and follow the instructions in Buildinstructions file.
1. Make sure you're in the build directory (<INSTALLATION_DIR>/build) as so. For example:
cd ~/AM335xBluetopiaLinuxProduction-4.0.3.0.1.0/build
2. Make a copy of the setup-bt.sample file. For example:
cp setup-bt.sample setup-bt
3. Update the TOOLCHAIN_PATH and KERNEL_PATH variables in setup-bt for your environment. For example:
# Path to local toolchain installation export TOOLCHAIN_PATH=~/ti-processor-sdk-linux-am335x-evm-03.02.00.05/linux-devkit/sysroots/ # Path to SDK compiled kernel export KERNEL_PATH=~/ti-processor-sdk-linux-am335x-evm-03.02.00.05/board-support/linux-4.4.32+gitAUTOINC+adde2ca9f8-gadde2ca9f8/
4. Enable or disable the builds for certain projects and additional configuration settings in the 'proj/proj-defs.mak.
5. Update the DEVICE variable in the proj/proj-defs.mak file to build for either the CC256x or Wilink8 platform (default), by commenting out the unwanted platform.
DEVICE = wl18xx #DEVICE = cc256x
6. Update the TOOLCHAIN_PATH_NATIVE and TOOLCHAIN_PATH_TARGET variables in the proj/toochain-defs.mak file. For example:
TOOLCHAIN_PATH_NATIVE=$(TOOLCHAIN_PATH)/x86_64-arago-linux/ TOOLCHAIN_PATH_TARGET=$(TOOLCHAIN_PATH)/armv7ahf-neon-linux-gnueabi/
For the ti-processor-sdk-linux-am335x-evm-03.02.00.05 TOOLCHAIN_PATH.
7. Run the following command to configure the environment (from the build directory).
source configure.sh
Modification of the PM build environment[edit]
When making changes in the PM environment, adding files or when wanting to remove sample applications from the distribution you will need to change the following files: In <INSTALLATION_DIR>/build/proj
- plat-rules.mak - This file compile the sample apps and the libraries, you'll need to add/remove the section that you want.
NOTE: Some of the sample applications have generic build process so they are being hold in variable in the platform.mak file.
$(PMBINDIR)/%: $(OBJDIR)/%_C.o $(PMLIBDIR)/libBTPM_C.a $(PMLIBDIR)/libBTPM_HAL_C.a @echo LN $(^F) -o $(@F) @$(CC) -L$(LIBDIR) $^ $(LDFLAGS) -o $@
when using %, the % will be replaced with the sample apps from the variable.
- a) example for deleting sample application:
$(PMBINDIR)/LinuxAUDM: $(OBJDIR)/LinuxAUDM_C.o $(OBJDIR)/AudioDecoderPM_C.o $(OBJDIR)/AudioEncoderPM_C.o $(PMLIBDIR)/libBTPM_C.a $(PMLIBDIR)/libBTPM_HAL_C.a @echo LN $(^F) -o $(@F) @$(CC) -L$(LIBDIR) $^ $(LDFLAGS) -o $@
removing this section will disable the compilation of the LinuxAUDM sample application.
- b) example for adding sample application:
$(PMBINDIR)/LinuxYOURAPP: $(OBJDIR)/LinuxYOURAPP_C.o $(PMLIBDIR)/libBTPM_C.a $(PMLIBDIR)/libBTPM_HAL_C.a @echo LN $(^F) -o $(@F) @$(CC) -L$(LIBDIR) $^ $(LDFLAGS) -o $@
be sure to add all the libs and object that you need to compile your application.
Note: Make sure not to remove libBTPS* files.
- platform.mak - This file create some variables that hold the sample apps in order to compile them in the plat-rules.mak file, you'll need to add/remove the sample that you want.
Build[edit]
- Run make command to build the environment in the ~/build directory
make
Adding Bluetopia to the SD card[edit]
Note: : [target-root] can be an NFS link to the target (rootfs) or a mounted SD card path (e.g. /media/rootfs).
Sample Applications[edit]
- Copy the BluetopiaPM server (SS1BTPM) and the provided Sample applications that were built
sudo mkdir [target-root]/home/root/BluetopiaPM sudo cp -rf <INSTALLATION_DIR>/BluetopiaPM/bin [target-root]/home/root/BluetopiaPM/
Gstreamer Plugin[edit]
- BluetopiaPM include a GStreamer Plugin that should be copied to the target rootfs, The GStreamer is being used in AUD Demo application
sudo cp <INSTALLATION_DIR>/BluetopiaPM/lib/libgstss1bluetooth.so [target-root]/usr/lib/gstreamer-1.0/
VNET Plugin[edit]
- BluetopiaPM include a VNET Plugin that should be copied to the target rootfs, The VNET is being used in PAN Demo application
sudo mkdir -p [target-root]/home/root/BluetopiaPM/Bluetopia/VNET/driver sudo cp -rf <INSTALLATION_DIR>/BluetopiaPM/Bluetopia/VNET/driver/VNETInst [target-root]/home/root/BluetopiaPM/Bluetopia/VNET/driver/ sudo cp -rf <INSTALLATION_DIR>/BluetopiaPM/Bluetopia/VNET/*.ko [target-root]/home/root/BluetopiaPM/Bluetopia/VNET/
Init-scripts[edit]
Before the stack can be used make sure to have an updated Bluetooth Script (BTS) on your target platform. The latest BTS file and installation instructions can be found in WL18xx-BT-SP and can be copied directly to the SD card's firmware directory as shown below:
sudo cp -rf TIInit_X.Y.Z.bts [target-root]/lib/firmware/
In order to add support for AVPR, BLE or BR/EDR for the CC256x devices the CC256x Service Pack User's Guide should be followed.
Bluetopia Platform Manager Architecture[edit]
Installation Directory Structure[edit]
[install-dir]: | Contains:
|
[install-dir]/BluetopiaPM: | Contains:
|
[install-dir]/build: | Contains:
|
[install-dir]/Documentation: | Contains:
|
BluetopiaPM Structure[edit]
The directory structure of [install-dir]/BluetopiaPM is as follows:
bin: | The Bluetopia PM bin directory contains pre-compiled executables for the PM Server and for Sample Client Applications which demonstrate using the PM Modules. |
btpmerr: | The Bluetopia PM Error directory contains includes and libraries used to convert Bluetopia PM Error Codes to User-Friendly Text Strings. |
btpmipc: | The btpmipc directory contains includes source and header files for Bluetopia PM for the Bluetopia PM Inteprocess communication abstraction layer. |
btpmmodc: | The Bluetopia PM Module Configuration directory contains code and makefiles that can be used to customize the PM Server Executable and to customize which modules are initialized. |
btpmvs: | The Bluetopia PM btpmvs directory contains Vendor specific functions/definitions/constants used to define a set of vendor specific functions, supported for CC256x and WL18x. |
include: | The Bluetopia PM Include directory contains header files that should be included by an application. |
lib: | The Bluetopia PM Library directory contains the Bluetopia PM Client Library. Client applications can link to this library. |
modules: | The Bluetopia PM Modules directory contains includes and libraries that can be use when re-building the PM Server or PM Client Applications. |
sample: | The Bluetopia PM Samples directory contains source code. These are samples are provided as a reference to demonstrate how to use the modules and get started with development in Bluetopia PM. See the Bluetopia Platform Manager Demo Guide to get started with using the samples (also referred to as demos). |
ss1btpm/server: | The Stonestreet One Bluetopia PM Server directory contains make files that can be used to customize the PM Server library. The PM Server Executable links to the server binary when the PM Server is re-built. Note that source code is provided for the PM Server so that it can be customized if necessary. |
Additional Information[edit]
Bluetopia[edit]
Bluetopia is also included with the Bluetopia PM distribution because it is required to build and re-configure Bluetopia PM. Developers may choose to use Bluetopia instead of Bluetopia PM for simple applications or for use in platforms where available memory is limited. The Bluetopia distribution in [install-dir]/BluetopiaPM/Bluetopia includes Bluetopia samples ([install-dir]/BluetopiaPM/Bluetopia/bin) to help users get started using Bluetopia. Bluetopia documentation can be found in [install-dir]/Documentation/Bluetopia.
The PM Server[edit]
Pairing Mode[edit]
SS1BTPM is compiled to support secure simple pairing as the default configuration. If legacy pairing is needed instead, for example so that the user is forced to enter a fixed pin code, then it is possible to configure and recompile SS1BTPM to only support legacy pairing. To do this open <INSTALLATION_DIR>/BluetopiaPM/ss1btpm/server/BTPMSRVR.c in a text editor. Near the bottom of the file modify the assignment:
DefaultInitializationData.DefaultPairabilityModeSSP = TRUE;
and change TRUE to FALSE.
DefaultInitializationData.DefaultPairabilityModeSSP = FALSE;
After making this change next rebuild SS1BTPM using section 2.2 in this page
SS1BTPM is now compiled to support only legacy pairing. You will notice that the next time a device pairs with the target that the demo application will prompt the user for a pin code response. When this occurs respond with the PINCodeResponse command, for example PINCodeResponse 0000. The pin code used, 0000 in this example, must be the same on both devices.
Note: Keep in mind that Legacy Pairing is generally not as secure as Secure Simple Pairing. If security is a concern for your application then legacy pairing is not recommended. For more details on the security of Bluetooth pairing modes refer to the core specification which can be found on the Bluetooth SIG's website. Also note that, in the default configuration where secure simple pairing is enabled, legacy pairing is still supported. If a remote device attempts to connect to the target and the remote device only supports legacy pairing, the target will fall back to legacy pairing.