Bluetooth Low Energy (a.k.a Bluetooth LE, BTLE, Bluetooth Smart)

Building with arm-gcc

08 Nov 2014

done. master branch builds now!

08 Nov 2014

I built both my build and Sandy's build on my Ubuntu VM and got the same result. It creates a BLE_HEART_RATE.elf and BLE_HEART_RATE.hex files but no combined.hex. Please see the error in pastebin below. I flashed the BLE_HEART_RATE.hex file to the hardware, but it did not work(NO LED BLINK and no advertising)

http://pastebin.com/M1v29zfp

08 Nov 2014

@rah dev: your error was: make[2]: srec_cat: Command not found.

please install srec_cat through

$ sudo apt-get install srecord

09 Nov 2014

@rah dev: in the case of Nordic, the application assumes the use of the softdevice ABI, and so it must be combined with the softdevice into a combined.hex. This is accomplished with a tool called srec_cat. It is useful to familiarize onself with that tool.

09 Nov 2014

@Rohit @Sandeep Thanks guys for your help! I have a successful build and combined.hex file on my MacOSX Ubuntu 14.04.1 VM. Successfully tested it on the hardware as well (blinking LED and found HRM Peripheral on my central device).

09 Nov 2014

@raheem: that's lovely to hear. Now would it be possible for you to spend a little time investigating how to build the same on Mac? Lots of users would be able to benefit from that. I remember a little about the link error you mentioned. Perhaps the linker was unable to find the 'start' address. There's an linker option (I believe -e) which allows one to specify that, but please do some research around that. Essentially, the start address for the application needs to be 0x16000, but then this is not necessary to be specified because the soft-device will assume that the application is located at this address. When the process starts, control is taken to address 0x0, where the reset-vector then jumps to soft-device initialization. The soft-device forwards control to the application at the known address of 0x16000 (for V7 of the soft-device). Please try specifying address 0x16000 as the start address for the application even if it is not necessary to do so; we just need to satisfy the linker.

09 Nov 2014

and now for someone to help port the same build system to llvm-arm. Users would benefit from having at least 2 open toolchains to compare. Furthermore, having the ability to compile using multiple toolchains is always a good thing for portability.

any takers?

11 Nov 2014

Rohit Grover wrote:

@raheem: that's lovely to hear. Now would it be possible for you to spend a little time investigating how to build the same on Mac? Lots of users would be able to benefit from that. I remember a little about the link error you mentioned. Perhaps the linker was unable to find the 'start' address. There's an linker option (I believe -e) which allows one to specify that, but please do some research around that. Essentially, the start address for the application needs to be 0x16000, but then this is not necessary to be specified because the soft-device will assume that the application is located at this address. When the process starts, control is taken to address 0x0, where the reset-vector then jumps to soft-device initialization. The soft-device forwards control to the application at the known address of 0x16000 (for V7 of the soft-device). Please try specifying address 0x16000 as the start address for the application even if it is not necessary to do so; we just need to satisfy the linker.

@Rohit I got it to build on MacOSX Yosemite and successfully tested combined.hex on hardware. I had to do the following to get it to work (note: When Sandeep mentioned removing -WI,-search_paths_first before, I did not know where to remove it from initially, but I found it in the link.txt file):

brew install srecord

cmake ..

remove “-Wl,-search_paths_first” from the projects/BLE_HeartRate/Build/CMakeFiles/BLE_HEART_RATE.elf.dir/link.txt file

make

11 Nov 2014

Rah Dev wrote:

@Rohit I got it to build on MacOSX Yosemite and successfully tested combined.hex on hardware. I had to do the following to get it to work (note: When Sandeep mentioned removing -WI,-search_paths_first before, I did not know where to remove it from initially, but I found it in the link.txt file):

brew install srecord

cmake ..

remove “-Wl,-search_paths_first” from the projects/BLE_HeartRate/Build/CMakeFiles/BLE_HEART_RATE.elf.dir/link.txt file

make

Mac user here as well.

You can disable the linker flags by adding this to your CMakeLists.txt:

if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
    set(CMAKE_CXX_LINK_FLAGS "")
endif()
11 Nov 2014

pushed Marcus' changes to repo

11 Nov 2014

Thanks Marcus...tested and works fine. Build procedure is now the same for Mac just make sure to run

brew install srecord

first if you get srec_cat:command not found

11 Nov 2014

@RahDev, @Marcus: could one of you please send me the unified CMakeLists.txt (or post it yourself) so that others can get it without having to read through all the posts on this thread? thanks.

12 Nov 2014

@Rohit Sent unified CmakeLists.txt to you.

12 Nov 2014

@rohit - my repo has the conditional check in the cmakelists

https://github.com/sandys/mbed-nrf51-gcc-test/

12 Nov 2014

Updated the CMakeLists.txt attached to the main post.

03 Apr 2015

Very nuce guide!!! Thank you