This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Compiler/WILINK-BT_WIFI-WIRELESS_TOOLS: TI Bluetooth Stack with CCSv8 / MSP430 18.* Compiler

Part Number: WILINK-BT_WIFI-WIRELESS_TOOLS

Tool/software: TI C/C++ Compiler

I noticed that for users compiling the TI Dual-Mode Bluetooth Stack (originally Bluetopia) for the MSP430 with the latest Code Composer (v8.0 and above) (MSP Complier, 18.0 and above), that there will be a warning in the BTPSVEND.c file stating that the code will not load properly due to a 17 bit address being assigned to 16 bit variable. This is the part where it's downloading the patch file into the Bluetooth device over HCI. The patch must reside in high-flash due to size (ie. 0x10000 or above), so it will have an address > 16 bits.

Specifically, something like this:

build_system/Bluetopia/1.5-R2/MSP430_Experimentor/Bluetopia/btpsvend/BTPSVEND.c", line 350: warning: 
13:02:46    relocation from function "HCI_VS_InitializeAfterHCIReset" to symbol
13:02:46    "BasePatch" overflowed; the 17-bit relocated address 0x10000 is too large to
13:02:46    encode in the 16-bit field (type = 'R_MSP430X_ABS16' (15), file =
13:02:46    "msp/bluetooth/CMakeFiles/bluetooth.dir/home/ubuntu/.clariuscache/tools/blue
13:02:46    topia/Linux-x86_64/1.5-R2/MSP430_Experimentor/Bluetopia/btpsvend/BTPSVEND.c.
13:02:46    o", offset = 0x0000005e, section = ".text:HCI_VS_InitializeAfterHCIReset")
13:02:46 warning: output file "dist/release/bin/bluetooth.out" cannot be loaded and run
13:02:46    on a target system

I can see the logic in this error, so it's somewhat surprising it worked in previous compilers, however for those upgrading, this fix is relatively simple, as pointers can store addresses > 16 bits.

1. Update Download_Patch definition to make PatchPointer an actual pointer

static Boolean_t Download_Patch(unsigned int BluetoothStackID, unsigned int PatchLength, unsigned long* PatchPointer, Byte_t *ReturnBuffer, Byte_t *TempBuffer)

2. Call the function with a address to the patch pointer (typically defined in the patch file as a static unsigned long)

ie. Download_Patch(BluetoothStackID, BasePatchLength, &BasePatchPointer, ReturnBuffer, TempBuf));

3. Ensure variables and calls inside the Download_Patch function are of pointer type as well

unsigned long* Temp;

MovePatchBytes(&TempBuffer[4], Temp, TempBuffer[3]);

Good luck!