Real Time Paparazzi with ChibiOS/RT

<b>NOTE: This pull-request is not meant to be merged (yet). We are using pull request so it is easier to comment the code and discuss about it.</b>

Dear developers, dear community.
Here is the first version of Real Time Paparazzi, based on ChibiOS/RT(http://www.chibios.org) and extending work of @enacuavlab. It is certainly not a complete work, rather the first step how to adapt Paparazzi to a RT OS. The system is developed and tested on Lia 1.1 (STM32F1, http://paparazzi.enac.fr/wiki/Lisa/M_v2.0) board, so it can be easily used in existing autopilots.

The system architecture is shown below. To change as little code as possible, Paparazzi interfaces with ChibiOS via new main_chibios.c file (main thread, invoking other threads according to the system settings) and via arch/chibios files. Those are basically middleware, translating between high-level architecture independent paparazzi functions (such as uart_transmit) and ChibiOS HAL API (such as sdWrite). 

To get the full potential of RT system, the monolithic Paparazzi application had to be split into more individual threads. Threads are effectively replacing periodic function and events. That is probably the biggest change. The rewards are control over task timing and priorities, and hardware independence for Paparazzi. The ChibiOS drivers are also expected to be more efficient, since DMA is natively used where applicable (USART, SPI).

![rt_paparazzi](https://f.cloud.github.com/assets/2790461/1304555/48400060-3183-11e3-979b-6731eb2ba4d8.png)

<b>Benefits of ChibiOS/RT&Paparazzi:<b/>
* HAL for interaction with HW (libopencm3 not needed, deployable on any architecture that ChibiOS supports - see http://www.chibios.org/dokuwiki/doku.php?id=chibios:architectures)
* Real time system (precise control over task timing and priorities via independent threads)
* Error handling (defined error handlers, timeouts for tasks/threads), fixes for example #531 

<b>Features of version 0.1:<b/>
* Paparazzi & ChibiOS compiles and run from Paparazzi center
* Upload over JTAG or DFU (bootloader)
* Rotorcraft firmware with ap target (hexarotor_lia_rt.xml)
* Telemetry and GPS works (as an example of I/O handling - ublox and PprzTransport)
* Heartbeat and basic OS info available
* Example of arch/chibios code (uart_arch.*)

For illustration, the current system set-up is shown below:
![rtos_telemetry_ii](https://f.cloud.github.com/assets/2790461/1304779/fdbb111e-3188-11e3-990d-1cafb2a5e526.png)

<b>Note:</b>
* GCC ARM Embedded toolchain was used for compilation https://launchpad.net/gcc-arm-embedded


<b>Pending:</b>
* Finish arch/chibios middleware for all peripherals (SPI, I2C, PWM, PPM)
* Add threads for subsystems (imu data, ahrs, actuators) and modules
* Figure out the best way how to interface the current events/periodic functions with threads
* Mutex for all structs that can be accessed simultaneously (e.g gps, ahrs, ins...)
* Define timers and error handlers for peripherals (i2C etc)
* set ChibiOS as a separate github module (so it can be updated by ChibiOS developers)

We would gladly appreciate any feedback on our work, especially code style/attribution, architecture design, interface between Paparazzi and ChibiOS etc. so the RT Paparazzi can fly soon!

With regards
Michal and Cal
http://aggieair.usu.edu/