Skip to main content

Building in Eclipse

How to build, test & debug Betaflight in Eclipse on Linux, Windows & MacOS.

Checklist

Use this checklist to make sure you didn't miss a step. Versions mandated below are current and correct as of January 2016.

Extended Notes

Install the JDK

The minimum JDK version supported by GNU Arm Eclipse is 1.7 but the current latest, 1.8, is recommended instead. While Oracle JDK is the recommended version, they do also support the OpenJDK.

Install Eclipse

Eclipse Luna v4.4 is the preferred version for GNU Arm Tools currently. The minimum Eclipse version is Kepler 4.3. The maximum is Mars 4.5 although it is not tested by GNU Arm Eclipse and some things are known to be broken. Eclipse Neon is currently not released.

CDT v8.6.0, as shipped in the Eclipse Luna CDT download, is recommended. The minimum CDT version is 8.3.

The 64bit Eclipse is preferred but a 32bit Eclipse can be used; ensure you run it on a 32bit JDK.

Install ARM Toolchain

The minimum version is 4.8-2014-q2. The maximum, and currently recommended version, is 4_9-2015q3.

GNU ARM Tools recommends that you don't add the toolchain to your path environment variable. This means you can install multiple versions of the toolchain without conflict. If you'll install only one version, it can make life easier when working outside Eclipse to add it to your path.

Retain the default installation directories so that the GNU ARM Plugins can locate the toolchain.

Install OpenOCD

You should install OpenOCD If you will be debugging on real hardware, such as the STM32F3DISCOVERY dev board. It is not required to simply build Betaflight or run the tests.

Install QEMU

No tests currently run on the QEMU emulator therefore this install is entirely optional. It is useful to test your installation, since you can compile and run a blinky demo.

Checkout Betaflight

If you'll be submitting changes to betaflight, fork the repository on GitHub and checkout your copy.

In Eclipse go to File -> Import choose Git -> Projects from Git

projects from git

Choose Clone URI

clone uri

Enter the URI https://github.com/betaflight/betaflight or if you've forked the repo, enter your URI instead. With a fork, you will need to specify your authentication details

enter uri

On the branch selection dialog, de-select all branches and select only master

choose branches to clone

Select the default destination directory

destination

When the download completes, choose Use the New Project wizard and click Finish

finish

Choose C/C++ -> Makefile Project with Existing Code

makefile project

Enter betaflight as the project name and browse to your home directory -> git -> betaflight for the existing code location. Ensure the C (betaflight) and C++ (tests) languages are checked. Choose the Cross ARM GCC toolchain for the Indexer Settings. Click finish.

finish checkout

Set your build and debug targets by going to project properties -> C/C++ Build and choose the Behaviour tab. Replace "all" in the build box with "TARGET=xxx DEBUG=GDB" where xxx is your platform such as NAZE

build

On Windows only, add msys or cygwin bin directory to the project's path by right clicking the project and choosing properties

properties

Edit the path variable in C/C++ Build -> Environment

edit path

Append the full path to the relevant bin dir

append bin dir

Build

Choose project -> build all

build all

Configure Debugging

Choose debug -> debug configurations

debug configurations

Create a new OpenOCD configuration for the obj\main\betaflight_XXX.elf application (this file is generated by the build step above)

debug configurations

Add the appropriate openocd board configuration parameter for your dev platform

openocd target

Add the target to your debug menu favourites

debug favs