Arch及CentOS工具链安装指南

    Linux用户需要明确地允许JTAG编程适配器可以访问USB总线。

    在sudo模式下执行ls命令以确保之后的命令可以成功执行:

    暂时获得sudo权限,执行以下命令:

    1. cat > $HOME/rule.tmp <<_EOF
    2. # All 3D Robotics (includes PX4) devices
    3. SUBSYSTEM=="usb", ATTR{idVendor}=="26AC", GROUP="plugdev"
    4. # FTDI (and Black Magic Probe) Devices
    5. SUBSYSTEM=="usb", ATTR{idVendor}=="0483", GROUP="plugdev"
    6. # Olimex Devices
    7. SUBSYSTEM=="usb", ATTR{idVendor}=="15ba", GROUP="plugdev"
    8. _EOF
    9. sudo mv $HOME/rule.tmp /etc/udev/rules.d/10-px4.rules
    10. sudo /etc/init.d/udev restart

    用户需要被添加到plugdev组:

    1. sudo usermod -a -G plugdev $USER

    构建需要Python 2.7.5支持,因此应该使用CentOS 7(当前最新版本,较早的CentOS版本可能带有python v2.7.5,但是不推荐使用,因为它可能会破坏yum)。

    需要使用EPEL仓库来安装openocd,libftdi-devel和libftdi-python。

    1. sudo yum install epel-release-7-5.noarch.rpm
    2. yum update
    3. yum groupinstall Development Tools
    4. yum install python-setuptools
    5. easy_install pyserial
    6. yum install openocd libftdi-devel libftdi-python python-argparse flex bison-devel ncurses-devel ncurses-libs autoconf texinfo libtool zlib-devel cmake

    注意:你可能还想要安装python-pip和screen。

    其它32位库

    1. arm-none-eabi-gcc --version

    如果返回下列信息

    1. bash: gcc-arm-none-eabi-4_7-2014q2/bin/arm-none-eabi-gcc: /lib/ld-linux.so.2: bad ELF interpreter: No such file or directory

    那么你还需要安装其它的32位库:glibc.i686,ncurses-libs.i686

    1. sudo pacman -S base-devel lib32-glibc git-core python-pyserial zip python-empy

    安装的包管理器yaourt

    然后使用它下载,编译以及安装以下内容:

    1. yaourt -S genromfs

    权限

    用户需要被添加至’uucp’组:

    1. sudo usermod -a -G uucp $USER

    执行上述操作后,需要注销账户然后再次登陆。

    执行下面的脚本来安装GCC 4.9或者5.4版本:

    1. pushd .
    2. cd ~
    3. wget https://launchpad.net/gcc-arm-embedded/4.9/4.9-2015-q3-update/+download/gcc-arm-none-eabi-4_9-2015q3-20150921-linux.tar.bz2
    4. tar -jxf gcc-arm-none-eabi-4_9-2015q3-20150921-linux.tar.bz2
    5. exportline="export PATH=$HOME/gcc-arm-none-eabi-4_9-2015q3/bin:\$PATH"
    6. if grep -Fxq "$exportline" ~/.profile; then echo nothing to do ; else echo $exportline >> ~/.profile; fi
    7. . ~/.profile
    8. popd

    GCC 5.4:

    1. pushd .
    2. wget https://launchpad.net/gcc-arm-embedded/5.0/5-2016-q2-update/+download/gcc-arm-none-eabi-5_4-2016q2-20160622-linux.tar.bz2
    3. tar -jxf gcc-arm-none-eabi-5_4-2016q2-20160622-linux.tar.bz2
    4. if grep -Fxq "$exportline" ~/.profile; then echo nothing to do ; else echo $exportline >> ~/.profile; fi
    5. . ~/.profile
    6. popd

    安装32位支持库(如果已经是运行在32位,那么可能会失败,并且此步骤可以跳过):

    1. sudo apt-get install libc6:i386 libgcc1:i386 libstdc++5:i386 libstdc++6:i386
    2. sudo apt-get install gcc-4.6-base:i386

    Ninja比Make更快,并且PX4的CMake生成器可以支持它。不幸的是,Ubuntu目前只支持一个非常过时的版本。下载二进制文件并添加到系统路径来安装最新版本的:

    1. mkdir -p $HOME/ninja
    2. cd $HOME/ninja
    3. wget https://github.com/martine/ninja/releases/download/v1.6.0/ninja-linux.zip
    4. unzip ninja-linux.zip
    5. rm ninja-linux.zip
    6. exportline="export PATH=$HOME/ninja:\$PATH"
    7. if grep -Fxq "$exportline" ~/.profile; then echo nothing to do ; else echo $exportline >> ~/.profile; fi
    8. . ~/.profile

    输入:

    1. arm-none-eabi-gcc --version

    输出应该类似以下内容:

    1. arm-none-eabi-gcc (GNU Tools for ARM Embedded Processors) 4.7.4 20140401 (release) [ARM/embedded-4_7-branch revision 209195]
    2. Copyright (C) 2012 Free Software Foundation, Inc.
    3. This is free software; see the source for copying conditions. There is NO
    4. warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

    如果输出是:

    1. arm-none-eabi-gcc: No such file or directory

    确认按照安装步骤正确安装32位库。