How to build FAMOUSO?
Prerequisite on building environment
You have to install some tools for building FAMOUSO on your prefered platform.
- g++
- make
- wget
- svn (if you want to checkout the current development version.)
and for some Binding to other languages you need
- swig
- java
- .Net or Mono
- python
If you want to generate the documentation too, you need doxygen.
If you want to build under Windows, you will install cygwin or mingw. You have to provide the mentioned tools for these environments too. For cygwin, we provide a install-cygwin.bat that installs cygwin in a minimal version, enabling downloading and compiling of FAMOUSO. The script itself and the cygwin setup tool from the cygwin website have to reside in the same directory. You should open a cmd.exe and start the install-cygwin.bat with an install-dir parameter.
In case of compiling for the Micro-Controller like the AVR you need instead of the normal g++ compiler a cross-compiler for the used Micro-Controller.
Compiling FAMOUSO in general
FAMOUSO can be built via two different ways. However, it is recommended using the first way if you want compiling for one platform only. The second possibility is e.g. for compiling on Windows for AVR or in case you switch between different targets like it is while development.
Recommended way of compiling FAMOUSO
- edit make/config.mk and choose the platform for which FAMOUSO has to be built
- type make in the main directory
- change to the ECHs directory and type make "ech-config" which you want to build
- for some ECH configurations (ech-can) you have to fulfill prerequisites like an installed pcan-lib if you want to use the peak-CAN library. Building FAMOUSO with support for CAN
Alternative way
The steps 1 and 2 are combinable. If you would do this, you will use the make command
#> make CONFIG=PLATFORM
or
#> make FAMOUSO_CONFIG=PLATFORM
with PLATFORM defined as one of the following supported targets
- linux
- linux/openwrt
- linux/xenomai
- windows/mingw-cross
- windows/mingw-native
- windows/cygwin
- avr
The linux target is responsible for all *nix variants and it should usually build and work correcly. We have successfully build FAMOUSO on different flavors of linux aka different linux distributions, Solaris, FreeBSD and Mac OS X.
If you use it in that way, it is needed that you always specify the platform while compiling examples or ECHs.
Building on Windows for the AVR
As an example the build of the AVR-Robot part of the multi-robot demo is shown.
- define the path accordingly to your installation of WinAVR e.g.
#> PATH=/cygdrive/c/Programme/WinAVR-20081205/bin:$PATH #> export PATH #> export TEMP=/tmp
- change to the famouso root dir and compile library
#> make CONFIG=avr
- compiling robot program
#> cd examples/MultiRobotDemo/AVR-Robot/ #> make CONFIG=avr RobotDemo
- flash the application on the AVR-Robot. Maybe it could be necessary that you configure the Makefile for the programmer that you use.
#> make CONFIG=avr RobotDemo.program
Building FAMOUSO with support for CAN
Using CAN as the lowest event transport technologie needs support by an underlying hardware as well as a certain driver. Enabling the use on different platforms (Linux, Windows and Micro-Controller), FAMOUSO is programmed against the generic PAXCAN interface that hides the platform specifics. However, the build process could not be complete untouched, because additional includes and libs are needed to build FAMOUSO ECHs successfully.
FAMOUSO on Standard Linux with PeakCAN char driver support
First of all, you have to download the current PeakCAN driver from the homepage of PEAK System GmbH to a directory you want. Then you have to do the following steps:
#> cd download-dir #> tar xvfz peak-linux-driver.xxx.tar.gz #> cd peak-linux-driver-xxx #> make clean; make NET=NO_NETDEV_SUPPORT #> make install -> needs root privileges
If you do so, you are able to compile the ECHs in this way
#> cd famouso-dir/ECHs #> make ech-can
because the includes and the lib are found by the compiler automatically.
However, if you do not follow the steps above and you have installed the Peak includes/library not in the standard paths, you have to provide the locations to the make process by using a command like this
#> make ech-can PCANINC=path-to-includes PCANLIB=path-to-pcanlib/libpcan.so
Now, you are able to use the compiled tool.
#> ./ech-can -p /dev/pcanXX:2 # or for getting help and seeing the command line parameters #> ./ech-can --help
FAMOUSO on Standard Linux with SocketCAN support
The Linux kernel contains SocketCAN since version 2.6.25. If you have an older kernel, you may upgrade or you have to use the PeakCAN char driver support. For using SocketCAN with Peak hardware, you have to download the current PeakCAN driver from the homepage of PEAK System GmbH to a directory you want. Then you have to do the following steps:
#> cd download-dir #> tar xvfz peak-linux-driver.xxx.tar.gz #> cd peak-linux-driver-xxx #> make clean; make NET=NETDEV_SUPPORT #> make install -> needs root privileges
After that, you have to bring up a CAN interface and set the correct baudrate. How to do this is described in the linux kernel documentation file can.txt.
If you do so, you are able to compile the ECHs in this way
#> cd famouso-dir/ECHs #> make ech-SocketCAN
Now, you are able to use the tool.
#> ./ech-SocketCAN -s canXX # or for getting help and seeing the command line parameters #> ./ech-SocketCAN --help
FAMOUSO on Xenomai Linux with RTCAN support
Xenomai supports RTCAN drivers for different hardware. For determining whether your hardware is supported, consult the Xenomai documentation. If your hardware is supported, it will work together with FAMOUSO using the XenomaiRTCANDriver provided with FAMOUSO.
To get an ECH to work, you have to compile it first
#> cd famouso-dir/ECHs #> make ech-XenomaiRTCAN
Now, you are able to use it.
#> ./ech-XenomaiRTCAN -s rtcanXX # or for getting help and seeing the command line parameters #> ./ech-XenomaiRTCAN --help
The testprogram famouso-root-dir/tst/approved/XenomaiRTCAN.cc may be used to test the compiled ech. The testprogram initialize a local FAMOUSO instance and further subscribes to some event channels, using the CAN bus as underlying transport media.
FAMOUSO on Windows with PeakCAN support
First of all, you have to download the current PCAN-Light PeakCAN driver from the homepage of PEAK System GmbH to a directory you want and install it. Then it is recommended, that you follow exactly the next steps:
#> cd famouso-dir/externals/PEAK #> unzip -a download-dir/usb.zip or pci.zip #> cd famouso-dir #> make
If you do so, you are able to compile the ECHs in this way
#> cd famouso-dir/ECHs #> make ech-can PCANDEVICE={PCI or USB}
because the includes and the lib are found by the compiler automatically. For USB you can omit the explicit mention of PCANDEVICE, because it is the default.
However, if you do not follow the steps above and you have unpacked the Peak includes/library not in the standard path, you have to provide the locations to the make process by using a command like this
#> make ech-can PCANDEVICE={PCI or USB} \ PCANINC=path-to-includes \ PCANLIB=.../Visual\ C++/Pcan_{usb or pci}.lib
Running the tool, needs one further step:
#> cp dir-with-unpacked-driver/Disk/PCAN-Light/Pcan_{usb or pci}.dll . #> ./ech-can --> baudrate is set to 250 kB by default # or for getting help and seeing the command line parameters #> ./ech-can --help
FAMOUSO on AVR with CAN support (at90can32, at90can64, at90can128)
Compiling for the AVR with CAN support needs no further steps. FAMOUSO contains all needed parts.
Examples programs and different language bindings
Example programs can be found under famouso-root-dir/examples, famouso_root_dir/tst, and famouso-root-dir/Bindings. For running the examples, an ech has to be started in the right configuration. Executing the different languange binding examples the famouso-root-dir/ECHs/ech is sufficient to get the examples running. Examples which are part of the MultiRobotDemo need a more complex setup like using an ech-can or ech-UDP-MC.