l0l0l0 / rpicross_notes

Guide to Cross Compiling on a Raspberry Pi

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Guide to Setup and Cross Compile for a Raspberry Pi

This repository is a personal guide to setup a cross compilation environment to compile OpenCV, ROS and WiringPi programs for a Raspberry Pi. It contains details on how to setup a VirtualBox, configure SSH / X-server / network settings, how to sync syncing / back up files to the Raspberry Pi and of course how to compile and install OpenCV, ROS and WiringPi. Experience with VirtualBox, C, Python and the terminal/nano are assumed. Usage of external keyboards or monitors for the Raspberry Pi is not required: setup is done via card mounting or SSH.

At the end of this list you should have:

  • A Virtualbox (VM) running Ubuntu Server 16.04 LTS, with:
    • SSH connectivity from HOST to GUEST and from GUEST to the Raspberry Pi
    • Crosscompilation environment including:
      • Toolchain / compilers to compile for the Raspberry Pi (zero)
      • Userland libraries (GPU support for the Raspberry Pi)
      • OpenCV 3.2 with additional modules, library support such as GTK+ and Python bindings
      • ROS-comm with Python bindings
      • Synchronisation tools to update the Raspberry Pi with the (cross) compiled libraries.
      • WiringPi support
    • Native environment supporting:
      • ROS with Python bindings
      • OpenCV 3.2 with Python bindings
  • A Raspberry Pi (zero) (RPi) running Jessie Lite, including
    • OpenCV with Python Bindings
    • ROS-comm with Python Bindings
    • WiringPi support
    • Running PiCamera
    • i2c and a Real Time Clock (RTC)
  • A VM able to run roscore to which the Raspberry Pi (RPi) can connect as a node.

Before the required steps are explained, some disclaimers:

  1. Many, many, many StackOverflow questions, Github issues, form-posts and blog-pages have helped me developing these notes. Unfortunatly I haven't written down all these links and hence cannot thank or link all authors, for which my apology. Here is an incomplete list of used sources:
  1. There is no guarantee that the steps described in these notes are the best available. As I'm not an expert, better solutions might be out there. The provided steps however resulted in a working/workable setup for me.
  2. If you happen to know a better (and working) solution, have a question, suggestion or if you spot a mistake: feel free to post an issue!

How to Read?

The notes are more or less in chronological order, hence start from top the bottom. Commands are prefixed with the system on which the commands needs to be run:

  • HOST~$ commands executed on the Host. As this guide is developed using OSX, commands will be unix-styled.
  • XCS~$ commands executed on the Cross-Compiler Server / Virtualbox
  • RPI~$ commands executed on the Raspberry Pi

Index

Information:

  1. Setup VM and RPi
  2. Setup Network/SSH
  3. Setup RPi Peripherals
  4. Setup Crosscompile environment
  5. Crosscompile and Install Userland
  6. Crosscompile and Install OpenCV
  7. Crosscompile and Install ROS
  8. Compile and Install OpenCV
  9. Compile and Install ROS
  10. Remote ROS (RPi node and VM master)
  11. ROS package development (RPi/VM)
  12. Compile and Install WiringPi

Test-code:

ROS publish-subscriber (for remote operation)

Tools:

ROS (compile) environment setters:

Enjoy!

About

Guide to Cross Compiling on a Raspberry Pi

License:GNU General Public License v3.0


Languages

Language:C 96.0%Language:C++ 2.0%Language:CMake 1.2%Language:Shell 0.7%Language:Makefile 0.0%