sandeepmistry / arduino-BLEPeripheral

An Arduino library for creating custom BLE peripherals with Nordic Semiconductor's nRF8001 or nR51822.
MIT License
461 stars 179 forks source link

Several fatal errors when compiling using library in Platformio #255

Open ASL07 opened 5 years ago

ASL07 commented 5 years ago

Hi,

After installing the library in PlatformIO (VSCode) I get several compilation errors. Output below. I see that some of them can be caused by not selecting a SoftDevice, however, they are related to Arduino IDE. How can I select a SoftDevice in PlatformIO?

> Executing task: platformio run <

Processing nrf52_dk (platform: nordicnrf52; board: nrf52_dk; framework: arduino)
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
LibraryManager: Installing id=259
Downloading...
Unpacking  [####################################]  100%
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/nordicnrf52/nrf52_dk.html
PLATFORM: Nordic nRF52 > Nordic nRF52-DK
HARDWARE: NRF52832 64MHz 64KB RAM (512KB Flash)
DEBUG: CURRENT(jlink) ON-BOARD(cmsis-dap, jlink) EXTERNAL(blackmagic, stlink)
Library Dependency Finder -> http://bit.ly/configure-pio-ldf
LDF MODES: FINDER(chain) COMPATIBILITY(soft)
Collected 3 compatible libraries
Scanning dependencies...
Dependency Graph
|-- <BLEPeripheral> 0.4.0
Compiling .pioenvs/nrf52_dk/src/main.cpp.o
Compiling .pioenvs/nrf52_dk/lib9b7/BLEPeripheral_ID259/BLEAttribute.cpp.o
Compiling .pioenvs/nrf52_dk/lib9b7/BLEPeripheral_ID259/BLEBondStore.cpp.o
Compiling .pioenvs/nrf52_dk/lib9b7/BLEPeripheral_ID259/BLECentral.cpp.o
.piolibdeps/BLEPeripheral_ID259/src/BLEBondStore.cpp:11:12: fatal error: nrf_soc.h: No such file or directory

*****************************************************************
* Looking for nrf_soc.h dependency? Check our library registry!
*
* CLI  > platformio lib search "header:nrf_soc.h"
* Web  > https://platformio.org/lib/search?query=header:nrf_soc.h
*
*****************************************************************

#include <nrf_soc.h>
^~~~~~~~~~~
compilation terminated.
*** [.pioenvs/nrf52_dk/lib9b7/BLEPeripheral_ID259/BLEBondStore.cpp.o] Error 1
In file included from .piolibdeps/BLEPeripheral_ID259/src/BLEPeripheral.h:24:0,
from .piolibdeps/BLEPeripheral_ID259/src/BLECentral.cpp:6:
.piolibdeps/BLEPeripheral_ID259/src/nRF51822.h:11:12: fatal error: ble_gatts.h: No such file or directory

*******************************************************************
* Looking for ble_gatts.h dependency? Check our library registry!
*
* CLI  > platformio lib search "header:ble_gatts.h"
* Web  > https://platformio.org/lib/search?query=header:ble_gatts.h
*
*******************************************************************

#include <ble_gatts.h>
^~~~~~~~~~~~~
compilation terminated.
*** [.pioenvs/nrf52_dk/lib9b7/BLEPeripheral_ID259/BLECentral.cpp.o] Error 1
=================================================================================================== [ERROR] Took 6.91 seconds ===================================================================================================
The terminal process terminated with exit code: 1

Terminal will be reused by tasks, press any key to close it.
stefaandesmet2003 commented 5 years ago

i use this for platformio.ini, and it works. DNRF_51822_DEBUG is convenient for debug print output from BLEPeripheral, because BLE doesn't like to be halted by a debugger (don't yet understand why ..)

[env:whatever] platform = nordicnrf51 board = your_board framework = arduino ;-> use S110 softdevice build_flags = -DS110, -DNRF51_S110, -g3, -Og, -DNRF_51822_DEBUG build_unflags = -Os, -O1, -O2, -O3, -g1 lib_deps = BLEPeripheral monitor_speed = 115200

XlashDev commented 2 years ago

Commenting here in case someone encounters this again with nrf52DK. libdeps can be installed via library manager. I'm using S132.

[env:nrf52_dk]

platform = nordicnrf52 board = nrf52_dk framework = arduino build_flags = -DNRF52_S132 lib_deps = sandeepmistry/BLEPeripheral@^0.4.0