Difference between revisions of "Installation/Linux"

From PaparazziUAV
Jump to navigation Jump to search
m (Update installation gcc-arm-embedded toolchain guide for Ubuntu 14.04)
 
(24 intermediate revisions by 8 users not shown)
Line 36: Line 36:


=== Ubuntu ===
=== Ubuntu ===
'''Binary packages for Ubuntu are available for the ''i386'', ''amd64'' and ''armhf'' architectures.'''


Add the installation sources for the Paparazzi software packages. Run from a terminal:
Add the installation sources for the Paparazzi software packages. Run from a terminal:
Line 45: Line 46:


=== Debian ===
=== Debian ===
'''Binary packages for Debian are available for the ''i386'' and ''amd64'' architectures. ''armhf'' packages seem to be currently not supported by the OpenSUSE build service.'''


For Debian Squeeze (6.0) and Wheezy (7.0) packages are built using the [http://openbuildservice.org/ Open Build Service (OBS)] on [https://build.opensuse.org/project/show?project=home%3Aflixr%3Apaparazzi-uav OpenSUSE Build Service project home:flixr:paparazzi-uav]
For Debian Wheezy (7.0), Jessie (8.0), Stretch (9.0) and Buster (10) packages are built using the [http://openbuildservice.org/ Open Build Service (OBS)] on [https://build.opensuse.org/project/show?project=home%3Aflixr%3Apaparazzi-uav OpenSUSE Build Service project home:flixr:paparazzi-uav]
 
[http://software.opensuse.org/download/package?project=home:flixr:paparazzi-uav&package=paparazzi-dev Install paparazzi-dev]


First add the key:
First add the key:
  wget -q "http://download.opensuse.org/repositories/home:/flixr:/paparazzi-uav/Debian_7.0/Release.key" -O- | apt-key add -
  wget -q "http://download.opensuse.org/repositories/home:/flixr:/paparazzi-uav/Debian_10/Release.key" -O- | sudo apt-key add -


Add the appropriate repo, depending on your Debian version to sources.list
Add the appropriate repo, depending on your Debian version to sources.list
  echo "deb http://download.opensuse.org/repositories/home:/flixr:/paparazzi-uav/Debian_6.0/ ./" | tee -a /etc/apt/sources.list
  echo "deb http://download.opensuse.org/repositories/home:/flixr:/paparazzi-uav/Debian_10/ ./" | tee -a /etc/apt/sources.list
echo "deb http://download.opensuse.org/repositories/home:/flixr:/paparazzi-uav/Debian_9.0/ ./" | tee -a /etc/apt/sources.list
echo "deb http://download.opensuse.org/repositories/home:/flixr:/paparazzi-uav/Debian_8.0/ ./" | tee -a /etc/apt/sources.list
  echo "deb http://download.opensuse.org/repositories/home:/flixr:/paparazzi-uav/Debian_7.0/ ./" | tee -a /etc/apt/sources.list
  echo "deb http://download.opensuse.org/repositories/home:/flixr:/paparazzi-uav/Debian_7.0/ ./" | tee -a /etc/apt/sources.list


Line 63: Line 69:
For current Paparazzi versions (v5.0 and above) the [https://launchpad.net/gcc-arm-embedded/ gcc-arm-embedded toolchain] is recommended, which also supports the STM32F4 with FPU (hardware floating point).
For current Paparazzi versions (v5.0 and above) the [https://launchpad.net/gcc-arm-embedded/ gcc-arm-embedded toolchain] is recommended, which also supports the STM32F4 with FPU (hardware floating point).


The most common way is to download and unpack the tarball and add it to your PATH:
=== gcc-arm-none-eabi as Debian/Ubuntu package ===
 
[http://pixhawk.org/dev/toolchain_installation_lin The Pixhawk Devs have mentioned the 4.8 as buggy.]


cd ~
'''This is the recommended method'''
wget https://launchpad.net/gcc-arm-embedded/4.7/4.7-2013-q2-update/+download/gcc-arm-none-eabi-4_7-2013q2-20130614-linux.tar.bz2
tar -vjxf gcc-arm-none-eabi-4_7-2013q2-20130614-linux.tar.bz2 -C /opt
rm -r gcc-arm-none-eabi-4_7-2013q2-20130614-linux.tar.bz2
exportline="PATH=$PATH:/opt/gcc-arm-none-eabi-4_7-2013q2/bin"
if grep -Fxq "$exportline" ~/.profile; then echo nothing to do ; else echo $exportline >> ~/.profile; fi
source ~/.profile


The file .profile will be sourced in every bash after logging out and in again. Until then,
Note that there are actually two '''different''' toolchains available!
source ~/.profile
* [https://launchpad.net/gcc-arm-embedded/ ARM gcc-arm-embedded toolchain] with Debian package name ''gcc-arm-embedded''
can be used for every bash individually.
 
If you can not access your toolchain with PATH working, look a the [[Installation/Linux#Troubleshooting]].
 
==== ARM gcc-arm-embedded toolchain (from launchpad) - Debian Quick (Manual) Install Process ====
 
This approach is quick and low risk as it does not rely on any packages or make modifications to the system.
 
* Download latest gcc-arm-none-eabi-*-*-linux.tar.bz2 from [https://launchpad.net/gcc-arm-embedded/+download External Downloads] section of ARM gcc-arm-embedded project
* Create /opt/paparazzi folder if it does not exist
sudo mkdir /opt/paparazzi
* Decompress file to /opt/
sudo tar -xvf [name_of_downloaded_bz2_file] /opt/
* Create symlink so Paparazzi Makefile can find the library
sudo ln -s /opt/[gcc-arm-xxxxxxx_name_of_folder] /opt/paparazzi/arm-multilib
* Attempt to build paparazzi autopilot firmware (example, Paparazzi Center build target ap)
 
=== gcc-arm-none-eabi as Debian/Ubuntu package ===
 
Note that there are actually two '''different''' toolchains available that unfortunately have the same package name!
* [https://launchpad.net/gcc-arm-embedded/ ARM gcc-arm-embedded toolchain]
** includes libstdc++ and newlib-nano
** includes libstdc++ and newlib-nano
* [https://packages.debian.org/jessie/gcc-arm-none-eabi Debian gcc-arm-none-eabi toolchain]
* [https://packages.debian.org/jessie/gcc-arm-none-eabi Debian gcc-arm-none-eabi toolchain]
Line 107: Line 84:
==== gcc-arm-embedded toolchain ====
==== gcc-arm-embedded toolchain ====


On ''most'' Ubuntu versions (currently lucid, precise, raring, saucy and trusty) the [https://launchpad.net/gcc-arm-embedded/ gcc-arm-embedded toolchain] can be installed as a debian package from the [https://launchpad.net/~terry.guo/+archive/gcc-arm-embedded ppa]:
'''This is the recommended toolchain'''
  sudo add-apt-repository ppa:terry.guo/gcc-arm-embedded
 
On ''most'' Ubuntu versions the [https://launchpad.net/gcc-arm-embedded/ gcc-arm-embedded toolchain] can be installed as a debian package from the [https://launchpad.net/~team-gcc-arm-embedded/+archive/ubuntu/ppa ppa]:
  sudo add-apt-repository ppa:team-gcc-arm-embedded/ppa
  sudo apt-get update
  sudo apt-get update
  sudo apt-get install gcc-arm-none-eabi
  sudo apt-get install gcc-arm-embedded


!!! If you are using Ubuntu 14.04 and later, please be careful because there are packages with same name but produced by Debian and inherited by Ubuntu. Simply follow the above 3 steps, you may end up with gcc-arm-none-eabi from Ubuntu. So to install gcc-arm-none-eabi from ARM, steps are:
<div class="toccolours mw-collapsible mw-collapsed" style="width:800px">
1). sudo apt-get remove binutils-arm-none-eabi gcc-arm-none-eabi
Previously there was a PPA by terry.guo that contained this toolchain under the package name ''gcc-arm-none-eabi''
2). sudo add-apt-repository ppa:terry.guo/gcc-arm-embedded
<div class="mw-collapsible-content">
3). sudo apt-get update
See https://launchpad.net/gcc-arm-embedded/+announcement/13824 for details on how to switch the newer
4). sudo apt-get install gcc-arm-none-eabi=4.8.4.2014q3-0trusty11
PPA and package.  
Meanwhile we are working with Debian to consolidate and unify this toolchain.
</div></div>


==== gcc-arm-none-eabi Debian toolchain ====
==== gcc-arm-none-eabi Debian toolchain ====


Debian testing ('''jessie''') and Ubuntu 14.04 ('''trusty''') have the gcc-arm-none-eabi package in the official repositories ('''universe'''), and can be installed with:
Current Debian ('''jessie''') and Ubuntu (14.04 '''trusty''' and later) releases have the gcc-arm-none-eabi package in the official repositories ('''universe'''), and can be installed with:
  sudo apt-get update
  sudo apt-get update
  sudo apt-get install gcc-arm-none-eabi
  sudo apt-get install gcc-arm-none-eabi gdb-arm-none-eabi
 
=== ARM gcc-arm-embedded tarball ===
Another way is to download and unpack the tarball and add it to your PATH:
 
* Download gcc-arm-none-eabi-*-*-linux.tar.bz2 from [https://launchpad.net/gcc-arm-embedded/+download External Downloads] section of ARM gcc-arm-embedded project
* Unpack it to a directory of your choice
* Add the bin folder in to your PATH
 
e.g.:
cd ~
wget https://launchpad.net/gcc-arm-embedded/4.7/4.7-2013-q2-update/+download/gcc-arm-none-eabi-4_7-2013q2-20130614-linux.tar.bz2
sudo tar -vjxf gcc-arm-none-eabi-4_7-2013q2-20130614-linux.tar.bz2 -C /opt
rm -r gcc-arm-none-eabi-4_7-2013q2-20130614-linux.tar.bz2
exportline="PATH=$PATH:/opt/gcc-arm-none-eabi-4_7-2013q2/bin"
if grep -Fxq "$exportline" ~/.profile; then echo nothing to do ; else echo $exportline >> ~/.profile; fi
source ~/.profile
 
The file .profile will be sourced in every bash after logging out and in again. Until then,
source ~/.profile
can be used for every bash individually.
 
If you can not access your toolchain with PATH working, look a the [[Installation/Linux#Troubleshooting]].


=== Old toolchain for Paparazzi v4.x and earlier ===
=== Old toolchain for Paparazzi v4.x and earlier ===
Line 151: Line 152:
  cd <your paparazzi directory>
  cd <your paparazzi directory>
  sudo cp conf/system/udev/rules/50-paparazzi.rules /etc/udev/rules.d/
  sudo cp conf/system/udev/rules/50-paparazzi.rules /etc/udev/rules.d/
sudo udevadm control --reload-rules


See the [[Udev]] page for more details.
See the [[Udev]] page for more details.
Line 174: Line 176:
  apt-get update
  apt-get update
  apt-get install ia32-libs
  apt-get install ia32-libs
=== arm-linux-gnueabi-gcc cross-compiler not found ===
=== Ubuntu ===
apt-get install gcc-arm-linux-gnueabi
=== Debian ===
Starting with jessie, there were [https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=771496#41 some changes] to the way cross-compilers are set up. To make it work you will have to add armel architecture and pick up some crossbuild tools.
First edit your /etc/apt/sources.list and add the following line, to enable the emdebian repo:
deb http://emdebian.org/tools/debian/ jessie main
Run the following command in your terminal to add the keys for it
curl http://emdebian.org/tools/debian/emdebian-toolchain-archive.key | sudo apt-key add -
Then you could add armel architecture and fetch the missing cross-compiler packages
dpkg --add-architecture armel
apt-get update
apt-get install crossbuild-essential-armel
You could find out more about cross-toolchains in jessie on debian [https://wiki.debian.org/CrossToolchains wiki page].
Note that some of your repos might not mirror embedded architectures, which would give you an error when you try to update the sources. In that case you will have to specify which architecture you do want from them by editing the corresponding entry in your sources.list file, in a way described [https://wiki.debian.org/Multiarch/HOWTO here]. Like in this example with the crunchbang repo you could specify it by adding [arch=amd64,i386] to the line, so you only enable amd64 and i386 architectures:
deb [arch=amd64,i386] http://packages.crunchbang.org/waldorf waldorf main


===arm-none-eabi-gdb: error with libncurses.so.5===
===arm-none-eabi-gdb: error with libncurses.so.5===
Line 179: Line 205:
Terminal output: arm-none-eabi-gdb: error while loading shared libraries: libncurses.so.5: cannot open shared object file: No such file or directory
Terminal output: arm-none-eabi-gdb: error while loading shared libraries: libncurses.so.5: cannot open shared object file: No such file or directory


If this error occours, maybe [http://packages.ubuntu.com/search?keywords=lib32ncurses5 lib32ncurses5] is missing. <br/>
If this error occurs, maybe [http://packages.ubuntu.com/search?keywords=lib32ncurses5 lib32ncurses5] is missing. <br/>
Found on [https://answers.launchpad.net/gcc-arm-embedded/+question/226680 launchpad q&a]
Found on [https://answers.launchpad.net/gcc-arm-embedded/+question/226680 launchpad q&a]



Latest revision as of 10:55, 5 February 2020

This page only describes the installation of the prerequisite tools and dependencies on Debian/Ubuntu needed for Paparazzi.

See the general Installation page for how to download Paparazzi and launching it after you followed the instructions here.

Introduction

Paparazzi is very easily installed on any laptop or workstation running Ubuntu, Debian (or any of their derivatives).

The steps required to install the software needed to be able to let your UAS fly

Users of other Linux flavors than a recent Ubuntu or Debian and anyone needing manual control of each individual package can install them independently.

For the impatient

For Ubuntu add the paparazzi-uav ppa sudo add-apt-repository ppa:paparazzi-uav/ppa and install the paparazzi-dev package.

Since Paparazzi v5.0 the gcc-arm-embedded toolchain is recommended. Available as of Ubuntu 14.04, on older versions it can be installed via tarball.

Or just use the Quickstart for Ubuntu 12.04 LTS.

Installation video Tutorials

EmbedVideo does not recognize the video service "youtubehd".
EmbedVideo does not recognize the video service "youtubehd".

Installation of dependencies

Ubuntu

Binary packages for Ubuntu are available for the i386, amd64 and armhf architectures.

Add the installation sources for the Paparazzi software packages. Run from a terminal:

sudo add-apt-repository ppa:paparazzi-uav/ppa

Then update the systems package inventory and install the main Paparazzi software dependencies. This will take some time.

sudo apt-get update 
sudo apt-get install paparazzi-dev

Debian

Binary packages for Debian are available for the i386 and amd64 architectures. armhf packages seem to be currently not supported by the OpenSUSE build service.

For Debian Wheezy (7.0), Jessie (8.0), Stretch (9.0) and Buster (10) packages are built using the Open Build Service (OBS) on OpenSUSE Build Service project home:flixr:paparazzi-uav

Install paparazzi-dev

First add the key:

wget -q "http://download.opensuse.org/repositories/home:/flixr:/paparazzi-uav/Debian_10/Release.key" -O- | sudo apt-key add -

Add the appropriate repo, depending on your Debian version to sources.list

echo "deb http://download.opensuse.org/repositories/home:/flixr:/paparazzi-uav/Debian_10/ ./" | tee -a /etc/apt/sources.list
echo "deb http://download.opensuse.org/repositories/home:/flixr:/paparazzi-uav/Debian_9.0/ ./" | tee -a /etc/apt/sources.list
echo "deb http://download.opensuse.org/repositories/home:/flixr:/paparazzi-uav/Debian_8.0/ ./" | tee -a /etc/apt/sources.list
echo "deb http://download.opensuse.org/repositories/home:/flixr:/paparazzi-uav/Debian_7.0/ ./" | tee -a /etc/apt/sources.list

Update the systems package inventory and install the main Paparazzi software dependencies.

sudo apt-get update 
sudo apt-get install paparazzi-dev

ARM embedded toolchain

For current Paparazzi versions (v5.0 and above) the gcc-arm-embedded toolchain is recommended, which also supports the STM32F4 with FPU (hardware floating point).

gcc-arm-none-eabi as Debian/Ubuntu package

This is the recommended method

Note that there are actually two different toolchains available!

Both toolchains should work for most use-cases (if you don't need C++ or nano specs), although the ARM gcc-arm-embedded toolchain is better tested.

gcc-arm-embedded toolchain

This is the recommended toolchain

On most Ubuntu versions the gcc-arm-embedded toolchain can be installed as a debian package from the ppa:

sudo add-apt-repository ppa:team-gcc-arm-embedded/ppa
sudo apt-get update
sudo apt-get install gcc-arm-embedded

Previously there was a PPA by terry.guo that contained this toolchain under the package name gcc-arm-none-eabi

See https://launchpad.net/gcc-arm-embedded/+announcement/13824 for details on how to switch the newer PPA and package.

gcc-arm-none-eabi Debian toolchain

Current Debian (jessie) and Ubuntu (14.04 trusty and later) releases have the gcc-arm-none-eabi package in the official repositories (universe), and can be installed with:

sudo apt-get update
sudo apt-get install gcc-arm-none-eabi gdb-arm-none-eabi

ARM gcc-arm-embedded tarball

Another way is to download and unpack the tarball and add it to your PATH:

  • Download gcc-arm-none-eabi-*-*-linux.tar.bz2 from External Downloads section of ARM gcc-arm-embedded project
  • Unpack it to a directory of your choice
  • Add the bin folder in to your PATH

e.g.:

cd ~
wget https://launchpad.net/gcc-arm-embedded/4.7/4.7-2013-q2-update/+download/gcc-arm-none-eabi-4_7-2013q2-20130614-linux.tar.bz2
sudo tar -vjxf gcc-arm-none-eabi-4_7-2013q2-20130614-linux.tar.bz2 -C /opt
rm -r gcc-arm-none-eabi-4_7-2013q2-20130614-linux.tar.bz2
exportline="PATH=$PATH:/opt/gcc-arm-none-eabi-4_7-2013q2/bin"
if grep -Fxq "$exportline" ~/.profile; then echo nothing to do ; else echo $exportline >> ~/.profile; fi
source ~/.profile

The file .profile will be sourced in every bash after logging out and in again. Until then,

source ~/.profile

can be used for every bash individually.

If you can not access your toolchain with PATH working, look a the Installation/Linux#Troubleshooting.

Old toolchain for Paparazzi v4.x and earlier

For Paparazzi v4.x and earlier you need to install the paparazzi-arm-multilib package. It has support for both ARM7 (i.e. Tiny,TWOG,YAPA autopilot boards) as well as STM32F1 (i.e. LISA boards).
This toolchain does not properly support STM32F4 based autopilots!!

You can install it explicitly with:

sudo apt-get install paparazzi-arm-multilib

Optional Packages

The packages lpc21isp and openocd are normally automatically installed as they are recommended packages of paparazzi-dev, if not you can manually install them via:

sudo apt-get install lpc21isp openocd

lpc21isp is needed to serially flash the LPC2148 based autopilots (e.g. bootloader for tiny, twog, umarim), openocd is for flashing via JTAG (e.g. for Lisa boards) and debugging.

Installing and running Paparazzi

Please see Getting the Source Code on the general Installation page for details on downloading the Paparazzi source code, compiling and running it.

Udev rules

Add the appropriate Udev rule (available in fhe file 50-paparazzi.rules) to the USB handler. Simply copy as root conf/system/udev/rules/50-paparazzi.rules to /etc/udev/rules.d/, e.g in a terminal:

cd <your paparazzi directory>
sudo cp conf/system/udev/rules/50-paparazzi.rules /etc/udev/rules.d/
sudo udevadm control --reload-rules

See the Udev page for more details.

Troubleshooting

No access rights for USB devices

Some Linux distributions, don't allow standard (non admin) users to directly access the USB bus by default. On recent Ubuntu/Debian versions the first/main user is already a member of the plugdev group which should be sufficient for most cases.
If you have problems, make yourself a member of the plugdev and dialout groups:

sudo adduser <your login> plugdev
sudo adduser <your login> dialout

Logout and login again.

arm-none-eabi-gcc: Command not found

Appeared on Debian Wheezy 7 (gcc-arm-none-eabi-4_8-2013q4 installed via tarball)
If this error occurs, maybe the ia32-libs are missing.

Enable multiarch and install ia32-libs:

dpkg --add-architecture i386
apt-get update
apt-get install ia32-libs

arm-linux-gnueabi-gcc cross-compiler not found

Ubuntu

apt-get install gcc-arm-linux-gnueabi

Debian

Starting with jessie, there were some changes to the way cross-compilers are set up. To make it work you will have to add armel architecture and pick up some crossbuild tools.

First edit your /etc/apt/sources.list and add the following line, to enable the emdebian repo:

deb http://emdebian.org/tools/debian/ jessie main

Run the following command in your terminal to add the keys for it

curl http://emdebian.org/tools/debian/emdebian-toolchain-archive.key | sudo apt-key add -

Then you could add armel architecture and fetch the missing cross-compiler packages

dpkg --add-architecture armel
apt-get update
apt-get install crossbuild-essential-armel

You could find out more about cross-toolchains in jessie on debian wiki page.

Note that some of your repos might not mirror embedded architectures, which would give you an error when you try to update the sources. In that case you will have to specify which architecture you do want from them by editing the corresponding entry in your sources.list file, in a way described here. Like in this example with the crunchbang repo you could specify it by adding [arch=amd64,i386] to the line, so you only enable amd64 and i386 architectures:

deb [arch=amd64,i386] http://packages.crunchbang.org/waldorf waldorf main

arm-none-eabi-gdb: error with libncurses.so.5

Appeared on Xubuntu 14.04 LTS (gcc-arm-none-eabi-4_8-2013q4 installed via tarball)
Terminal output: arm-none-eabi-gdb: error while loading shared libraries: libncurses.so.5: cannot open shared object file: No such file or directory

If this error occurs, maybe lib32ncurses5 is missing.
Found on launchpad q&a

FTDI serial adapter not working on old Ubuntu version

On older Linux distributions (not needed for lucid and later), the Braille TTY driver interferes with FTDI USB Serial adapters. If somehow your FTDI serial adapter does not work, remove the package via:

sudo apt-get remove brltty

Code not starting on autopilot after changing gcc

If you changed the toolchain (e.g. installed a new one for having FPU-Support for the F4), you need to run

make clean && make

in sw/ext in order to rebuild the libs. Otherwise the embedded code can behave strange (most likely not start)