PlatformIO unable to resolve Keyboard / HID / PluggableUSB dependency? - arduino

My development environment consists of a Teensy 3.5, PlatformIO, and CLion. How can I make use of the standard Arduino Keyboard library?
I'm working on a project to convert a previously RS422-based device to USB. Earlier on, I used the (sadly rather horrible) Arduino IDE so I know that my code for when to send which keystrokes should work; the problem is getting the new IDE and compiler to understand the dependencies.
All along, I've been using the Serial interface to provide debug output, so I know that Serial works just fine. Ditto for using the Keyboard library from within the Arduino IDE.
However, after switching to CLion and adapting to the PlatformIO framework, I ran into problems when it came time to include the Keyboard library.
The line
#include <Arduino.h>
resolves to the file ~/.platformio/packages/framework-arduinoteensy/cores/teensy3/Arduino.h which itself seems to simply be a shim for ~/.platformio/packages/framework-arduinoteensy/cores/teensy3/WProgram.h which implements the expected Arduino functionality.
However, the line
#include <Keyboard.h>
resolves to the file ~/.platformio/packages/framework-arduinoteensy/cores/teensy3/Keyboard.h which quite frankly states that it is an empty Keyboard.h file, for compability with Arduino's Keyboard examples and does not implement anything.
I have been trying to find ways of importing the original Arduino library (by way of platformio.ini, but it seems to depend on HID and PluggableUSB that I simply cannot find.
Here is my current platformio.ini file:
[env:teensy35]
platform = teensy
board = teensy35
framework = arduino
; Avoid the Teensy loader gui app
upload_protocol = teensy-cli
lib_deps =
Keyboard
and this is the build output I am getting:
====================[ Build | Production | teensy35 ]===========================
~/.local/share/JetBrains/Toolbox/apps/CLion/ch-0/223.8617.54/bin/cmake/linux/x64/bin/cmake --build ~/code/teensy-axial/cmake-build-teensy35 --target Production -j 6
[1/1] cd ~/code/teensy-axial && platformio -c clion run -eteensy35
FAILED: CMakeFiles/Production ~/code/teensy-axial/cmake-build-teensy35/CMakeFiles/Production
cd ~/code/teensy-axial && platformio -c clion run -eteensy35
Processing teensy35 (platform: teensy; board: teensy35; framework: arduino)
--------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/teensy/teensy35.html
PLATFORM: Teensy (4.17.0) > Teensy 3.5
HARDWARE: MK64FX512 120MHz, 255.99KB RAM, 512KB Flash
DEBUG: Current (jlink) External (jlink)
PACKAGES:
- framework-arduinoteensy # 1.157.220801 (1.57)
- toolchain-gccarmnoneeabi # 1.50401.190816 (5.4.1)
LDF: Library Dependency Finder -> [redacted for StackExchange]
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 94 compatible libraries
Scanning dependencies...
Dependency Graph
|-- Keyboard # 1.0.4
Building in release mode
Compiling .pio/build/teensy35/src/AxialKeyboard.cpp.o
Compiling .pio/build/teensy35/src/main.cpp.o
Compiling .pio/build/teensy35/lib882/Keyboard/Keyboard.cpp.o
Compiling .pio/build/teensy35/lib882/Keyboard/KeyboardLayout_da_DK.cpp.o
Compiling .pio/build/teensy35/lib882/Keyboard/KeyboardLayout_de_DE.cpp.o
In file included from .pio/libdeps/teensy35/Keyboard/src/Keyboard.cpp:22:0:
.pio/libdeps/teensy35/Keyboard/src/Keyboard.h:25:17: fatal error: HID.h: No such file or directory
*************************************************************
* Looking for HID.h dependency? Check our library registry!
*
* CLI > platformio lib search "header:HID.h"
* Web > https://registry.platformio.org/search?q=header:HID.h
*
*************************************************************
compilation terminated.
[...]
I have obviously visited the registry as suggested and tried to implement both mitchman631/HID and levi--g/USBLibrarySTM32 but still I end up missing either HID or PluggableUSB dependencies, and I cannot find a PluggableUSB.h file anywhere. Surely, there must be something fundamental I am not seeing?
Amending platformio.ini with the path to the Arduino libraries did not resolve the error.
lib_extra_dirs =
/usr/share/arduino/libraries
so I removed these lines again.
I have also tried enabling the --verbose option by copying the command from the above output:
~/.local/share/JetBrains/Toolbox/apps/CLion/ch-0/223.8617.54/bin/cmake/linux/x64/bin/cmake --verbose --build ~/code/teensy-axial/cmake-build-teensy35
but oddly that results in
CMake Error: Unknown argument --build
even though it should know it:
~/.local/share/JetBrains/Toolbox/apps/CLion/ch-0/223.8617.54/bin/cmake/linux/x64/bin/cmake --help | grep build
cmake [options] <path-to-existing-build>
cmake [options] -S <path-to-source> -B <path-to-build>
Specify a source directory to (re-)generate a build system for it in the
current working directory. Specify an existing build directory to
re-generate its build system.
-B <path-to-build> = Explicitly specify a build directory.
-G <generator-name> = Specify a build system generator.
--build <dir> = Build a CMake-generated project binary tree.
I suspect my question is similar to this one, although my problem is with adding any library.

Related

pcl/pcl_config.h: No such file or directory

My environment is below.
・Operating System and version:windows 10 64bit
・Compiler:C:\msys64\mingw64\bin\g++.exe
・PCL Version:1.9.1
pcl_config.h not found as below error occurred when compiled under above env..
Certainly this header file is not included.
Let me know how to solve it.
PS C:\pcl\pcl\examples\common> g++ -o minmax -I ../../io/include -I ../../common/include .\example_get_max_min_coordinates.cpp
In file included from ../../common/include/pcl/PCLHeader.h:10,
from ../../common/include/pcl/point_cloud.h:47,
from ../../io/include/pcl/io/pcd_io.h:42,
from .\example_get_max_min_coordinates.cpp:2:
../../common/include/pcl/pcl_macros.h:64:10: fatal error: pcl/pcl_config.h: No such file or directory
#include
^~~~~~~~~~~~~~~~~~
compilation terminated.
Short answer
pcl_config.h is generated via pcl_config.h.in by the cmake tool. So it seems that compilation did not finish correctly.
Longer answer
Please make sure you have compiled the relevant modules of PCL (at least pcl-core) before proceeding
You might prefer a pre-built installation from releases or distributed by a package/source manager of your choice
PCL makes heavy use of other libraries and it is best to supply the dependencies (as mentioned below) via CMake or manually via the -I and -l options. If you provide the location of pcl_config.h, the compiler will complain about Eigen next.
The build instructions are available here. TL;DR: After satisfying the dependencies (cmake, c++ compiler, boost, eigen, flann, vtk and other depending on use-case), run the following commands
cd $PCL_SOURCE_DIR
mkdir -p build; cd build
cmake -DCMAKE_BUILD_TYPE=Release ..
make -j8
Feel free to use any build generator (like Ninja) or change build type to Debug or RelWithDebInfo as per your needs.

Arduino IDE - fails to link compiled subsections in avr-gcc

Hello StackOverflow Community,
Recently I have been noticing that my Arduino IDE has simply been failing to actually be able to compile and run to any board, from the TTN Uno (which is a smaller Arduino Leonardo), ESP8266 (both in module and WeMos), to the Arduino Uno (R3 SmD version).
I enabled verbose output from the compilers inside of the IDE's preferences. and the lines that it crashes on is when the file .o files get compressed into the final .hex that the avrdude (or esptool) finally pushes into the programmable flash that the boards utilize to operate.
Linking everything together...
"C:\Program Files (x86)\Arduino\hardware\tools\avr/bin/avr-gcc" -w -Os -g -flto -fuse-linker-plugin -Wl,--gc-sections -mmcu=atmega328p -o "C:\Users\JTamez\AppData\Local\Temp\arduino_build_806309/sketch_jun27a.ino.elf" "C:\Users\JTamez\AppData\Local\Temp\arduino_build_806309\sketch\sketch_jun27a.ino.cpp.o" "C:\Users\JTamez\AppData\Local\Temp\arduino_build_806309\libraries\DHT-sensor-library\DHT.cpp.o" "C:\Users\JTamez\AppData\Local\Temp\arduino_build_806309\libraries\DHT-sensor-library\DHT_U.cpp.o" "C:\Users\JTamez\AppData\Local\Temp\arduino_build_806309\libraries\TheThingsNetwork\appData.pb.c.o" "C:\Users\JTamez\AppData\Local\Temp\arduino_build_806309\libraries\TheThingsNetwork\deviceData.pb.c.o" "C:\Users\JTamez\AppData\Local\Temp\arduino_build_806309\libraries\TheThingsNetwork\pb_common.c.o" "C:\Users\JTamez\AppData\Local\Temp\arduino_build_806309\libraries\TheThingsNetwork\pb_decode.c.o" "C:\Users\JTamez\AppData\Local\Temp\arduino_build_806309\libraries\TheThingsNetwork\pb_encode.c.o" "C:\Users\JTamez\AppData\Local\Temp\arduino_build_806309\libraries\TheThingsNetwork\CayenneLPP.cpp.o" "C:\Users\JTamez\AppData\Local\Temp\arduino_build_806309\libraries\TheThingsNetwork\TheThingsMessage.cpp.o" "C:\Users\JTamez\AppData\Local\Temp\arduino_build_806309\libraries\TheThingsNetwork\TheThingsNetwork.cpp.o" "C:\Users\JTamez\AppData\Local\Temp\arduino_build_806309\libraries\Timer\Event.cpp.o" "C:\Users\JTamez\AppData\Local\Temp\arduino_build_806309\libraries\Timer\Timer.cpp.o" "C:\Users\JTamez\AppData\Local\Temp\arduino_build_806309/core\core.a" "-LC:\Users\JTamez\AppData\Local\Temp\arduino_build_806309" -lm
wiring.c.o (symbol from plugin): In function `__vector_16':
(.text+0x0): multiple definition of `init'
C:\Users\JTamez\AppData\Local\Temp\arduino_build_806309\sketch\sketch_jun27a.ino.cpp.o (symbol from plugin):(.text+0x0): first defined here
collect2.exe: error: ld returned 1 exit status
I am not sure why wiring.c is now causing issues when it has consistently worked for so long. Is this a side effect of corruption, or a external library affecting it? All the Libraries I am using are listed below:
Using library DHT-sensor-library at version 1.3.0 in folder: C:\Program Files (x86)\Arduino\libraries\DHT-sensor-library
Using library Adafruit_Sensor at version 1.0.2 in folder: C:\Program Files (x86)\Arduino\libraries\Adafruit_Sensor
Using library TheThingsNetwork at version 2.5.10 in folder: C:\Users\JTamez\Documents\Arduino\libraries\TheThingsNetwork
Using library EEPROM at version 2.0 in folder: C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\EEPROM
Using library Timer in folder: C:\Program Files (x86)\Arduino\libraries\Timer (legacy)
Any help would be greatly appreciated.
I apologize everyone, I figured out that a method I created called 'init()' was interfering with init() inside of wiring.c

Cross compiling and deploying Valgrind to an embedded linux device

I am trying to cross compile Valgrind on my Fedora VM in order to get it to run on a custom embedded Linux device (running Yacto with a Kinetis KL2x MCU w/ ARM Cortex M4 CPU). I have a QT IDE properly configured to cross compile and deploy QT projects to the device. I was wondering what the best route to cross compile a non QT application. I tried making a new project (in QT>New Project>Import Project>Import Existing Project) using an existing project (Valgrind source code # http://valgrind.org/downloads/valgrind-3.12.0.tar.bz2) and i keep getting this error:
17:20:46: Running steps for project valgrind...
17:20:46: Starting: "/usr/bin/make" all
make: *** No rule to make target `all'. Stop.
17:20:46: The process "/usr/bin/make" exited with code 2.
Error while building/deploying project valgrind (kit: ----)
When executing step "Make"
17:20:46: Elapsed time: 00:00.
and I am not sure how to address it. Is it possible to compile Valgrind just using the cross compiler itself (arm-poky-linux-gnueabi-g++)? Am I better off changing the makefile to use the cross compiler instead of gcc and then use scp to send the file to my device(if so which of the many different makefiles do i use?)? Or is there a better way that I am missing? The system doesn't have any package management tools or compilers of its own. Any help/ input will be GREATLY appreciated.
Errors while building recipe after cross compile environment setup:
[----#localhost valgrind]$ source /opt/poky/default/environment-setup-cortexa8hf-vfp-neon-poky-linux-gnueabi
[----#localhost valgrind]$ bitbake -c build valgrind_3.12.0.bb
Traceback (most recent call last):
File "/opt/poky/1.8.2/sysroots/i686-pokysdk-linux/usr/lib/python2.7/site.py", line 553, in <module>
main()
File "/opt/poky/1.8.2/sysroots/i686-pokysdk-linux/usr/lib/python2.7/site.py", line 535, in main
known_paths = addusersitepackages(known_paths)
File "/opt/poky/1.8.2/sysroots/i686-pokysdk-linux/usr/lib/python2.7/site.py", line 266, in addusersitepackages
user_site = getusersitepackages()
File "/opt/poky/1.8.2/sysroots/i686-pokysdk-linux/usr/lib/python2.7/site.py", line 241, in getusersitepackages
user_base = getuserbase() # this will also set USER_BASE
File "/opt/poky/1.8.2/sysroots/i686-pokysdk-linux/usr/lib/python2.7/site.py", line 230, in getuserbase
from sysconfig import get_config_var
File "/opt/poky/1.8.2/sysroots/i686-pokysdk-linux/usr/lib/python2.7/sysconfig.py", line 10, in <module>
'stdlib': '{base}/'+sys.lib+'/python{py_version_short}',
AttributeError: 'module' object has no attribute 'lib'
An example of cross compiling valgrind with Yocto toolchain would be :
# setup workspace
mkdir workspace && cd workspace
# download Yocto sdk
wget http://gumstix-yocto.s3.amazonaws.com/sdk.sh
#Install it to workspace/sdk
./sdk.sh
source sdk/environment-setup-cortexa8hf-neon-poky-linux-gnueabi
# download valgrind tarball
wget http://valgrind.org/downloads/valgrind-3.12.0.tar.bz2
# extract source
tar jxf valgrind-3.12.0.tar.bz2 && cd valgrind-3.12.0
# this fix issue with unknown arm architecture (see http://stackoverflow.com/questions/29514706/cross-compiling-valgrind-for-arm)
sed -i -e "s#armv7#arm#g" configure
./configure --host=arm-poky-linux-gnueabi --prefix="$(pwd)/out"
make -j16
make install
Here, the installation directory is out, you can also install to ${SDKTARGETSYSROOT}/usr with --prefix="${SDKTARGETSYSROOT}/usr"
Check this link for the basic example of cross compile with Yocto SDK
i think the easiest way is to build it in your yocto build environment
(source poky/oe_init_build_env)
and the build valgrind with
bitbake -c build valgrind
then look in the build folder tmp/work/"plattform"/valgrind/"version"/image/ for the files

how to recompile Qt statically?

I searched whole internet for this problem.
I want compile Qt statically to run my program without any DLL.
I read several instructions in the internet.that they all told me sth like this:
cd %qtdir%
configure -static -[other option]
make sub-src
but when I use make in cmd,I get this error :
'make' is not recognized as an internal or external command,operable program or batch file.
and I tried nmake and mingw32-make too. I don't know in what qt directory I must do this.
I wanna a very simple instruction...
In Linux the default compiler is g++, which provices "make". If you are on Windows, and you want to use "make", you need to install the mingw distribution[1].
As pointed out by Dídac Pérez, if you want to use the MSVC compiler[2], you should use the visual studio command prompt, that sets all the environmental variables for you by calling a bat file.
Therefore the instructions would be:
open a visual studio command prompt and navigate to your Qt source
directory
type "make confclean" to remove traces from a previous compilation
setup a static configuration, by passing the adequate flag (e.g.:
"configure -static ")
type "nmake" to call the visual studio compiler
get a cup of coffee and wait a couple of hours (depending on your
processor(s) :-))
[1]http://www.mingw.org/
[2]http://www.visualstudio.com/en-us/downloads#d-2010-express

Sqlite 3.7.15 Crosss compilation for ARM

I am using SQLite 3 for Database management in my ARM9 based microprocessor.
I want to cross compile the latest version of the SQLite 3 for my project in Linux (Ubuntu 10.04). I am using the arm-none-linux-gnueabi-gcc compiler for development.
I tried to cross compile using following commands,
Downloaded the sqlite-amalgamation-3.7.0.tar
I extract it and then write the following command on Terminal,
sudo ./configure --exec-prefix=/media/8CCC8E9BCC8E7F68/SQLIte3/sqliteinstall/ --host=arm --target=arm CC=/opt/arm-2011.03/bin/arm-none-linux-gnueabi-gcc AR=/opt/arm-2011.03/bin/arm-none-linux-gnueabi-ar STRIP=/opt/arm-2011.03/bin/arm-none-linux-gnueabi-strip RANLIB=/opt/arm-2011.03/bin/arm-none-linux-gnueabi-ranlib CFLAGS="-Os"
It successfully cross compiled the SQLite.
Then,
sudo make command.
It successfully run.
Now "make install " command.
It did not give me an error but when i went to the config.log file i found there is some sentences as following,
1.conftest.c:17:7: error: size of array 'off_t_is_large' is negative
2.conftest.c:12:28: fatal error: ac_nonexistent.h: No such file or directory
compilation terminated.
3.conftest.cpp:23:28: error: ac_nonexistent.h: No such file or directory
4.conftest.c:67:13: error: invalid type argument of unary '*' (have 'int')
I doubt that weather it has been cross compiled properly or not.
I can not understand.
I inserted the library on my board it works fine but the problem is that the speed got very slow. I think there is some problem that i have not set any flags for the GCC compiler.
I could not find any options.How I can set the particular flags for the GCC compiler so that unnecessary features can be omitted.
You probably shouldn't try to do cross-compilation manually. Instead, use an embedded Linux build system that will do that for you, and automate the cross-compilation process entirely. My favourite is of course Buildroot (http://buildroot.org), but there are plenty of others (with varying levels of quality, complexity and features) : OpenEmbedded, Yocto, PTXdist, etc.

Resources