SX1276Lib not compatible with MBED framework


#1

Doesn’t appear to be getting any traction here, posted it as an issue.

platformio.ini:

[env:disco_l072cz_lrwan1]
platform = ststm32
board = disco_l072cz_lrwan1
lib_deps = SX1276Lib
framework = mbed

When using the SX1276Lib library with ststm32, PIO adds the library include path to the compilation of the framework itself (command line has been edited for clarity):

arm-none-eabi-g++
-DPLATFORMIO=30502
-DSTM32L072xx
-I.piolibdeps/SX1276Lib_ID2757
-I/home/epoulsen/.platformio/packages/framework-mbed
-I/home/epoulsen/.platformio/packages/framework-mbed
... other includes ...
-o .pioenvs/disco_l072cz_lrwan1/FrameworkMbedCore/drivers/FlashIAP.o
/home/epoulsen/.platformio/packages/framework-mbed/drivers/FlashIAP.cpp

The problem being the “-I.piolibdeps/SX1276Lib_ID2757”. FlashIAP.cpp includes “debug.h”, which is presumably found in the other includes, but it finds the one in the .piolibdeps/SX1276Lib_ID2757 directory, instead, resulting this, which only happens if you include that library in platformio.ini

[Tue May 22 16:20:22 2018] Processing disco_l072cz_lrwan1 (platform: ststm32; board: disco_l072cz_lrwan1; framework: mbed)
-------------------------------------------------------------------------------------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
PLATFORM: ST STM32 > ST DISCO-L072CZ-LRWAN1
SYSTEM: STM32L072CZ 32MHz 20KB RAM (192KB Flash)
DEBUG: CURRENT(stlink) ON-BOARD(stlink) EXTERNAL(blackmagic, jlink)
Library Dependency Finder -> http://bit.ly/configure-pio-ldf
LDF MODES: FINDER(chain) COMPATIBILITY(light)
Collected 16 compatible libraries
Scanning dependencies...
Dependency Graph
|-- <SX1276Lib>
Compiling .pioenvs/disco_l072cz_lrwan1/FrameworkMbedCore/drivers/FlashIAP.o
Compiling .pioenvs/disco_l072cz_lrwan1/FrameworkMbedCore/drivers/SPI.o
Compiling .pioenvs/disco_l072cz_lrwan1/FrameworkMbedCore/drivers/SPISlave.o
Compiling .pioenvs/disco_l072cz_lrwan1/FrameworkMbedCore/drivers/Serial.o
In file included from /home/epoulsen/.platformio/packages/framework-mbed/platform/NonCopyable.h:21:0,
from /home/epoulsen/.platformio/packages/framework-mbed/platform/PlatformMutex.h:26,
from /home/epoulsen/.platformio/packages/framework-mbed/drivers/FlashIAP.h:29,
from /home/epoulsen/.platformio/packages/framework-mbed/drivers/FlashIAP.cpp:26:
/home/epoulsen/.platformio/packages/framework-mbed/platform/mbed_debug.h: In function 'void debug(const char*, ...)':
/home/epoulsen/.platformio/packages/framework-mbed/platform/mbed_debug.h:40:20: error: redefinition of 'void debug(const char*, ...)'
static inline void debug(const char *format, ...) {
^~~~~
In file included from /home/epoulsen/.platformio/packages/toolchain-gccarmnoneeabi/arm-none-eabi/include/c++/7.2.1/bits/stl_algobase.h:69:0,
from /home/epoulsen/.platformio/packages/toolchain-gccarmnoneeabi/arm-none-eabi/include/c++/7.2.1/algorithm:61,
from /home/epoulsen/.platformio/packages/framework-mbed/drivers/FlashIAP.cpp:25:
.piolibdeps/SX1276Lib_ID2757/debug/debug.h:56:20: note: 'void debug(const char*, ...)' previously defined here
static inline void debug(const char *format, ...) {}
^~~~~
*** [.pioenvs/disco_l072cz_lrwan1/FrameworkMbedCore/drivers/FlashIAP.o] Error 1
================================================================= [ERROR] Took 1.11 seconds =================================================================

Was there a rationale for prepending library include paths to the general framework includes?


Getting started modifying PIO build process, specifically around hacking platform build scripts
#2