本搭建过程基于http://dev.px4.io/starting-installing-linux.html,希望大家互相交流学习。

原文:Development Environment on Linux(Linux上开发环境)

We have standardized on Debian / Ubuntu LTS as the supported Linux distribution, but boutique distribution instructions are available for Cent OS and Arch Linux.(我们已在Debian / Ubuntu LTS 发行版上进行了测试,但精简版Cent OS和Arch Linux同样试用相应指令。)

Permission Setup(权限设置)

Warning Never ever fix permission problems by using 'sudo'. It will create more permission problems in the process and require a system reinstallation to fix them.(警告不要依靠使用sudo指令解决权限问题。这样可能在使用过程中产生更多权限问题,并且需要重装系统才能解决)

The user needs to be part of the group "dialout":(使用者需要成为dialout组中一员)

sudo usermod -a -G dialout $USER
sudo是linux系统管理指令,是允许系统管理员让普通用户执行一些或者全部的root命令的一个工具,如halt,reboot,su等等。这样不仅减少了root用户的登录 和管理时间,同样也提高了安全性。sudo不是对shell的一个代替,它是面向每个命令的。
usermod -a -G dialout $USER  该指令中-a指把用户追加到某些组中,仅与-G选项一起使用;-G 指把用户追加到某些组中,仅与-a选项一起使用,后面接 group name 必须是现有 group 组中存在的组名,改变用户能够支持的用户组,修改的是 /etc/group。因为默认情况下,只有root用户和属于dialout组的用户会有读写权限,因此直接把自己的用户加入到dialout组中就可以了。)

And then you have to logout and login again, as this is only changed after a new login.(之后你必须注销和重新登录,因为在重新登录后才会改变)


Installation(安装)


Update the package list and install the following dependencies for all PX4 build targets. PX4 supports four main families:更新包列表和安装以下所有PX4构建目标的依赖关系。PX4支持四个主要的系列:

Info Install the Ninja Build System for faster build times than with Make. It will be automatically selected if installed.(信息:为更快的编译时间安装Ninja编译系统,而不是使用make指令。如果安装他将被自动选取。)

sudo add-apt-repository ppa:george-edison55/cmake-3.x -y
( 我们在使用Ubuntu安装程序时经常会遇到添加软件源的操作,最常见的是ppa软件源。例如:sudo add-apt-repository ppa:rvm/smplayer:这就是添加smplayer的ppa软件源的命令。ppa是什么呢?是Ubuntu Launchpad网站提供的一项服务,允许个人用户作为apt源供其他用户下载和更新。通常比Ubuntu中心提前出来,版本更新,满足大家及时的更新使用。下面讲解如何寻找、添加并安装ppa软件。
首先需要在https://launchpad.net 注册用户,这个账号是使用Ubuntu one的账号。当你注册的时候,网页会提醒你在Ubuntu中添加启动器,这时确定就行。然后依据提示注册就行了。在search文本框中输入你想要的软件,比如我要安装cmake-3.x,输入并按search。我们尽量寻找这样的add this ppa to you system的标题即ppa:george-edison55/cmake-3.x。在上面经过查找后找到了Ubuntu的ppa软件包,那么接下来就是使用命令行进行添加、更新和安装操作了。基本格式是这样的:
sudo add-apt-repository ppa:george-edison55/cmake-3.x(添加)
sudo apt-get update(更新软件源)
sudo apt-get install ppa-name(安装)
)
sudo apt-get update
sudo apt-get install python-argparse git-core wget zip \
    python-empy qtcreator cmake build-essential genromfs -y
# simulation tools
sudo apt-get install ant protobuf-compiler libeigen3-dev libopencv-dev openjdk-8-jdk openjdk-8-jre clang-3.5 lldb-3.5 -y
(
其中openjdk-8-jdk openjdk-8-jre lldb-3.5找不到,前两个8改为7,最后一个删掉不安装(Ubuntu14.04有问题,但16.04中顺利编译通过)
)

NuttX based hardware(基于NuttX的硬件

Ubuntu comes with a serial modem manager which interferes heavily with any robotics related use of a serial port (or USB serial). It can deinstalled without side effects:(Ubuntu的串行调制解调管理器接口影响机器人使用串行口,如USB。可以卸载以避免副作用。)

sudo apt-get remove modemmanager

Update the package list and install the following dependencies. Packages with specified versions should be installed with this particular package version.

(更新安装列表,并安装以下依赖关系。安装包要注意版本号。)

sudo add-apt-repository ppa:terry.guo/gcc-arm-embedded -y
sudo apt-get update
(这里说找不到钥匙,运行如下代码,key根据实际修改:apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 68980A0EA10B4DE8)
sudo apt-get install python-serial openocd \
    flex bison libncurses5-dev autoconf texinfo build-essential \
    libftdi-dev libtool zlib1g-dev \
    python-empy gcc-arm-none-eabi -y

If the resulting gcc-arm-none-eabi version produces build errors for PX4/Firmware master, please refer tothe bare metal installation instructions to install version 4.8 manually.(如果交叉编译环境安装有问题,可移步至手动安装)

到此开发环境搭建就完成了,下面就可进行开发了,下面的其他固件环境搭建这里就不说了。

Snapdragon Flight()

Toolchain installation
sudo apt-get install android-tools-adb android-tools-fastboot fakechroot fakeroot unzip xz-utils wget python python-empy -y
git clone https://github.com/ATLFlight/cross_toolchain.git

Get the Hexagon SDK 3.0 from QDN: https://developer.qualcomm.com/download/hexagon/hexagon-sdk-v3-linux.bin

This will require a QDN login. You will have to register if you do not already have an account.

Now move the following files in the download folder of the cross toolchain as follows:

mv ~/Downloads/hexagon-sdk-v3-linux.bin cross_toolchain/downloads

Install the toolchain and SDK like this:

cd cross_toolchain
./installv3.sh
cd ..

Follow the instructions to set up the development environment. If you accept all the install defaults you can at any time re-run the following to get the env setup. It will only install missing components.

After this the tools and SDK will have been installed to "$HOME/Qualcomm/...". Append the following to your ~/.bashrc:

export HEXAGON_SDK_ROOT="${HOME}/Qualcomm/Hexagon_SDK/3.0"
export HEXAGON_TOOLS_ROOT="${HOME}/Qualcomm/HEXAGON_Tools/7.2.12/Tools"
export PATH="${HEXAGON_SDK_ROOT}/gcc-linaro-4.9-2014.11-x86_64_arm-linux-gnueabihf_linux/bin:$PATH"

Load the new configuration:

source ~/.bashrc
Sysroot Installation

A sysroot is required to provide the libraries and header files needed to cross compile applications for the Snapdragon Flight applications processor.

Currently, the trusty sysroot is used because the provided one by Intrinsyc has miraculously been removed from their download website.

cd cross_toolchain
./trusty_sysroot.sh

Append the following to your ~/.bashrc:

export HEXAGON_ARM_SYSROOT=${HOME}/Qualcomm/ubuntu_14.04_armv7_sysroot

Load the new configuration:

source ~/.bashrc

For more sysroot options see Sysroot Installation

Update ADSP firmware

Before building, flashing and running code, you'll need to update the ADSP firmware.

References

There is a an external set of documentation for Snapdragon Flight toolchain and SW setup and verification:ATLFlightDocs

Messages from the DSP can be viewed using mini-dm.

$HOME/Qualcomm/Hexagon_SDK/3.0/tools/debug/mini-dm/Linux_Debug/mini-dm

Raspberry Pi hardware

Developers working on Raspberry Pi hardware should download the RPi Linux toolchain from below. The installation script will automatically install the cross-compiler toolchain. If you are looking for the nativeRaspberry Pi toolchain to compile directly on the Pi, see here

git clone https://github.com/pixhawk/rpi_toolchain.git
cd rpi_toolchain
./install_cross.sh

You will be required to enter your password for toolchain installation to complete successfully.

You can pass a different path to the installer script if you wouldn't like to install the toolchain to the default location of /opt/rpi_toolchain. Run ./install_cross.sh <PATH>. The installer will automatically configure required environment variables as well.

Parrot Bebop

Developers working with the Parrot Bebop should install the RPi Linux Toolchain. Follow the description under Raspberry Pi hardware.

Next, install ADB.

sh sudo apt-get install android-tools-adb -y` 

Finishing Up

Now continue to run the first build!

Logo

更多推荐