Fix building guide (rebase because weird things happened

This commit is contained in:
timman2er 2018-09-02 02:54:46 +02:00
parent 3a5961a758
commit b38afdb7db
22 changed files with 64 additions and 64 deletions

View File

@ -1,6 +1,6 @@
# Building in Eclipse # Building in Eclipse
How to build, test & debug Cleanflight in Eclipse on Linux, Windows & MacOS. How to build, test & debug Betaflight in Eclipse on Linux, Windows & MacOS.
## Checklist ## Checklist
@ -17,7 +17,7 @@ Use this checklist to make sure you didn't miss a step. Versions mandated below
- [ ] Optionally [Download and Install](https://github.com/gnuarmeclipse/qemu/releases) the latest GNU ARM Eclipse QEMU [read more](#install-qemu) - [ ] Optionally [Download and Install](https://github.com/gnuarmeclipse/qemu/releases) the latest GNU ARM Eclipse QEMU [read more](#install-qemu)
- [ ] Add a new update site to Eclipse named "GNU ARM Eclipse Plugins" with the URL "http://gnuarmeclipse.sourceforge.net/updates" and install all the features offered - [ ] Add a new update site to Eclipse named "GNU ARM Eclipse Plugins" with the URL "http://gnuarmeclipse.sourceforge.net/updates" and install all the features offered
- [ ] Configure [the recommended workspace settings](http://gnuarmeclipse.github.io/eclipse/workspace/preferences/) - [ ] Configure [the recommended workspace settings](http://gnuarmeclipse.github.io/eclipse/workspace/preferences/)
- [ ] Checkout the cleanflight source code [read more](#checkout-cleanflight) - [ ] Checkout the betaflight source code [read more](#checkout-betaflight)
- [ ] *Windows platform only:* Add the msys or cygwin bin directory to the project path - [ ] *Windows platform only:* Add the msys or cygwin bin directory to the project path
- [ ] Build the code by going to *Project menu -> Build All* [read more](#build) - [ ] Build the code by going to *Project menu -> Build All* [read more](#build)
- [ ] Run the tests by creating and running a make target named "test" - [ ] Run the tests by creating and running a make target named "test"
@ -47,85 +47,85 @@ Retain the default installation directories so that the GNU ARM Plugins can loca
### Install OpenOCD ### 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 Cleanflight or run the tests. 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 ### 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. 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 Cleanflight ### Checkout Betaflight
If you'll be submitting changes to cleanflight, [fork the repository](https://help.github.com/articles/fork-a-repo/) on GitHub and checkout your copy. If you'll be submitting changes to betaflight, [fork the repository](https://help.github.com/articles/fork-a-repo/) on GitHub and checkout your copy.
In Eclipse go to *File -> Import* choose *Git -> Projects from Git* In Eclipse go to *File -> Import* choose *Git -> Projects from Git*
![projects from git](assets/building-in-eclipse/checkout-cleanflight-001.PNG) ![projects from git](assets/building-in-eclipse/checkout-betaflight-001.PNG)
Choose *Clone URI* Choose *Clone URI*
![clone uri](assets/building-in-eclipse/checkout-cleanflight-002.PNG) ![clone uri](assets/building-in-eclipse/checkout-betaflight-002.PNG)
Enter the URI https://github.com/cleanflight/cleanflight or if you've forked the repo, enter your URI instead. With a fork, you will need to specify your authentication details 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](assets/building-in-eclipse/checkout-cleanflight-003.PNG) ![enter uri](assets/building-in-eclipse/checkout-betaflight-003.PNG)
On the branch selection dialog, de-select all branches and select only *master* On the branch selection dialog, de-select all branches and select only *master*
![choose branches to clone](assets/building-in-eclipse/checkout-cleanflight-004.PNG) ![choose branches to clone](assets/building-in-eclipse/checkout-betaflight-004.PNG)
Select the default destination directory Select the default destination directory
![destination](assets/building-in-eclipse/checkout-cleanflight-005.PNG) ![destination](assets/building-in-eclipse/checkout-betaflight-005.PNG)
When the download completes, choose *Use the New Project wizard* and click Finish When the download completes, choose *Use the New Project wizard* and click Finish
![finish](assets/building-in-eclipse/checkout-cleanflight-006.PNG) ![finish](assets/building-in-eclipse/checkout-betaflight-006.PNG)
Choose *C/C++ -> Makefile Project with Existing Code* Choose *C/C++ -> Makefile Project with Existing Code*
![makefile project](assets/building-in-eclipse/checkout-cleanflight-007.PNG) ![makefile project](assets/building-in-eclipse/checkout-betaflight-007.PNG)
Enter cleanflight as the project name and browse to your home directory -> git -> cleanflight for the existing code location. Ensure the C (cleanflight) and C++ (tests) languages are checked. Choose the Cross ARM GCC toolchain for the Indexer Settings. Click finish. 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](assets/building-in-eclipse/checkout-cleanflight-008.PNG) ![finish checkout](assets/building-in-eclipse/checkout-betaflight-008.PNG)
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 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](assets/building-in-eclipse/checkout-cleanflight-012.PNG) ![build](assets/building-in-eclipse/checkout-betaflight-012.PNG)
On Windows only, add msys or cygwin bin directory to the project's path by right clicking the project and choosing properties On Windows only, add msys or cygwin bin directory to the project's path by right clicking the project and choosing properties
![properties](assets/building-in-eclipse/checkout-cleanflight-009.PNG) ![properties](assets/building-in-eclipse/checkout-betaflight-009.PNG)
Edit the path variable in *C/C++ Build -> Environment* Edit the path variable in *C/C++ Build -> Environment*
![edit path](assets/building-in-eclipse/checkout-cleanflight-010.PNG) ![edit path](assets/building-in-eclipse/checkout-betaflight-010.PNG)
Append the full path to the relevant bin dir Append the full path to the relevant bin dir
![append bin dir](assets/building-in-eclipse/checkout-cleanflight-011.PNG) ![append bin dir](assets/building-in-eclipse/checkout-betaflight-011.PNG)
### Build ### Build
Choose project -> build all Choose project -> build all
![build all](assets/building-in-eclipse/checkout-cleanflight-013.PNG) ![build all](assets/building-in-eclipse/checkout-betaflight-013.PNG)
### Configure Debugging ### Configure Debugging
Choose debug -> debug configurations Choose debug -> debug configurations
![debug configurations](assets/building-in-eclipse/checkout-cleanflight-014.PNG) ![debug configurations](assets/building-in-eclipse/checkout-betaflight-014.PNG)
Create a new OpenOCD configuration for the obj\main\cleanflight_XXX.elf application (this file is generated by the build step above) Create a new OpenOCD configuration for the obj\main\betaflight_XXX.elf application (this file is generated by the build step above)
![debug configurations](assets/building-in-eclipse/checkout-cleanflight-015.PNG) ![debug configurations](assets/building-in-eclipse/checkout-betaflight-015.PNG)
Add the appropriate openocd board configuration parameter for your dev platform Add the appropriate openocd board configuration parameter for your dev platform
![openocd target](assets/building-in-eclipse/checkout-cleanflight-016.PNG) ![openocd target](assets/building-in-eclipse/checkout-betaflight-016.PNG)
Add the target to your debug menu favourites Add the target to your debug menu favourites
![debug favs](assets/building-in-eclipse/checkout-cleanflight-017.PNG) ![debug favs](assets/building-in-eclipse/checkout-betaflight-017.PNG)

View File

@ -1,6 +1,6 @@
# Building in Fedora # Building in Fedora
Assuming you already have wget and git available, you should be able to build Cleanflight on a fresh install of Fedora with the following commands (tested on F18, F20 and Ubuntu 14.04): Assuming you already have wget and git available, you should be able to build Betaflight on a fresh install of Fedora with the following commands (tested on F18, F20 and Ubuntu 14.04):
``` ```
wget http://distribute.atmel.no/tools/opensource/Atmel-ARM-GNU-Toolchain/4.8.4/arm-gnu-toolchain-4.8.4.371-linux.any.x86_64.tar.gz wget http://distribute.atmel.no/tools/opensource/Atmel-ARM-GNU-Toolchain/4.8.4/arm-gnu-toolchain-4.8.4.371-linux.any.x86_64.tar.gz
@ -8,9 +8,9 @@ wget http://distribute.atmel.no/tools/opensource/Atmel-ARM-GNU-Toolchain/4.8.4/a
tar xf arm-gnu-toolchain-4.8.4.371-linux.any.x86_64.tar.gz tar xf arm-gnu-toolchain-4.8.4.371-linux.any.x86_64.tar.gz
export PATH=$PATH:$PWD/arm-none-eabi/bin export PATH=$PATH:$PWD/arm-none-eabi/bin
git clone https://github.com/cleanflight/cleanflight.git git clone https://github.com/betaflight/betaflight.git
cd cleanflight cd betaflight
TARGET=NAZE make TARGET=NAZE make
``` ```
This will create cleanflight_NAZE.hex in the obj folder. This will create betaflight_NAZE.hex in the obj folder.

View File

@ -4,7 +4,7 @@ Building in Mac OS X can be accomplished in just a few steps:
* Install general development tools (clang, make, git) * Install general development tools (clang, make, git)
* Install ARM GCC 4.9 series compiler * Install ARM GCC 4.9 series compiler
* Checkout Cleanflight sourcecode through git * Checkout Betaflight sourcecode through git
* Build the code * Build the code
## Install general development tools (clang, make, git) ## Install general development tools (clang, make, git)
@ -37,7 +37,7 @@ installation, open up XCode and enter its preferences menu. Go to the "downloads
## Install ARM GCC 4.9 series compiler ## Install ARM GCC 4.9 series compiler
Cleanflight is built using the 4.9 series GCC compiler provided by the [GNU Tools for ARM Embedded Processors project][]. Betaflight is built using the 4.9 series GCC compiler provided by the [GNU Tools for ARM Embedded Processors project][].
Hit the "all downloads" link on the right side of the GNU Tools for ARM page to view [the older releases][]. Grab the Hit the "all downloads" link on the right side of the GNU Tools for ARM page to view [the older releases][]. Grab the
Mac installation tarball for the latest version in the 4.9 series (e.g. 4.9-2015q2). Move it somewhere useful Mac installation tarball for the latest version in the 4.9 series (e.g. 4.9-2015q2). Move it somewhere useful
@ -73,29 +73,29 @@ If `arm-none-eabi-gcc` couldn't be found, go back and check that you entered the
[GNU Tools for ARM Embedded Processors project]: https://launchpad.net/gcc-arm-embedded [GNU Tools for ARM Embedded Processors project]: https://launchpad.net/gcc-arm-embedded
[the older releases]: https://launchpad.net/gcc-arm-embedded/+download [the older releases]: https://launchpad.net/gcc-arm-embedded/+download
## Checkout CleanFlight sourcecode through git ## Checkout Betaflight sourcecode through git
Enter your development directory and clone the [Cleanflight repository][] using the "HTTPS clone URL" which is shown on Enter your development directory and clone the [Betaflight repository][] using the "HTTPS clone URL" which is shown on
the right side of the Cleanflight GitHub page, like so: the right side of the Betaflight GitHub page, like so:
``` ```
git clone https://github.com/cleanflight/cleanflight.git git clone https://github.com/betaflight/betaflight.git
``` ```
This will download the entire Cleanflight repository for you into a new folder called "cleanflight". This will download the entire betaflight repository for you into a new folder called "betaflight".
[CleanFlight repository]: https://github.com/cleanflight/cleanflight [Betaflight repository]: https://github.com/betaflight/betaflight
## Build the code ## Build the code
Enter the cleanflight directory and run `make TARGET=NAZE` to build firmware for the Naze32. When the build completes, Enter the betaflight directory and run `make TARGET=NAZE` to build firmware for the Naze32. When the build completes,
the .hex firmware should be available as `obj/cleanflight_NAZE.hex` for you to flash using the Cleanflight the .hex firmware should be available as `obj/betaflight_NAZE.hex` for you to flash using the Betaflight
Configurator. Configurator.
## Updating to the latest source ## Updating to the latest source
If you want to erase your local changes and update to the latest version of the Cleanflight source, enter your If you want to erase your local changes and update to the latest version of the Betaflight source, enter your
cleanflight directory and run these commands to first erase your local changes, fetch and merge the latest betaflight directory and run these commands to first erase your local changes, fetch and merge the latest
changes from the repository, then rebuild the firmware: changes from the repository, then rebuild the firmware:
``` ```

View File

@ -1,7 +1,7 @@
# Building in Ubuntu # Building in Ubuntu
Building for Ubuntu platform is remarkably easy. The only trick to understand is that the Ubuntu toolchain, 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 Cleanflight. We suggest that you take an which they are downstreaming from Debian, is not compatible with Betaflight. We suggest that you take an
alternative PPA from Terry Guo, found here: alternative PPA from Terry Guo, found here:
https://launchpad.net/~terry.guo/+archive/ubuntu/gcc-arm-embedded https://launchpad.net/~terry.guo/+archive/ubuntu/gcc-arm-embedded
@ -44,23 +44,23 @@ sudo apt-get install gcc-arm-none-eabi=4.9.3.2014q4-0precise12
After the ARM toolchain from Terry is installed, you should be able to build from source. After the ARM toolchain from Terry is installed, you should be able to build from source.
```bash ```bash
cd src cd src
git clone git@github.com:cleanflight/cleanflight.git git clone git@github.com:betaflight/betaflight.git
cd cleanflight cd betaflight
make TARGET=NAZE make TARGET=NAZE
``` ```
You'll see a set of files being compiled, and finally linked, yielding both an ELF and then a HEX: 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/cleanflight_NAZE.elf arm-none-eabi-size ./obj/main/betaflight_NAZE.elf
text data bss dec hex filename text data bss dec hex filename
97164 320 11080 108564 1a814 ./obj/main/cleanflight_NAZE.elf 97164 320 11080 108564 1a814 ./obj/main/betaflight_NAZE.elf
arm-none-eabi-objcopy -O ihex --set-start 0x8000000 obj/main/cleanflight_NAZE.elf obj/cleanflight_NAZE.hex arm-none-eabi-objcopy -O ihex --set-start 0x8000000 obj/main/betaflight_NAZE.elf obj/betaflight_NAZE.hex
$ ls -la obj/cleanflight_NAZE.hex $ ls -la obj/betaflight_NAZE.hex
-rw-rw-r-- 1 pim pim 274258 Jan 12 21:45 obj/cleanflight_NAZE.hex -rw-rw-r-- 1 pim pim 274258 Jan 12 21:45 obj/betaflight_NAZE.hex
``` ```
You can use the Cleanflight-Configurator to flash the `obj/cleanflight_NAZE.hex` file. You can use the Betaflight-Configurator to flash the `obj/betaflight_NAZE.hex` file.
## Bricked/Bad build? ## Bricked/Bad build?
@ -78,10 +78,10 @@ Make sure to remove `obj/` and `make clean`, before building again.
## Updating and rebuilding ## Updating and rebuilding
Navigate to the local cleanflight repository and use the following steps to pull the latest changes and rebuild your version of cleanflight: Navigate to the local betaflight repository and use the following steps to pull the latest changes and rebuild your version of betaflight:
```bash ```bash
cd src/cleanflight cd src/betaflight
git reset --hard git reset --hard
git pull git pull
make clean TARGET=NAZE make clean TARGET=NAZE

View File

@ -5,7 +5,7 @@
A new feature in Windows 10 allows any developer to quickly and easily run an entire linux subsystem in windows and access it via a bash terminal. This gives developers full use of the entire linux OS and all of the great existing linux tools and programs. When Bash for Windows is up and running it feels like you sshed into a full linux box, except the linux distro is actually running alongside windows locally. A new feature in Windows 10 allows any developer to quickly and easily run an entire linux subsystem in windows and access it via a bash terminal. This gives developers full use of the entire linux OS and all of the great existing linux tools and programs. When Bash for Windows is up and running it feels like you sshed into a full linux box, except the linux distro is actually running alongside windows locally.
If you use Bash on Windows you can easily build cleanflight exactly as you would for Ubuntu. (the linux distro running on Windows is Ubuntu Trusty) If you use Bash on Windows you can easily build betaflight exactly as you would for Ubuntu. (the linux distro running on Windows is Ubuntu Trusty)
Setup for Bash on Windows is very easy and takes less than 5 minutes. [For instructions follow the official guide here.](https://msdn.microsoft.com/commandline/wsl/install_guide) Setup for Bash on Windows is very easy and takes less than 5 minutes. [For instructions follow the official guide here.](https://msdn.microsoft.com/commandline/wsl/install_guide)
@ -61,24 +61,24 @@ add the "bin" subdirectory to the PATH Windows environment variable: ```%PATH%;C
![GNU ARM Toolchain Setup](assets/010.toolchain_path.png) ![GNU ARM Toolchain Setup](assets/010.toolchain_path.png)
## Checkout and compile Cleanflight ## Checkout and compile Betaflight
Head over to the Cleanflight Github page and grab the URL of the GIT Repository: "https://github.com/cleanflight/cleanflight.git" Head over to the Betaflight Github page and grab the URL of the GIT Repository: "https://github.com/betaflight/betaflight.git"
Open the Cygwin-Terminal, navigate to your development folder and use the git commandline to checkout the repository: Open the Cygwin-Terminal, navigate to your development folder and use the git commandline to checkout the repository:
```bash ```bash
cd /cygdrive/c/dev cd /cygdrive/c/dev
git clone https://github.com/cleanflight/cleanflight.git git clone https://github.com/betaflight/betaflight.git
``` ```
![GIT Checkout](assets/011.git_checkout.png) ![GIT Checkout](assets/011.git_checkout.png)
![GIT Checkout](assets/012.git_checkout.png) ![GIT Checkout](assets/012.git_checkout.png)
To compile your Cleanflight binaries, enter the cleanflight directory and build the project using the make command. You can append TARGET=[HARDWARE] if you want to build anything other than the default NAZE target: To compile your Betaflight binaries, enter the Betaflight directory and build the project using the make command. You can append TARGET=[HARDWARE] if you want to build anything other than the default NAZE target:
```bash ```bash
cd cleanflight cd betaflight
make TARGET=NAZE make TARGET=NAZE
``` ```
@ -88,20 +88,20 @@ within few moments you should have your binary ready:
```bash ```bash
(...) (...)
arm-none-eabi-size ./obj/main/cleanflight_NAZE.elf arm-none-eabi-size ./obj/main/betaflight_NAZE.elf
text data bss dec hex filename text data bss dec hex filename
95388 308 10980 106676 1a0b4 ./obj/main/cleanflight_NAZE.elf 95388 308 10980 106676 1a0b4 ./obj/main/betaflight_NAZE.elf
arm-none-eabi-objcopy -O ihex --set-start 0x8000000 obj/main/cleanflight_NAZE.elf obj/cleanflight_NAZE.hex arm-none-eabi-objcopy -O ihex --set-start 0x8000000 obj/main/betaflight_NAZE.elf obj/betaflight_NAZE.hex
``` ```
You can use the Cleanflight-Configurator to flash the ```obj/cleanflight_NAZE.hex``` file. You can use the Betaflight-Configurator to flash the ```obj/betaflight_NAZE.hex``` file.
## Updating and rebuilding ## Updating and rebuilding
Navigate to the local cleanflight repository and use the following steps to pull the latest changes and rebuild your version of cleanflight: Navigate to the local betaflight repository and use the following steps to pull the latest changes and rebuild your version of betaflight:
```bash ```bash
cd /cygdrive/c/dev/cleanflight cd /cygdrive/c/dev/betaflight
git reset --hard git reset --hard
git pull git pull
make clean TARGET=NAZE -j16 -l make clean TARGET=NAZE -j16 -l