Although I managed to get things working for Arduino framework / AVR, I have not managed to get this to work for mbed. It is failing in a way that I cannot really understand, even after looking at the verbose output.
Basically, the library is an Arduino compatible directory structure available to view here along with platformio.ini:
The library it depends on is IoAbstraction, I’ve included that locally using the method above.
On Arduino: all working, LiquidCrystalIO.h is found in the src directory. All builds and uploads fine.
On mbed: not working, LiquidCrystalIO.h is not found and as far as I can see the src directory is not included in the build path. Is this expected on mbed, is there something I’m missing?
This is not consistent with IoAbstraction, where it pulled in the src directory during the build.
What i see looking at the output is that the libraries src directory is never pulled in (full output can be put somewhere if needed):
Processing STM439 (platform: ststm32; board: nucleo_f439zi; framework: mbed; build_flags: -D_NO_EEPROM_CLASS_=1, -DPIO_FRAMEWORK_MBED_RTOS_PRESENT, -DIO_LOGGING_DEBUG=1; lib_extra_dirs: /Users/dave/Documents/Arduino/libraries/IoAbstraction)
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
CONFIGURATION: https://docs.platformio.org/page/boards/ststm32/nucleo_f439zi.html
PLATFORM: ST STM32 6.1.0 > ST Nucleo F439ZI
HARDWARE: STM32F439ZIT6 180MHz, 256KB RAM, 2MB Flash
DEBUG: Current (stlink) On-board (stlink) External (blackmagic, jlink)
PACKAGES:
- framework-mbed 6.51401.200402 (5.14.1)
- tool-dfuutil 1.9.200310
- tool-openocd 2.1000.190707 (10.0)
- tool-stm32duino 1.0.1
- toolchain-gccarmnoneeabi 1.70201.0 (7.2.1)
Collecting mbed sources...
LDF: Library Dependency Finder -> http://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Framework incompatible library /Users/dave/Documents/Arduino/libraries/LiquidCrystalIO/src
More details about "Library Compatibility Mode": https://docs.platformio.org/page/librarymanager/ldf.html#ldf-compat-mode
Found 17 compatible libraries
Scanning dependencies...
Dependency Graph
|-- <src> (/Users/dave/Documents/Arduino/libraries/IoAbstraction/src)
Building in release mode
Results in:
*************************************************************************
* Looking for LiquidCrystalIO.h dependency? Check our library registry!
*
* CLI > platformio lib search "header:LiquidCrystalIO.h"
* Web > https://platformio.org/lib/search?query=header:LiquidCrystalIO.h
*
*************************************************************************
#include "LiquidCrystalIO.h"
^~~~~~~~~~~~~~~~~~~
compilation terminated.
*** [.pio/build/STM439/src/helloMbed.o] Error 1
Directory structure:
% tree
.
├── README.md
├── examples
│ ├── Autoscroll
│ │ └── Autoscroll.ino
│ ├── Blink
│ │ └── Blink.ino
│ ├── Counter23017
│ │ └── Counter23017.ino
│ ├── Cursor
│ │ └── Cursor.ino
│ ├── CustomCharacter
│ │ └── CustomCharacter.ino
│ ├── Display
│ │ └── Display.ino
│ ├── HelloI2c
│ │ └── HelloI2c.ino
│ ├── HelloShiftReg
│ │ └── HelloShiftReg.ino
│ ├── HelloWorld
│ │ └── HelloWorld.ino
│ ├── Scroll
│ │ └── Scroll.ino
│ ├── SerialDisplay
│ │ └── SerialDisplay.ino
│ ├── TextDirection
│ │ └── TextDirection.ino
│ ├── helloMbed
│ │ └── helloMbed.cpp
│ └── setCursor
│ └── setCursor.ino
├── keywords.txt
├── library.json
├── library.properties
├── platformio.ini
└── src
├── LiquidCrystalIO.cpp
└── LiquidCrystalIO.h
Ini file to save going to link to take a look:
; Please visit documentation for the other options and examples
; https://docs.platformio.org/page/projectconf.html
[platformio]
src_dir = examples/helloMbed
lib_dir = .
; Sourcecode version that requires IoAbstraction installed in parent directory
; to use external deps during development, remove the -I build flag and add IoAbstraction
[env:ATmega2560]
platform = atmelavr
board = megaatmega2560
framework = arduino
upload_port = /dev/cu.usbmodem14101
;upload_port = COM3
monitor_speed = 115200
lib_deps = Wire
build_flags = -DIO_LOGGING_DEBUG=1
-DDEFAULT_TASK_SIZE=3
lib_extra_dirs = /Users/dave/Documents/Arduino/libraries/IoAbstraction
; source code version for mbed, that finds io abstraction in parent directory.
; to use external deps during development, remove the -I build flag and add IoAbstraction
[env:STM439]
platform = ststm32
board = nucleo_f439zi
framework = mbed
;upload_port = /dev/cu.usbmodem14103
;upload_port = COM8
;monitor_speed = 115200
build_flags = -D_NO_EEPROM_CLASS_=1
-DPIO_FRAMEWORK_MBED_RTOS_PRESENT
-DIO_LOGGING_DEBUG=1
lib_extra_dirs = /Users/dave/Documents/Arduino/libraries/IoAbstraction
The full output is too large to pasted into here, but if you wanted the full output I can attach. I don’t think I’ll be able to answer my own question this time 