Skip to content
qgc edited this page Oct 23, 2011 · 25 revisions

Important Notes

Make sure to look at the common mistakes section at the end of this page if you run into trouble. Read this short guide once before starting, then follow the links and install everything.

Hooking up the board

Make sure you have all cables and adapters ready. A list of connectors and a picture how to connect them is available here:

https://github.com/qgc/hardware/wiki/Connectors-and-Peripherals

Setting up the toolchain

The OpenPilot Guide is partly outdated.

OUTDATED OPENPILOT GUIDE: http://wiki.openpilot.org/display/Doc/Setting+up+a+Firmware+Development+Environment

Compiling the code

Code Repository:

http://github.com/qgc/openpilot.git

Checkout the PX2 repository. If you wan't to develop code, you should sign up for GitHub and fork the repository (http://help.github.com/fork-a-repo/). You don't have to follow the Eclipse import instructions on the OpenPilot Wiki, instead follow the instructions below.

mkdir -p ~/src  
git clone http://github.com/qgc/openpilot.git
cd openpilot
cp cproject-copy-to-.cproject .cproject
cp project-copy-to-.project .project

Import the main folder in to eclipse as existing project (in this case the main folder would be ~/src/openpilot) - you should have all the debug and run targets already in Eclipse after the inport. The only thing that remains to be done is to right click on the openpilot-flight project and select "Build Configurations -> Set Active -> PX2FMU".

MAC OS X LEOPARD: Eclipse Settings

If you work on Mac OS or have a system where the compiler is not in the default path, you also need to tell Eclipse where to search for the compiler and OpenOCD.

The screenshot below shows how to setup the paths correctly. You can reach this menu by selecting Eclipse/File -> Preferences -> C/C++/Build/Environment.

Eclipse custom paths

WINDOWS XP / 7: Eclipse Settings

Eclipse project build Windows (1) Eclipse project build Windows (2) Eclipse project build Windows (3)

You need also to add the four directories below to your Eclipse path (DO NOT ADD THEM TO THE WINDOWS PATH!). Please check the invididual paths on your system, they are most probably the same as below, but might be slightly different(!).

  • MSYSGIT: xxx\msysgit\bin
  • QtSDK: xxx\QtSDK\mingw\bin
  • QtSDK: xxx\QtSDK\Desktop\Qt\4.7.4\mingw\bin
  • Python 2.7: xxx\Python27

Assuming you have a standard installation of MSYSGIT, Qt and Python, the PATH variable in Eclipse (Screenshot below) will look like this. It is ok if the naming is not 100% matching, just make sure to get the right subdirectories AND DO NOT USE SPACES IN THE FOLDER NAMES!

C:\msysgit\bin;C:\QtSDK\mingw\bin;C:\QtSDK\Desktop\Qt\4.7.4\mingw\bin;C:\Python27

Eclipse project build Windows (4)

Eclipse Introduction

The screenshot below shows the core functions: Compiling, flashing and debugging. Individual OpenPilot features are activated / deactivated in the Makefile in the MODULES section (the makefile is highlighted in grey in the leftmost column).

OpenPilot Eclipse Introduction

Eclipse Debugging

Eclipse supports step-by-step debugging / code execution. The setup is covered in this guide: Eclipse Debug Support Setup Tutorial.

After the setup refer to the Debugging Tutorial / Reference for a quick introduction how to use it.

Choosing the right Telemetry

OpenPilot supports its own UAVTalk protocol and MAVLink. UAVTalk is nicely integrated with the OpenPilot GCS, but its not straightforward to bring new measurement values and parameters to the GUI. We recommend to use this protocol when you don't need much custom functionality and if you don't need full support for autonomous waypoint-based missions. MAVLink allows to use QGroundControl, which in turn allows custom buttons, sliders and can graph any message content. In addition it has a rich mission language, suitable for indoor and outdoor use.

If you have in your Makefile (openpilot/flight/PX2FMU/Makefile) this enabled:

MODULES += MAVLink

use QGroundControl from here: https://github.com/mavlink/v10release/downloads

If you have UAVTalk (Telemetry module) enabled:

MODULES += Telemetry

Go into the openpilot main directory, type

make gcs -j8

To build the OpenPilot GCS. You will find it in the openpilot/build/ground/.. folder.

Unbricking / Manual development

If you prefer to work without Eclipse or you need to unbrick the board, these instructions will give you the minimum set needed to flash the board via JTAG:

https://github.com/qgc/hardware/wiki/PX2-Bringup-and-Unbricking-Notes

Common Mistakes

If you fail to set the correct build target, you will end up with this error message:

 **** Build of configuration OpenPilot for project openpilot-flight ****

 make fw_px2fmu 
 Makefile:28: openpilot/make/boards//board-info.mk: No such file or directory
 make: *** No rule to make target `openpilot/make/boards//board-info.mk'.  Stop.

 **** Build Finished ****

If you have installed the GCC compiler (arm-none-eabi-gcc) not in a standard directory / on the system path, you might end up with this error message:

**** Build of configuration PX2FMU for project openpilot-flight ****

make fw_px2fmu 
*NOTE*      Sanitized disallowed variable 'TMPDIR' from environment
make[1]: Nothing to be done for `first'.
- OpenPilot UAVObject Generator -
Done: processed 49 XML files and generated 49 objects with no ID collisions. Total size of the data fields is 1600 bytes.
generating flight code
 FWINFO     build/fw_px2fmu/fw_px2fmu.bin.firmwareinfo.c
 CC         build/fw_px2fmu/fw_px2fmu.bin.firmwareinfo.c
make[1]: arm-none-eabi-gcc: No such file or directory
make[1]: *** [openpilot/build/fw_px2fmu/fw_px2fmu.bin.firmwareinfo.o] Error 1
make: *** [fw_px2fmu_opfw] Error 2

**** Build Finished ****

If GIT is not on your $PATH variable, the firmware compilation might break at this point:

 FWINFO     build/fw_px2fmu/fw_px2fmu.bin.firmwareinfo.c
 CC         build/fw_px2fmu/fw_px2fmu.bin.firmwareinfo.c
openpilot/build/fw_px2fmu/fw_px2fmu.bin.firmwareinfo.c:61:24: error: invalid suffix "xNone" on integer constant
openpilot/build/fw_px2fmu/fw_px2fmu.bin.firmwareinfo.c:62:15: error: 'None' undeclared here (not in a function)
make[1]: *** [openpilot/build/fw_px2fmu/fw_px2fmu.bin.firmwareinfo.o] Error 1
make: *** [fw_px2fmu_opfw] Error 2

To resolve this error, add GIT to your system's path, or add it in Eclipse in Preferences -> C/C++ -> Environment