Handling of external libraries (Zuno2)

Discussion about Z-Uno product. Visit http://z-uno.z-wave.me for more details.
Post Reply
aleconakad
Posts: 68
Joined: 18 Jan 2016 15:25

Handling of external libraries (Zuno2)

Post by aleconakad »

Hi,

I have a couple of libraries that I want to integrate in my sketch. The compiler cannot find these libraries even though they have been installed in a path specified within arduino.
The only way I can get these to compile is when I copy them to the same location of the delivered libraries within the toolchain, i.e. (on Mac)

Code: Select all

/Users/user/Library/Arduino15/packages/Z-Uno2/hardware/zw_cm4f/3.0.7/libraries/
But this makes it a bit hard for me to manage those libraries, because they might be deleted when a newer release is being used.

I checked the platform.txt config file:

Code: Select all

tools.zprog.cmd.libraries={runtime.platform.path}/libraries
Is there a way to include the library path that has been setup within Arduino using kind of environment variable?

Arduino -> Preferences... -> Sketchbook Location, and within that location add a library folder that includes all self managed libs?
amatilda
Posts: 60
Joined: 26 Sep 2021 22:09

Re: Handling of external libraries (Zuno2)

Post by amatilda »

Hello,
I have not found https://arduino.github.io/arduino-cli/0 ... ification/ a variable indicating the path, but as a workaround, you can explicitly specify the path to your library: -S "<your path>"

For example:
# ZUNO compile patterns
# ----------------------
recipe.hooks.sketch.prebuild.1.pattern = "{tools.zprog.cmd.path}" build "{build.path}/{build.project_name}" -S "{tools.zprog.cmd.cores}" -S "c:\Users\hapr-\OneDrive\Documents\Arduino\lib\" -S "{tools.zprog.cmd.libraries}" -S "{tools.zprog.cmd.include}" -B "{build.path}" -T "{tools.zprog.cmd.bin}" -O "arduino_ide" -lcl "{tools.zprog.cmd.clang_lib}" -O BO:-DARDUINO=152 -O BO:-DARDUINO_ARCH_ZUNOG2 -O BO:-DZME_ZUNOG2 -O LO:-lm
principia
Posts: 14
Joined: 28 Sep 2021 19:33

Re: Handling of external libraries (Zuno2)

Post by principia »

Hi
Thanks for the workaround. This works well but the library .h and .cpp source files need to be in the topmost directory of the library folder. The Arduino library specification notes "For backward compatibility with Arduino IDE 1.0.x, the library author may opt to place source code into the root folder, instead of the folder called src. In this case the 1.0 library format is applied and the source code is searched from the library root folder and the utility folder".

It looks like zme_make doesn't search down into the /src folder which is where Arduino 1.5.x+ libraries place the source code. I note that the ZUNO libraries in the zw_cm4f folder all have source files at the top level of the library folder.
michap
Posts: 437
Joined: 26 Mar 2013 10:35
Contact:

Re: Handling of external libraries (Zuno2)

Post by michap »

Hi,

you can copy it into the lib directory:
C:\Users\[username]\AppData\Local\Arduino15\packages\Z-Uno2\hardware\zw_cm4f\3.0.7\libraries
From here it will be taken by compiler.

But for design it is more easy to put it into sketch folder.

Please note that the folder can be removed after update to newer version - so keep a copy of your libs in a safe folder :)

Michael
Post Reply