NAVIO: Building APM (ArduPilot) from sources
Where to get the code
Working repository for Navio APM port is on our GitHub.
Changes are being pushed in the main ArduPilot repository after some time.
Hot to build
You can build APM directly on your Raspberry Pi, it will take approximately 15 minutes.
For faster build environment it’s better to use cross-compiling on Linux PC or virtual machine.
If you’d like to build on Raspberry Pi skip the next step.
Cross-compiler setup on Linux (optional)
Standard ARM compiler from Ubuntu repositories is not suitable for cross-compiling for Raspberry Pi since it does not support hard float for ARMv6 architecture, instead use compiler provided by Raspberry Pi Foundation that is available here.
Download and extract it somewhere, for example in /opt/:
sudo git clone --depth 1 https://github.com/raspberrypi/tools.git /opt/tools
If you’re using 32-bit distro add the following to your PATH:
export PATH=/opt/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin:$PATH
For 64-bit distro add this to your PATH:
export PATH=/opt/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin:$PATH
If you would like to add the compiler to the PATH permanently edit /etc/environment.
Building APM
These steps are the same both for compiling APM directly on Raspberry Pi and cross-compiling.
Download the APM’s port for Navio:
git clone https://github.com/emlid/ardupilot.git
For Navio and Navio+ boards switch to the ‘navio’ branch:
git checkout navio
For Navio Raw switch to the ‘navio-raw’ branch:
git checkout navio-raw
Navigate to the autopilot’s directory, for example rover, run configuration and build it:
cd ardupilot/APMrover2 make configure make navio
Executable file will be placed in /tmp/APMrover2.build directory.
If you’re using cross-compiler transfer the binary to your Raspberry Pi:
rsync -avz /tmp/APMrover2.build/APMrover2.elf pi@192.168.1.3:/home/pi/
Where 192.168.1.3 is an IP address of your Raspberry Pi with Navio.
If you are compiling directly on Raspberry copy the binary from tmp directory to your home folder:
cp /tmp/APMrover2.build/APMrover2.elf /home/pi/APMrover2.elf
Instructions how to run APM on Raspberry and to connect GCS to it are available here.