[Porting] General issues


1) Tedious to test a library

I wonder how the 3rd part library provider does their test… It seems like they make a library repo, whack the entire folder in the libraries folder and runs their examples to compile etc.

One method i used is to symlink.

The current setup for :particle: requires making another folder, paste the library and compile. I’m sure we have a better way to do this!

2) Migrate + Contribute not working

  • Tested using: https://github.com/kennethlimcp/spark-adxl345
  • particle library migrate: Library migrated to v2 format:
  • particle library contribute: This library could not be imported. Try another library or try this one again later.


β”œβ”€β”€ LICENSE
β”œβ”€β”€ README.md
β”œβ”€β”€ firmware
β”‚   β”œβ”€β”€ ADXL345.cpp
β”‚   β”œβ”€β”€ ADXL345.h
β”‚   β”œβ”€β”€ binary.h
β”‚   └── examples
β”‚       β”œβ”€β”€ 1_reg_print.cpp
β”‚       β”œβ”€β”€ 2_no_lib.cpp
β”‚       └── 3_run.cpp
└── spark.json


Library migrated to v2 format: '/Users/kennethlimcp/Desktop/Arduino-lib-official/spark-adxl345'
KENMBP:spark-adxl345 kennethlimcp$ tree
β”œβ”€β”€ LICENSE
β”œβ”€β”€ README.md
β”œβ”€β”€ examples
β”‚   β”œβ”€β”€ 1_reg_print
β”‚   β”‚   └── 1_reg_print.cpp
β”‚   β”œβ”€β”€ 2_no_lib
β”‚   β”‚   └── 2_no_lib.cpp
β”‚   └── 3_run
β”‚       └── 3_run.cpp
β”œβ”€β”€ library.properties
└── src
    β”œβ”€β”€ ADXL345
    β”‚   β”œβ”€β”€ ADXL345.h
    β”‚   └── binary.h
    β”œβ”€β”€ ADXL345.cpp
    β”œβ”€β”€ ADXL345.h
    └── binary.h

3.) We need to be able to use .ino in the src folder

Using the .cpp format requires me to create the function prototypes needed in the .ino file so that’s cubersome.


In .ino file

attachInterrupt(0, interruptRoutine, FALLING);

void interruptRoutine() {
  isr_flag = 1;

In .cpp file

void interruptRoutine();

attachInterrupt(0, interruptRoutine, FALLING);

void interruptRoutine() {
  isr_flag = 1;

4. Spaces in original library name

Adafruit_Sensor kennethlimcp$ p library contribute
Library is not valid. name must only contain letters, numbers, dashes and underscores

KENMBP:Adafruit_Sensor kennethlimcp$ cat library.properties 
name=Adafruit Unified Sensor
author=Adafruit <info@adafruit.com>
maintainer=Adafruit <info@adafruit.com>
sentence=Required for all Adafruit Unified Sensor based libraries.
paragraph=A unified sensor abstraction layer used by many Adafruit sensor libraries.

5. License required for each library

This is not a requirement in the Arduino 3rd party libraries so essentially this requirement makes all ported libraries different from the upstream.


I seem to have a similar issue, reported here

Having a way to have CLI build an embedded example of the library before you contribute/publish (whithout the extra work of setting up a test project) would be good.


Thanks for this feedback kenneth!

To make developing and testing libraries easier, we will add a way to compile examples in the library, so the examples can help drive feature development of the library.

The user will be able to cd into an examples folder and run the usual particle compile/flash commands. The tool will internally create a new project on the fly with the library sources and send that to the cloud for compiling.

We will add .ino support in the src folder. (cc: @suda) and also in the examples folder

Spaces in the library name is not supported. The library should be renamed to use dashes or underscores. This is necessary to bring the libraries in line with the arduino spec. Also spaces are evil when used with filenames - they cause lots of trouble! :slight_smile:

We can make the license optional for contribution, but I think it should be mandatory for publishing, unless we can get clarity on what a non-licensed library means - it is implicitly in the public domain?


The status should remain the same as how the library was originally created. If the 3rd party library provider for Arduino did not provide a license, then it should stay the same.

It just really means more work for a simple port when licensing is mandatory.