You are here

Setting up a development environment on Ubuntu 16.04 and later LTS releases

Submitted by benjamin on Wed, 2018-01-24 10:16

This guide describes how to set up a development environment on Ubuntu 16.04 and later for working with the VESC firmware and VESC Tool. Open a terminal and follow along...

Start by updating the system and installing some required packages:

sudo apt update
sudo apt upgrade
sudo apt install build-essential openocd git libudev-dev qt-sdk

Now install the gcc-arm-embedded toolchain (see this page for more details)

sudo add-apt-repository ppa:team-gcc-arm-embedded/ppa

press Y, enter, then

sudo apt update
sudo apt install gcc-arm-embedded

now add udev rules to use the stlink v2 programmer without beeing root

sudo mv 49-stlinkv2.rules /etc/udev/rules.d/
sudo udevadm trigger

At this point you should be able to clone the firmware from github, build it and upload it. Let's give it a try

git clone vesc_firmware
cd vesc_firmware

by default this will build firmware for hardware version 6. To change the hardware version, open conf_general.h and change it to use the hardware version that you have. For example, for HW 4.12 it should look like this

 * Select only one hardware version
#if !defined(HW_VERSION_40) && !defined(HW_VERSION_45) && !defined(HW_VERSION_46) && \
	!defined(HW_VERSION_48) && !defined(HW_VERSION_49) && !defined(HW_VERSION_410) && \
	!defined(HW_VERSION_60) && !defined(HW_VERSION_R2) && !defined(HW_VERSION_VICTOR_R1A) && \
	!defined(HW_VERSION_DAS_RS) && !defined(HW_VERSION_PALTA) && !defined(HW_VERSION_RH) && \
//#define HW_VERSION_40
//#define HW_VERSION_45
//#define HW_VERSION_46 // Also for 4.7
//#define HW_VERSION_48
//#define HW_VERSION_49
#define HW_VERSION_410 // Also for 4.11 and 4.12
//#define HW_VERSION_60
//#define HW_VERSION_R2
//#define HW_VERSION_RH
//#define HW_VERSION_TP

there are also many other options that can be changed in conf_general.h. To rebuild the firmware after the changes, run


now connect the stlink v2 programmer, connect power from a lab power supply and try to upload the firmware

make upload

It should say verified ok towards the end if everything went well.


In order to build VESC Tool you need a recent version of the Qt SDK. Go to and get Qt Open Source. You should get a file called something like Set the executable flag of the file and install it as root to get a system-wide installation

cd Downloads
chmod +x
sudo ./

follow the instructions to finish the installation. You might also need the following packages:

sudo apt install mesa-common-dev libgl1-mesa-dev libglu1-mesa-dev

At this point you should be able to clone the source code for VESC Tool and build it.

git clone vesc_tool

It is recommended to open the project file from Qt Creator (which you should have after the previous step) and build the project from there. Instructions for building the android version will be added later.


Downloading Qt is harder than you would think as by default it isn't downloaded when following the download instructions. The installer has a page with checkbuttons to pick what to download. You have to go down within the Qt box (Not the previews one) which looks like it has already been selected, and then somewhere in there select Qt 5.10...

That may have slowed me down a bit this morning...

One more step should be added concerning the kit build and run kit.

By default I had another version that didn't work.

For beginners, it can be confusing.

Ubuntu 18-04

I have compiled with qt 5.11.1 and 5.10.1 but i got some error with non existing GL.h

Following packages will fix this error.

sudo apt-get install mesa-common-dev libgl1-mesa-dev libglu1-mesa-dev



Good mornig,

I'm trying to compile the latest version of vesc firmware. I've an old 4.12 version. After changing the hardware version and uploading the firmware nothing work, vesc is not recognized by vesc-tool. I've seen that there are substantial modification also in conf_general.h, like there no exist more #define HW_VERSION but instead HW_SOURCE and HW_HEADER, so: there are other modification in conf_general that i must make in order to properly config my vesc?

Thank you

I have spent hours trying to figure out how to compile the vesc-tool for my android. It keeps giving me an error saying that it cant find the serialbus module when opening the .pro file. A google search came up with one answer that didnt work. I am running Qt 5.10.1. I also tried 5.12 and 5.13. neither worked. If anyone knows how to fix this, (or even a VM of everything) any help would be appreciated.


Andrew Cline

Andrew Cline

after make and upload showing error

openocd -f board/stm32f4discovery.cfg -c "reset_config trst_only combined" -c "program build/BLDC_4_ChibiOS.elf verify reset exit" # For openocd 0.9

/bin/sh: 1: openocd: not found

Makefile:289: recipe for target 'upload' failed

make: *** [upload] Error 127

It has been discovered that not all versions of gcc produce working binaries. (

the latest version of gcc that works on ubuntu 20.04 and builds working binaries can be found here:


For compiling vesc tool it now seems like following the instructions in the build_lin and build_win scripts is the way to go. some dependencies need to be swapped out depending on ubuntu version though.