- Start
- Setup XCS and RPi
- Setup RPi Network and SSH
- Setup RPi Peripherals
- Setup Cross-compile environment
- Cross-compile and Install Userland
- Cross-compile and Install OpenCV
- Cross-compile and Install ROS
- Compile and Install OpenCV
- Compile and Install ROS
- Remote ROS (RPi node and XCS master)
- ROS package development (RPi/XCS)
- > Compile and Install WiringPi
TO BE UPDATED. GUIDE MIGHT STILL WORK.
Library to control GPIO / PWM on the Raspberry Pi using wiringPi
Steps on this page are derived from http://wiringpi.com/download-and-install/
No additional packages are required
Note: As compilation-process of the library polls several hardware features, the library itself cannot be crosscompiled and needs to be build on the RPi itself.
-
Download code in
src
dir ofrootfs
.XCS~$ cd ~/rpi/rootfs/usr/src XCS~$ git clone git://git.drogon.net/wiringPi
-
Copy the PkgConfig .pc file for wiringPi from this repository to
rootfs
. The upcoming build process does not create it, while it is needed for cmake to build and cross-compile code depending on wiringPi.XCS~$ cp ~/rpicross_notes/hello/wiringpi/wiringpi.pc ~/rpi/rootfs/usr/share/pkgconfig/
-
Sync
rootfs
to RPiXCS~$ ~/rpicross-notes/scripts/sync—vm-rpi.sh
-
Build on RPi
XCS~$ ssh rpizer-local RPI~$ cd /usr/src/wiringPi RPI~$ sudo ./build
-
Sync updates to VM
XCS~$ ~/rpicross-notes/scripts/sync-rpi-xcs.sh
Testing the compiled and installed wiringPi libraries with a PWM signal.
Prerequisites:
- Toolchain installed
- Repository initialised
- WiringPi installed and synchronised
- wiringpi.pc installed
Steps:
-
To see a fading LED, you should connect a LED to GPIO18. How to connect the LED is described here.
-
Build the code with the rpi-generic-toolchain
XCS~$ mkdir -p ~/rpi/build/hello/wiringpi XCS~$ cd ~/rpi/build/hello/wiringpi XCS~$ cmake \ -D CMAKE_TOOLCHAIN_FILE=/home/pi/rpicross_notes/rpi-generic-toolchain.cmake \ ~/rpicross_notes/hello/wiringpi XCS~$ make
-
Sync and run.
XCS~$ scp wpi rpizero-local:~/ XCS~$ ssh -X rpizero-local RPI~$ sudo ./wpi Raspberry Pi wiringPi PWM test program Iteration: 5/ 5 - Brightness: 0/1024 Done
When an application uses both wiringPi
and requires Xserver to run the application, errors might be encountered when using sudo
:
...
X11 connection rejected because of wrong authentication.
...
This error means that the created connection to Xserver does not allow root
to setup a window. Presumably, the original connection to the RPi was created by the user pi
:
XCS~$ ssh -X pi@rpizero-local
When connecting via SSH as root
does not pose a (security) problem, this might solve the problem:
XCS~$ ssh -X root@rpizero-local
Luckily, a simple and more secure solution exists:
XCS~$ ssh -X pi@rpizero-local
RPi~$ su -pc ./flashcam
This will execute the application with root-privileges, while maintaining the current environment variables (and hence the XAUTHORITY
settings of the pi
user).
A more secure way is to allow root
to use the same XAUTHORITY
settings as the pi
-user:
Setup SSH connection and start editingbashrc
ofroot
:XCS~$ ssh -X pi@rpizero-local RPi~$ su - root RPi~root$ nano ~/.bashrc
Add the following line to the file:export XAUTHORITY=/home/user/.Xauthority
LogoutRPi~root$ exit
Run applicationRPi~$ su RPi~root$ ./flashcam RPi~root$ exit