Difference between revisions of "Installation/FromScratch"

From PaparazziUAV
Jump to navigation Jump to search
(→‎Ivy-c: Required packages)
Line 31: Line 31:
                       liblablgtk2-gnome-ocaml-dev libxml-light-ocaml-dev libocamlnet-ocaml-dev libpcre-ocaml \
                       liblablgtk2-gnome-ocaml-dev libxml-light-ocaml-dev libocamlnet-ocaml-dev libpcre-ocaml \
                       libpcre-ocaml-dev libgnomecanvas2-0 libgnomecanvas2-dev libglade2-0 libglade2-dev make build-essential \
                       libpcre-ocaml-dev libgnomecanvas2-0 libgnomecanvas2-dev libglade2-0 libglade2-dev make build-essential \
                       git-core gnuplot boa m4 libtool libftdi-dev libmpfr-dev tcl8.5-dev xutils-dev tkdiff
                       git gnuplot boa m4 libtool libftdi-dev libmpfr-dev tcl8.5-dev xutils-dev


=== Ocaml and libraries ===
=== Ocaml and libraries ===
Line 100: Line 100:
Git is a version control system. Version control systems allow many individuals to collaborate on the Paparazzi source code. This is needed to retrieve the latest sourcecode from various packages and Paparazzi sourcecode itself.
Git is a version control system. Version control systems allow many individuals to collaborate on the Paparazzi source code. This is needed to retrieve the latest sourcecode from various packages and Paparazzi sourcecode itself.


  $ sudo apt-get install git-core
  $ sudo apt-get install git


=== Subversion ===
=== Subversion ===
Line 114: Line 114:
  $ sudo apt-get install gnuplot
  $ sudo apt-get install gnuplot


=== TKDiff ===
=== Meld ===


TKDiff is a graphical front end to the diff program. It provides a side-by-side view of the differences between two files. It is used by the Paparazzi Center when configuration changes are not yet saved and the option comes along where one either can keep or view changes made in aircraft- and other configuration files.
Meld is a graphical front end to the diff program. It provides a side-by-side view of the differences between two files. It is used by the Paparazzi Center when configuration changes are not yet saved and the option comes along where one either can keep or view changes made in aircraft- and other configuration files.


  $ sudo apt-get install tkdiff
  $ sudo apt-get install meld


=== FTDI library ===
=== FTDI library ===

Revision as of 01:43, 21 August 2014

Users of recent Debian/Ubuntu distributions are advised to use the binary packages as described in Installation/Linux.

WARNING! This page is not quite up-to-date. Only use if you are proficient in working with Linux!

Intro

As with all Wiki pages, also this page is a work in progress. try to be a big help to the Paparazzi project and improve this page whenever you can. If you have a distribution different from Ubuntu which doesn't satisfy any other dependency and have instructions about compiling it, packaging it, feel free to add any reference on how to do that on this wikipage.

Goal

The goal of this page is to clarify about which version of each piece of software has to be compiled, where to find that software, patches needed to make it compile on Linux, maybe even FreeBSD or OSX.

The shortcut

Maybe you are no so interested in the details at this moment and just want to quickly install. That's fine, for that we are working on a script and you only need to run one line to get everything installed. For this to work out you do need a working internet connection, but since you can read this text, that will probably not pose a problem.

$ cd ~ && wget http://openuas.org/pub/paparazzifromscratch.sh (still not ready and a work in progress)

If you used the line above, and it all worked out you can stop reading now since everything is installed and compiled, ready for you to use.

Paparazzi-dev packages

For Ubuntu users, you can install the following packages from standard repository. You can just copy the line(s) and paste into your terminal. But do not copy the $ sign, this symbol is just added on this page to show that it is to be pasted at a normal terminal prompt.

Whole lot in one

 sudo apt-get install ocaml libcamlimages-ocaml liblablgtk2-ocaml-dev liblablgtk2-gl-ocaml-dev \
                      liblablgtk2-gnome-ocaml-dev libxml-light-ocaml-dev libocamlnet-ocaml-dev libpcre-ocaml \
                      libpcre-ocaml-dev libgnomecanvas2-0 libgnomecanvas2-dev libglade2-0 libglade2-dev make build-essential \
                      git gnuplot boa m4 libtool libftdi-dev libmpfr-dev tcl8.5-dev xutils-dev

Ocaml and libraries

Ocaml, short for Objective Caml is the most popular variant of the Caml language. The Paparazzi Ground Control Station (GCS) and some of it's tools are crafted in this language.

  • ocaml, ocaml-camlimages-devel, ocaml-lablgtk2-devel, ocaml-xml-light-devel, ocamlnet-ocaml-devel
$ sudo apt-get install ocaml libcamlimages-ocaml liblablgtk2-ocaml-dev liblablgtk2-gl-ocaml-dev \
                       liblablgtk2-gnome-ocaml-dev libxml-light-ocaml-dev libocamlnet-ocaml-dev

Gnome canvas Library

The GnomeCanvas is an engine for structured graphics that offers a rich imaging model, high performance rendering, and a powerful, high level API. This widget can be used for flexible display of graphics and for creating interactive user interface elements.

$ sudo apt-get install libgnomecanvas2-0 libgnomecanvas2-dev

USB Library

The libusb project aims to create a library for use by user level applications to access USB devices regardless of OS. [1]

$ sudo apt-get install libusb-dev

Ocaml PCRE

This OCaml-library interfaces the PCRE (Perl-compatibility regular expressions) C library. it can be used for matching regular expressions which are written in Perl style.

$ sudo apt-get install libpcre-ocaml libpcre-ocaml-dev

Glade Library

Libglade is a library that performs a similar job to the C source output routines in the GLADE user interface builder. Whereas GLADE's output routines create C source code that must be compiled, libglade builds the interface from an XML file (GLADE's save format) at runtime. This can allow modifying the user interface without recompiling.

$ sudo apt-get install libglade2-0 libglade2-dev

Tcl/Tk

$ sudo apt-get install tcl-dev

Also the some utils are required to compile and install Ivy.

$ sudo apt-get install xutils-dev

Make

GNU Make is an utility which controls the generation of executables and other target files of a program from the program's source files.

$ sudo apt-get install make

Build essential

$ sudo apt-get install build-essential

Libtool

GNU libtool is a generic library support script. Libtool hides the complexity of using shared libraries behind a consistent, portable interface. Creating the files for Paparazzi software building becomes less cumbersome by using this tool.

$ sudo apt-get install libtool

libpcre3-dev

Required for compiling Ivy-C.

$ apt-get install libpcre3-dev

Git Client

Git is a version control system. Version control systems allow many individuals to collaborate on the Paparazzi source code. This is needed to retrieve the latest sourcecode from various packages and Paparazzi sourcecode itself.

$ sudo apt-get install git

Subversion

Version control system, required for cloning the ivy packages.

$ apt-get install subversion

GNU Plot

A command-line driven interactive plotting program. Unknow if it is used

$ sudo apt-get install gnuplot

Meld

Meld is a graphical front end to the diff program. It provides a side-by-side view of the differences between two files. It is used by the Paparazzi Center when configuration changes are not yet saved and the option comes along where one either can keep or view changes made in aircraft- and other configuration files.

$ sudo apt-get install meld

FTDI library

libftdi is a library that talks to FTDI's 232 type chips, including the popular bitbang mode, using libusb. A library to be able to use with a debugging Autopilot hardware boards.

$ sudo apt-get install libftdi-dev 

MPFR library

The MPFR library is a C library for multiple-precision floating-point computations with correct rounding. MPFR is based on the GMP multiple-precision library. The main goal of MPFR is to provide a library for multiple-precision floating-point computation which is both efficient and has a well-defined semantics.

$ sudo apt-get install libmpfr-dev

ImageMagick

ImageMagick is a software suite to create, edit, and compose bitmap images. It can read, convert and write images in a variety of formats. Use ImageMagick to translate, flip, mirror, rotate, scale, shear and transform images, adjust image colors, apply various special effects, or draw text, lines, polygons, ellipses and Bézier curves. Being able to modify image based map pictures is a feature that may come in handy one time.

$ sudo apt-get install imagemagick

Optional on an older OS

If you have an older OS distribution it never hurts to install the following...

$ sudo apt-get install libx11-6 libx11-dev texinfo libncurses5 libncursesw5 libncursesw5-dev zlibc

Installing the Cross compiler toolchain

There are currently two different toolchains available that can be used on Linux based systems with Paparazzi. For more information see Installation/Linux#ARM_embedded_toolchain

LPC21ISP

To get the software onto the main autopilot board a special tool is needed. We will use the great open-source LPC21ISP application. LPC21ISP is an in-circuit programming (ISP) tool for the microcontroller used on the Paparazzi autopilot boards. The lpc21isp project is hosted on sourceforge and one can find the source packages and information at http://sourceforge.net/projects/lpc21isp/

Get the SVN version via

$ mkdir -p /opt/lpc21isp
$ cd /opt/lpc21isp
$ svn co https://lpc21isp.svn.sourceforge.net/svnroot/lpc21isp lpc21

To compile go into the source directory and then do

$ cd lpc21
$ make -f Makefile clean all

To install

$ exportline="PATH=$PATH:/opt/lpc21isp"
$ if grep -Fxq "$exportline" ~/.profile; then echo nothing to do ; else echo $exportline >> ~/.profile; fi
$ source ~/.profile

IVY

IVY is a simple protocol and a set of open-source libraries and programs that allows applications to broadcast information through text messages, with a subscription mechanism based on regular expressions. The project can be found at: http://www.eei.cena.fr/products/ivy/

In the paparazzi project, Ivy is used to send telemetry data to where ever you want.

NOTE: Do not confuse this IVY with the Apache Ivy project.

Ivy-python

The ivy-python package makes it possible to use the IVY libraries from within the Python programming language. The ivy-python package is architecture independent, so it can be downloaded from the Ubuntu or Debian paparazzi repository. However since this is the from scratch page we will download it from the official source repository via

mkdir -p /opt/ivy-python
cd /opt/ivy-python/
svn co https://svn.tls.cena.fr/svn/ivy/ivy-python/trunk

Now we can build and install /!\ Only works with Python 2 /!\ (is this still up to date ?)

cd /opt/ivy-python/trunk
./setup.py install

Ivy-c

To be able to use ivy-c, the libraries need to be installed.

Required packages:

  • tcl-dev
  • libpcre3-dev
  • libxt-dev
  • pkg-config
  • libglib2.0-dev
  • subversion

Source packages of ivy-c can be downloaded via:

mkdir -p /opt/ivy-c
cd /opt/ivy-c
svn co https://svn.tls.cena.fr/svn/ivy/ivy-c/trunk

To compile

cd /opt/ivy-c/trunk/src
make

It is possible you get errors of the test module when compiling, just ignore the messages, it is not important for the Paparazzi project. Contact the IVY team to help them also to resolve also the testing makefile issue.

Now install the compiled libraries

make install

If you have a 64bit system your ivy libs were probably installed to /usr/local/lib64 and you have to make symbolic links so that they will be found:

$ sudo ln -s /usr/local/lib64/libivy.so /usr/local/lib64/libivy.so.3 /usr/lib

or

sudo ln -s /usr/local/lib64/libivy.so /usr/local/lib64/libivy.so.3 /usr/local/lib


If you get an error relating to ivytestready.c, make the following changes:

mkdir /opt/ivy-c/trunk/tools/Ivy
cd /opt/ivy-c/trunk/tools/Ivy
cp ../../src/ivy.h .
cp ../../src/ivyloop.h .
cp ../../src/ivysocket.h .
cp ../../src/timer.h .
cd ~/develop/ivy-c/trunk/src
make

This copies files from the src directory to the Ivy folder in tools which did not appear after running svn above.

troubleshooting

Error message:

gcc -c -O2 -Wall -Wshadow -fPIC -I/usr/include/tcl8.4 -DTCL_CHANNEL_INTEGRATION  ivytcl.c
ivytcl.c:28:17: fatal error: tcl.h: No such file or directory

The Makefile cannot read the tcl-dev version you have installed and assumes that version 8.4 is installed but can not find the appropriate folder.
Edit the line 57 of the Makefile from TCLVERS=8.4 according to your installed version, or just delete the 8.4, both should work.

Ivy-OCAML

The Ivy-ocaml is a Library that make it possible to use Ivy via the Ocaml language.

mkdir -p /opt/ivy-ocaml
cd /opt/ivy-ocaml
svn co https://svn.tls.cena.fr/svn/ivy/ivy-ocaml/trunk

Now we need to compile the source via

cd /opt/ivy-ocaml/trunk
make
make install


NOTE: If the above SVN repository does not work due to API incompatibilities get the ivy-ocaml source via

wget http://paparazzi.enac.fr/ubuntu/dists/natty/main/binary-i386/ivy-ocaml_1.1-12.tar.gz

If you are running Ubuntu use the wget method listed above. Then run

tar -zxvf ivy-ocaml_1.1-12.tar.gz
cd ivy
make
make install

Paparazzi Main sourcecode

See the main installation page

TIP: If you get the File "pprz.mli", line 149, characters 78-89: Error: Unbound type constructor Ivy.binding ...this happens when IVY libraries are not yet installed. How to do this, read the part on installing IVY on this page

The depriciated -mapcs-32 option

The option "-mapcs-32" is only available with very old tool chain versions e.g. GCC-3.3.x. More recent tool chains will either require "-mabi=apcs-gnu" (non-EABI-compliant) or "-mabi=aapcs-linux" (EABI-compliant). To have an overview of all flags go here

http://ecos.sourceware.org/docs-1.3.1/ref/gnupro-ref/arm/ARM_COMBO_ch01.html

By changing -mapcs-32 with -Wa,-mapcs-32 compilation will work with more recent compilers and we have backward compatibility with the old flag for older compilers. The option -Wa,-mapcs-32 is doing the following: -Wa,option : Pass option as an option to the assembler. If option contains commas, it is split into multiple options at the commas.

The -mapcs-32 option generates code for a processor running with a 32-bit program counter and conforming to the function calling standards for the APCS 32-bit option. If interested in depth what APCS is read the following: http://www.openuas.org/site/APCS.txt

The gcc flag -mapcs-32 was deprecated since gcc-3.4.0 and finally removed in gcc-4.0.0 which unconditionally generates 32bit ARM code. You should not need to pass this flag to the assembler either but it might not hurt for backwards compatibility with older compilers, so it's best to leave it in with the -Wa, option metho

Useful links

https://github.com/esden/summon-arm-toolchain

https://github.com/paparazzi/paparazzi-portability-support

http://svn.savannah.gnu.org/svn/paparazzi/paparazzi3/trunk/conf/Makefile.stm32

http://wiki.ubuntuusers.de/GNU_arm-toolchain

http://gcc.gnu.org/onlinedocs/gcc-4.5.0/gcc/ARM-Options.html#ARM-Options

http://mcuprogramming.com/forum/arm/gnu-arm-toolchain-installer/

http://code.google.com/p/hobbycode/source/browse/trunk/gnu-arm-installer

http://www.ethernut.de/en/documents/cross-toolchain-osx.html

http://paparazzi.enac.fr/w/index.php?title=User:Roirodriguez

http://www.hermann-uwe.de/blog/building-an-arm-cross-toolchain-with-binutils-gcc-newlib-and-gdb-from-source