updated README
This commit is contained in:
parent
991ec55101
commit
86b3d7f2b5
@ -1,8 +1,6 @@
|
||||
################################################################################
|
||||
# CMake support for the Flight Software Framework
|
||||
#
|
||||
# Developed in an effort to replace Make with a modern build system.
|
||||
#
|
||||
# Author: R. Mueller
|
||||
################################################################################
|
||||
|
||||
@ -15,8 +13,8 @@ cmake_minimum_required(VERSION 3.13)
|
||||
|
||||
set(CMAKE_SCRIPT_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
|
||||
|
||||
if(NOT OS_FSFW)
|
||||
set(OS_FSFW host CACHE STRING "OS for the FSFW.")
|
||||
if(NOT FSFW_OSAL)
|
||||
set(FSFW_OSAL host CACHE STRING "OS for the FSFW.")
|
||||
endif()
|
||||
|
||||
if(TGT_BSP MATCHES "arm/raspberrypi" OR TGT_BSP MATCHES "arm/beagleboneblack")
|
||||
@ -163,13 +161,6 @@ if(CMAKE_CROSSCOMPILING)
|
||||
post_source_hw_os_config()
|
||||
endif()
|
||||
|
||||
if(NOT CMAKE_SIZE)
|
||||
set(CMAKE_SIZE size)
|
||||
if(WIN32)
|
||||
set(FILE_SUFFIX ".exe")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(TGT_BSP)
|
||||
set(TARGET_STRING "Target BSP: ${TGT_BSP}")
|
||||
else()
|
||||
|
@ -409,3 +409,82 @@ scp <user_name>@<ip-address>:/lib/arm-linux-gnueabihf/libc.so.6 <rootfs_path>/li
|
||||
|
||||
If any custom libraries are used which rely on symlinks, it might be necessary to copy them
|
||||
or create them manually as well.
|
||||
|
||||
# <a id="ctng"></a> Building a cross-compile toolchain with crosstool-ng
|
||||
|
||||
If you want to cross-compile the toolchain for the Raspberry Pi, you can do so
|
||||
with the `crosstool-ng` tool.
|
||||
|
||||
Alternatively, you can also download a cross-compile toolchain built with
|
||||
crosstool-ng for the Beagle Bone Black
|
||||
[from here](https://www.dropbox.com/sh/zjaex4wlv5kcm6q/AAABBFfmZSRZ7GE7ok-7vTE6a?dl=0)
|
||||
inside the `x-tools` folder.
|
||||
|
||||
## Ubuntu
|
||||
|
||||
1. Install prerequisites to build toolchains
|
||||
|
||||
```sh
|
||||
sudo apt-get install automake bison chrpath flex g++ git gperf gawk help2man libexpat1-dev
|
||||
libncurses5-dev libsdl1.2-dev libtool libtool-bin libtool-doc python2.7-dev texinfo
|
||||
```
|
||||
|
||||
2. Install `crosstool-ng`. You can checkout a concrete version in the git repository, we will
|
||||
simply build the master branch here:
|
||||
|
||||
```sh
|
||||
git clone https://github.com/crosstool-ng/crosstool-ng.git
|
||||
cd crosstool-ng/
|
||||
```
|
||||
|
||||
3. Install `crosstool-ng`.
|
||||
```sh
|
||||
./bootstrap
|
||||
./configure --enable-local
|
||||
make
|
||||
sudo make install
|
||||
```
|
||||
|
||||
You can also install `ct-ng` locally by supplying `--prefix=<installPath>` to the `configure`
|
||||
command. You don't need `sudo` for the `make install` command if you do this
|
||||
|
||||
4. You can get a list of architectures by running
|
||||
|
||||
```sh
|
||||
./ct-ng list-samples > samples.txt
|
||||
cat samples.txt
|
||||
```
|
||||
|
||||
`ct-ng` includes pre-configurations for the Raspberry Pis. For example you can display the
|
||||
settings for the Raspberry Pi 3 with the command
|
||||
|
||||
```sh
|
||||
./ct-ng show-arm-cortex_a8-linux-gnueabi
|
||||
```
|
||||
|
||||
You can add the configuration with
|
||||
|
||||
```sh
|
||||
./ct-ng arm-cortex_a8-linux-gnueabi
|
||||
```
|
||||
|
||||
You can now customize the build with
|
||||
|
||||
```sh
|
||||
./ct-ng menuconfig
|
||||
```
|
||||
|
||||
It is recommended to go to `Paths and misc options` and disable `Paths and misc options`.
|
||||
It is also recommended to go to `Target Options` → `Floating Points` and enable hardware
|
||||
flaoting point support.
|
||||
|
||||
Remember to save the configuration.
|
||||
|
||||
5. Finally, after finishing the configuration you can build the toolchain with
|
||||
|
||||
```sh
|
||||
./ct-ng build
|
||||
```
|
||||
|
||||
This takes 20-30 minutes. You can find the toolchain in the `~/x-tools` folder after building
|
||||
has finished
|
||||
|
@ -3,13 +3,13 @@
|
||||
<sub><sup>Image taken from [Raspberry Pi website](https://www.raspberrypi.org/trademark-rules/).
|
||||
Raspberry Pi is a trademark of the Raspberry Pi Foundation</sup></sub>
|
||||
|
||||
# Getting started on the Raspberry Pi
|
||||
|
||||
Getting started on the Raspberry Pi
|
||||
======
|
||||
The FSFW can be run on a Raspberry Pi with the Linux OSAL, using
|
||||
an ARM linux (cross) compiler. Instructions will be provided on how
|
||||
to do this.
|
||||
|
||||
## General Information
|
||||
# General Information
|
||||
|
||||
The following instructions will show how to build the example on the Raspberry Pi directly.
|
||||
It will also show how to cross-compile on a host machine and mirror the Raspberry Pi sysroot folder
|
||||
@ -19,13 +19,13 @@ for the cross-compilation process.
|
||||
Some Eclipse project files were provided as well to help with setting up the indexer in Eclipse
|
||||
more quickly.
|
||||
|
||||
## Prerequisites for direct compilation and cross-compiling
|
||||
# Prerequisites for direct compilation and cross-compiling
|
||||
|
||||
1. SSH connection to the Raspberry Pi working
|
||||
2. Raspberry Pi linux environment set up properly
|
||||
3. `CMake` installed
|
||||
|
||||
## Setting up general prerequisites for Linux systems
|
||||
# Setting up general prerequisites for Linux systems
|
||||
|
||||
1. Install `CMake` and `rsync`
|
||||
|
||||
@ -44,7 +44,7 @@ more quickly.
|
||||
sudo apt-get install gpiod libgpiod-dev
|
||||
```
|
||||
|
||||
## Getting started on the Raspberry Pi
|
||||
# Getting started on the Raspberry Pi
|
||||
|
||||
Make sure to follow the steps above. Now you should be able to build the software on
|
||||
the Raspberry Pi. A ssh connection to the Raspberry Pi is assumed here
|
||||
@ -58,15 +58,15 @@ cmake -DOS_FSFW=linux -DTGT_BSP=arm/raspberrypi -DLINUX_CROSS_COMPILE=OFF -DCMAK
|
||||
cmake --build . -j
|
||||
```
|
||||
|
||||
## Prerequisites for cross-compiling
|
||||
# Prerequisites for cross-compiling
|
||||
|
||||
These prerequisites are valid for Linux as well as Windows hosts.
|
||||
|
||||
1. ARM Linux cross compiler installed
|
||||
2. Raspberry Pi sysroot folder mirrored on the host machine, using `rsync`
|
||||
2. Raspberry Pi sysroot folder mirrored on the host machine, using `rsync` or `scp`
|
||||
3. gdb-multiarch installed on host for remote debugging or `tcf-agent` running on Raspberry Pi
|
||||
|
||||
## Cross-Compiling on a Linux Host
|
||||
# Cross-Compiling on a Linux Host
|
||||
|
||||
Steps tested for Ubuntu 20.04. Adapt accordingly for used Linux distribution.
|
||||
The following steps are based on this
|
||||
@ -76,13 +76,17 @@ based on Debian buster is used. If this is not the case, it is recommended to
|
||||
follow the steps in the stackoverflow post above and to make sure that the
|
||||
toolchain binaries are added to the path accordingly.
|
||||
|
||||
### Setting up prerequisites for cross-compiling
|
||||
## Setting up prerequisites for cross-compiling
|
||||
|
||||
You can skip step 1 if you already have a cross-compile toolchain or you can
|
||||
cross-compile a toolchain yourself by following the steps in the
|
||||
[crosstool-ng chapter](#ctng).
|
||||
|
||||
1. Install the pre-built ARM cross-compile with the following command
|
||||
|
||||
```sh
|
||||
wget https://github.com/Pro/raspi-toolchain/releases/latest/download/raspi-toolchain.tar.gz
|
||||
```
|
||||
```sh
|
||||
wget https://github.com/Pro/raspi-toolchain/releases/latest/download/raspi-toolchain.tar.gz
|
||||
```
|
||||
|
||||
Then extract to the opt folder:
|
||||
|
||||
@ -171,9 +175,9 @@ toolchain binaries are added to the path accordingly.
|
||||
4. Perform the steps [in the cross-compile section](#cross-test) to build the
|
||||
software for the Raspberry Pi and test it.
|
||||
|
||||
## Cross-Compiling on a Windows Host
|
||||
# Cross-Compiling on a Windows Host
|
||||
|
||||
### Additional Prerequites
|
||||
## Additional Prerequites
|
||||
|
||||
1. [MSYS2](https://www.msys2.org/) installed. All command line steps shown here
|
||||
were performed in the MSYS2 MinGW64 shell (not the default MSYS2, use MinGW64!).
|
||||
@ -182,7 +186,7 @@ toolchain binaries are added to the path accordingly.
|
||||
repository and to run `git config --global core.autocrlf true` for git in
|
||||
MinGW64.
|
||||
|
||||
### Setting up prerequisites for Windows
|
||||
## Setting up prerequisites for Windows
|
||||
|
||||
1. Install CMake and rsync in MinGW64 after installing MSYS2
|
||||
|
||||
@ -249,7 +253,7 @@ toolchain binaries are added to the path accordingly.
|
||||
6. Perform the steps [in the following chapter](#cross-test) to build the
|
||||
software for the Raspberry Pi and test it.
|
||||
|
||||
## <a id="cross-test"></a> Testing the cross-compilation
|
||||
# <a id="cross-test"></a> Testing the cross-compilation
|
||||
|
||||
It is recommended to set the following environmental variables for the CMake build:
|
||||
- `CROSS_COMPILE`: Explicitely specify the name of the cross compiler
|
||||
@ -321,13 +325,13 @@ Navigate into the `fsfw_example` folder first.
|
||||
./fsfw_example
|
||||
```
|
||||
|
||||
### Setting up Eclipse for a Raspberry Pi remote target
|
||||
## Setting up Eclipse for a Raspberry Pi remote target
|
||||
|
||||
It is recommended to use the provided Eclipse project files and
|
||||
launch configurations to have a starting point. See the specific section in
|
||||
the [Eclipse README](README-eclipse.md#top) for information how to do this.
|
||||
|
||||
#### Windows
|
||||
### Windows
|
||||
|
||||
There are some additional steps necessary on Windows: The cross-compiler by
|
||||
default is configured to look for the cross-compiler in `/opt/cross-pi-gcc/bin`.
|
||||
@ -335,7 +339,7 @@ The toolchain path needs to be corrected, for example like shown in the followin
|
||||
|
||||
<img align="center" src="./images/eclipse/eclipse-cross-compile-win.png" width="50%">
|
||||
|
||||
## Setting up the TCF agent on the Raspberry Pi
|
||||
# Setting up the TCF agent on the Raspberry Pi
|
||||
|
||||
It is recommended to set up a [TCF agent](https://wiki.eclipse.org/TCF) for comfortable
|
||||
Eclipse remote debugging. The following steps show how to setup the TCF agent
|
||||
@ -435,3 +439,78 @@ scp <user_name>@<ip-address>:/lib/arm-linux-gnueabihf/libc.so.6 <rootfs_path>/li
|
||||
|
||||
If any custom libraries are used which rely on symlinks, it might be necessary to copy them
|
||||
or create them manually as well.
|
||||
|
||||
# <a id="ctng"></a> Building a cross-compile toolchain with crosstool-ng
|
||||
|
||||
If you want to cross-compile the toolchain for the Raspberry Pi, you can do so
|
||||
with the `crosstool-ng` tool.
|
||||
|
||||
Alternatively, you can also download a cross-compile toolchain built with
|
||||
crosstool-ng for the Raspberry Pi 3 [from here](https://www.dropbox.com/sh/zjaex4wlv5kcm6q/AAABBFfmZSRZ7GE7ok-7vTE6a?dl=0)
|
||||
inside the `x-tools` folder.
|
||||
|
||||
## Ubuntu
|
||||
|
||||
1. Install prerequisites to build toolchains
|
||||
|
||||
```sh
|
||||
sudo apt-get install automake bison chrpath flex g++ git gperf gawk help2man libexpat1-dev
|
||||
libncurses5-dev libsdl1.2-dev libtool libtool-bin libtool-doc python2.7-dev texinfo
|
||||
```
|
||||
|
||||
2. Install `crosstool-ng`. You can checkout a concrete version in the git repository, we will
|
||||
simply build the master branch here:
|
||||
|
||||
```sh
|
||||
git clone https://github.com/crosstool-ng/crosstool-ng.git
|
||||
cd crosstool-ng/
|
||||
```
|
||||
|
||||
3. Install `crosstool-ng`.
|
||||
```sh
|
||||
./bootstrap
|
||||
./configure --enable-local
|
||||
make
|
||||
sudo make install
|
||||
```
|
||||
|
||||
You can also install `ct-ng` locally by supplying `--prefix=<installPath>` to the `configure`
|
||||
command. You don't need `sudo` for the `make install` command if you do this
|
||||
|
||||
4. You can get a list of architectures by running
|
||||
|
||||
```sh
|
||||
./ct-ng list-samples > samples.txt
|
||||
cat samples.txt
|
||||
```
|
||||
|
||||
`ct-ng` includes pre-configurations for the Raspberry Pis. For example you can display the
|
||||
settings for the Raspberry Pi 3 with the command
|
||||
|
||||
```sh
|
||||
./ct-ng show-armv8-rpi3-linux-gnueabihf
|
||||
```
|
||||
|
||||
You can add the configuration with
|
||||
|
||||
```sh
|
||||
./ct-ng armv8-rpi3-linux-gnueabihf
|
||||
```
|
||||
|
||||
You can now customize the build with
|
||||
|
||||
```sh
|
||||
./ct-ng menuconfig
|
||||
```
|
||||
|
||||
It is recommended to go to `Paths and misc options` and disable `Paths and misc options`.
|
||||
Remember to save the configuration.
|
||||
|
||||
5. Finally, after finishing the configuration you can build the toolchain with
|
||||
|
||||
```sh
|
||||
./ct-ng build
|
||||
```
|
||||
|
||||
This takes 20-30 minutes. You can find the toolchain in the `~/x-tools` folder after building
|
||||
has finished
|
||||
|
Loading…
Reference in New Issue
Block a user