ardupilot在Ubuntu12.04.5-32bit-x86环境下的编译,简易版编译环境搭建,实际使用

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/bolvtin/article/details/51719428

1. 前提条件
已经下载了ardupilot的压缩包,注意一定是压缩包,因为如果采取解压缩tar命令可以解决涉及到的文件权限的问题。
2安装
2.1 Permissions
You need to make your user a member of the dialout group:
sudo usermod -a -G dialout $USER
2.2 Reload the path (log-out and log-in to make permanent):
. ~/.profile
2.3. 解压缩ardupilot
tar –xvf ardupilot.zip
这里一定需要确保用户对ardupilot拥有读写执行(如果是文件夹就是“进入”)的权利
2.4 执行脚本Run the install-prereqs-ubuntu.sh script:
ardupilot/Tools/scripts/install-prereqs-ubuntu.sh –y
脚本运行失败,请看步骤7
3. 编译Compiler
因为2.4 ardupilot/Tools/scripts/install-prereqs-ubuntu.sh –y这个步骤已经下载了gcc-arm-none-eabi,并且解压缩到了/opt/ gcc-arm-none-eabi/目录下了,所以只需要配置环境变量
1配置环境变量
export PATH=$PATH:/opt/gcc-arm-none-eabi-4_6-2012q2/bin
2下面的编译可以不需要,因为只是加快编译速度
1)安装ccache
sudo apt-get install ccache
2)建立链接
cd /usr/lib/ccache
sudo ln -s /usr/bin/ccache arm-none-eabi-g++
sudo ln -s /usr/bin/ccache arm-none-eabi-gcc
3)配置环境变量
export PATH=$PATH: /usr/lib/ccache
4. 构建Build
Build for Copter:
cd ardupilot/ArduCopter
make px4-v2
make px4-v2
5. 上传固件Loading firmware
make px4-v2-upload
After it says “waiting for bootloader” plugin your PX4 on USB.
6. 清除Cleaning
If there have been updates to the PX4NuttX or PX4Firmware git submodules you may need to do a full clean build. To do that use:
make px4-clean
that will remove the PX4NuttX archives so you can do a build from scratch


7. 问题
在第2.4步骤ardupilot/Tools/scripts/install-prereqs-ubuntu.sh –y会出现几个问题
1出现libc6-i386问题
因为安装的Ubuntu本身就是x86架构的32bit系统,所以,不需要安装或者将PX4_PKGS 的最后的libc6-i386改为libc6即可
PX4_PKGS="python-serial python-argparse openocd flex bison libncurses5-dev \
          autoconf texinfo build-essential libftdi-dev libtool zlib1g-dev \
          zip genromfs python-empy libc6"
2出现pip2:command not found 问题
这个把ardupilot/Tools/scripts/install-prereqs-ubuntu.sh脚本文件中的pip2改为pip即可

3出现gcc-arm-none-eabi command not found问题
因为ardupilot/Tools/scripts/install-prereqs-ubuntu.sh –y安装在了/opt/目录下,查看后发现权限都是root的,这个时候去更改一下权限
cd /opt
chmod –r a+x arm-none-eabi

4诸如编译所需软件
软件gcc-arm-none-eabi git gawk python python-dev等都已经在ardupilot/Tools/scripts/install-prereqs-ubuntu.sh –y安装了,不需要自己安装


猜你喜欢

转载自blog.csdn.net/bolvtin/article/details/51719428