Compiling Firmware

From Open-BLDC
Jump to: navigation, search

This is a description in a few easy stepps how to get build and compile the Open-BLDC software by yourself.

We currently support building Open-BLDC firmware and qgovernor on the following platforms:

  • Linux (tested on Debian and Ubuntu)
  • Mac OS X (tested on Snow Leopard)
  • Windows (CygWin)

Getting the source

The sourcecode for Open-BLDC is available in the GitHub open-bldc repository.

First step is to clone the git repository:

git clone git://github.com/open-bldc/open-bldc.git

Note: if GitHub is down for some reason you can still get it from our backup clone of the repository:

git clone git://git.open-bldc.org/open-bldc.git

Compiling the firmware

Prerequisites

You NEED to use the summon arm toolchain to build Open-BLDC Firmware, it contains libstm32 and libopenstm32 that is required. You can also use other toolchains but they are not tested, and you need to build libstm32 and/or libopenstm32 yourself.

You also will need the following packages you may already have installed some of them while building the toolchain:

Building the toolchain

You can find a detailed description of how to do that here. You really should use the toolchain described on that page, that will make your life much easier and decrease the amount of questions from you. :)

Compiling and flashing the firmware

Before you can build anything you need to set the PATH variable so that the build system can find the arm crosscompiler:

export PATH=~/sat/bin:$(PATH)

Building the firmware

Now all prerequisites should be present. You can now build the firmware by just running:

cd [Open-BLDC repository]/source
make

This will build all the internal dependencies (yamlgen, olconfgen, libgovernor) and the motor control firmware.

Flashing the motor control firmware

After you connected the flossjtag to your computer and to the Open-BLDC hardware you can simply run:

make flash

Note: If you are using Mac OS X you may want to unload the FTDI driver running:

sudo kextunload /System/Library/Extensions/FTDIUSBSerialDriver.kext

Otherwise openocd will complain that it can not find Floss-JTAG.

Compiling qgovernor PC software

Linux (Debian / Ubuntu)

Compiling and installing libgovernor

Build libqgovernor on the native host

cd [Open-BLDC repository]/source/libgovernor
./configure
make
make install

Run libtool to propagate the shared lib:

$ sudo libtool

Compiling and installing qgovernor

As qgovernor is a Qt4 application, it depends on Qt. For development, install the Qt4 developer packages

$ apt-get install qt4-qmake qt4-dev-tools qtcreator libftdi-dev libyaml-dev

Build the Qt application:

cd [Open-BLDC repository]/software/qgovernor
qmake
make

Run qgovernor:

 ./qgovernor