How to Compile App Against feature/ble/peripheral branch?

I checked out the branch feature/ble/peripheral and I’d like to be able to build an app against it. I do a:

make all PLATFORM=argon APPDIR=…/…/my-app

In the device-os/modules directory (like normal), however I get linking errors related to ble:

main.cpp:182: undefined reference to `hal_ble_init'
undefined reference to `ble_set_device_name'
undefined reference to `ble_set_scanning_params'
undefined reference to `ble_register_callback'
undefined reference to `ble_start_scanning'

What are the modifications (possibly to the makefile) that I would need to be able to link against these libraries? I took a look and it looks like those symbols are in libhal.a – however the default build script links against libhal-dynamic.

I’d love to be able to use the features in this branch, but it looks like the normal path for apps hasn’t been updated yet?

Best,
JLS

I believe the problem is that the BLE HAL has been completed in the branch, but there are two parts to the feature. Other other is the Wiring API, which exposes the HAL functions to the user application firmware.

Until the second part is done, you can only use monolithic firmware (build from firmware/main with MODULAR=n), which eliminates the separation between user and system firmware and allows user firmware to make direct calls into the system.

1 Like

Hi Rick,

Thanks for the quick response. I’ll try that and report back! Thanks!

Best,
JLS

Hi Rick,

So I was able to get a build with the following commands:

# git clone https://github.com/particle-iot/device-os.git
# cd device-os
# git checkout feature/ble/peripheral
# git submodule update --init
# cd device-os/main
# make all PLATFORM=argon APPDIR=../../my-app

This creates a binary in …/…/my-app/target/my-app.bin

Doing a flash:

particle flash skynet ../../my-app/target/my-app.bin

Results in my particle with a solid white light.

Any ideas what went wrong here? After that first flash, attempts to flash my particle appear to fail :frowning:

Best,
JLS

Small update:

I was able to switch back to the previous firmware and flash it back.

Question: When flashing to the non-modular build the first time, is it necessary to do it from the modules directory (so as to write the app and OS at the same time?)

When you switch to non-modular you should do the swap in USB mode:

particle flash --usb ../../my-app/target/my-app.bin

Or use the program-dfu option to make.

When you build MODULAR=n from main, the system is included in your binary so you don’t need to build from modules.

When you go back to modular, flash system-part-1 then your modular binary or tinker by USB. You need both going in the monolithic to modular direction.

1 Like

Hi Rick,

Super helpful, thanks! I’ve got it all sorted now… WITH ble features working now. I’m piecing together what I need to do by reading through the ble headers, but if there is any official (or draft) documentation I’d be happy to take a look!

Best,
JLS