Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ubuntu development documentation updated.
- Loading branch information
1 parent
41fa875
commit 5c7939a
Showing
1 changed file
with
36 additions
and
71 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,91 +1,56 @@ | ||
# Building in Ubuntu | ||
|
||
Building for Ubuntu platform is remarkably easy. The only trick to understand is that the Ubuntu toolchain, | ||
which they are downstreaming from Debian, is not compatible with Betaflight. We suggest that you take an | ||
alternative PPA from Terry Guo, found here: | ||
https://launchpad.net/~terry.guo/+archive/ubuntu/gcc-arm-embedded | ||
|
||
This PPA has several compiler versions and platforms available. For many hardware platforms (notably Naze) | ||
the 4.9.3 compiler will work fine. For some, older compiler 4.8 (notably Sparky) is more appropriate. We | ||
suggest you build with 4.9.3 first, and try to see if you can connect to the CLI or run the Configurator. | ||
If you cannot, please see the section below for further hints on what you might do. | ||
|
||
Adjust the ARM_SDK_DIR variable in make/tools.mk file with the correct "gcc-arm-none-eabi-xxx" version. | ||
|
||
## Setup GNU ARM Toolchain | ||
|
||
Note specifically the last paragraph of Terry's PPA documentation -- Ubuntu carries its own package for | ||
`gcc-arm-none-eabi`, so you'll have to remove it, and then pin the one from the PPA. | ||
For your release, you should first remove any older pacakges (from Debian or Ubuntu directly), introduce | ||
Terry's PPA, and update: | ||
```bash | ||
sudo apt-get remove binutils-arm-none-eabi gcc-arm-none-eabi | ||
sudo add-apt-repository ppa:team-gcc-arm-embedded/ppa | ||
sudo apt-get update | ||
``` | ||
Building for Ubuntu platform is remarkably easy. | ||
This document is tested and based on the latest Ubuntu 20.04 LTS release. | ||
|
||
For Ubuntu 14.10 (current release, called Utopic Unicorn), you should pin: | ||
```bash | ||
sudo apt-get install gcc-arm-none-eabi=4.9.3.2014q4-0utopic12 | ||
``` | ||
### Clone betaflight repository and install toolchain | ||
|
||
For Ubuntu 14.04 (an LTS as of Q1'2015, called Trusty Tahr), you should pin: | ||
```bash | ||
sudo apt-get install gcc-arm-none-eabi=4.9.3.2014q4-0trusty12 | ||
``` | ||
|
||
For Ubuntu 12.04 (previous LTS, called Precise Penguin), you should pin: | ||
```bash | ||
sudo apt-get install gcc-arm-none-eabi=4.9.3.2014q4-0precise12 | ||
sudo apt update | ||
sudo apt upgrade | ||
sudo apt install build-essential | ||
git clone https://github.com/betaflight/betaflight.git | ||
cd betaflight | ||
make arm_sdk_install | ||
``` | ||
|
||
## Building on Ubuntu | ||
### Updating and Rebuilding Firmware | ||
|
||
After the ARM toolchain from Terry is installed, you should be able to build from source. | ||
```bash | ||
cd src | ||
git clone git@github.com:betaflight/betaflight.git | ||
cd betaflight | ||
make TARGET=NAZE | ||
``` | ||
Navigate to your local betaflight repository and use the following steps to pull the latest changes and rebuild your version of betaflight: | ||
|
||
You'll see a set of files being compiled, and finally linked, yielding both an ELF and then a HEX: | ||
``` | ||
... | ||
arm-none-eabi-size ./obj/main/betaflight_NAZE.elf | ||
text data bss dec hex filename | ||
97164 320 11080 108564 1a814 ./obj/main/betaflight_NAZE.elf | ||
arm-none-eabi-objcopy -O ihex --set-start 0x8000000 obj/main/betaflight_NAZE.elf obj/betaflight_NAZE.hex | ||
$ ls -la obj/betaflight_NAZE.hex | ||
-rw-rw-r-- 1 pim pim 274258 Jan 12 21:45 obj/betaflight_NAZE.hex | ||
git reset --hard | ||
git pull | ||
make clean TARGET=MATEKF722 | ||
make TARGET=MATEKF722 [OPTIONS=RANGEFINDER] [DEBUG=DBG] | ||
``` | ||
|
||
You can use the Betaflight-Configurator to flash the `obj/betaflight_NAZE.hex` file. | ||
|
||
## Bricked/Bad build? | ||
Using the optional OPTIONS parameters you can specify options like RANGEFINDER. | ||
Using the optional DEBUG parameter you can specify the debugger. | ||
|
||
Users have reported that the 4.9.3 compiler for ARM produces bad builds, for example on the Sparky hardware platform. | ||
It is very likely that using an older compiler would be fine -- Terry happens to have also a 4.8 2014q2 build in his | ||
PPA - to install this, you can fetch the `.deb` directly: | ||
http://ppa.launchpad.net/terry.guo/gcc-arm-embedded/ubuntu/pool/main/g/gcc-arm-none-eabi/ | ||
You'll see a set of files being compiled, and finally linked, yielding both an ELF and then a HEX. | ||
You can use the Betaflight-Configurator to flash the `obj/betaflight_MATEKF722.hex` file. | ||
Make sure to remove `obj/` and `make clean`, before building again. | ||
|
||
and use `dpkg` to install: | ||
```bash | ||
sudo dpkg -i gcc-arm-none-eabi_4-8-2014q2-0saucy9_amd64.deb | ||
``` | ||
### Building Betaflight Configurator | ||
|
||
Make sure to remove `obj/` and `make clean`, before building again. | ||
See [Betaflight Configurator Development](https://github.com/betaflight/betaflight-configurator#development) for how to build the Betaflight Configurator. | ||
|
||
## Updating and rebuilding | ||
### Flashing a target with Betaflight Configurator on Ubuntu 20.04 | ||
|
||
Navigate to the local betaflight repository and use the following steps to pull the latest changes and rebuild your version of betaflight: | ||
In most Linux distributions the user won't have access to serial interfaces by default. Flashing a target requires configuration of usb for dfu mode. To add this access right type the following command in a terminal: | ||
|
||
```bash | ||
cd src/betaflight | ||
git reset --hard | ||
git pull | ||
make clean TARGET=NAZE | ||
make | ||
``` | ||
sudo usermod -a -G dialout $USER | ||
sudo usermod -a -G plugdev $USER | ||
sudo apt-get remove modemmanager | ||
lsusb | ||
(echo '# DFU (Internal bootloader for STM32 MCUs)' | ||
echo 'ACTION=="add", SUBSYSTEM=="usb", ATTRS{idVendor}=="0483", ATTRS{idProduct}=="df11", MODE="0664", GROUP="plugdev"') | sudo tee /etc/udev/rules.d/45-stdfu-permissions.rules > /dev/null | ||
``` | ||
|
||
Please log out and log in to active the settings. You should now be able to flash your target using Betaflight Configurator. | ||
|
||
|
||
Credit goes to K.C. Budd, AKfreak for testing, and pulsar for doing the long legwork that yielded the original content of this document. | ||
|
||
Credit goes to K.C. Budd, AKfreak for testing, and pulsar for doing the long legwork that yielded this very short document. |