环境:
安装 git:
sudo apt-get -qq -y install git
安装 arm-none-eabi-gcc编译器:
apt-get install gcc-arm-none-eabi
安装gawk,cmake:
apt-get install gawk cmake
克隆源码到本地(3.8.0分支):
git clone -b plane3.8 https://github.com/ArduPilot/ardupilot.git
运行ubuntu安装脚本:
ardupilot/Tools/scripts/install-prereqs-ubuntu.sh -y
使环境变量生效:
. ~/.profile
进入想要编译的机型目录:
cd ardupilot/ArduPlane/
编译:
make px4-v2
上传固件到board:
make px4-v2-upload
但目前为止,上传成功后,板子无法与地面站建立链接。可能原因有:此板子之前刷的固件为Firmware版本,再刷Ardupilot的版本的时候有一些微妙的事情发生了。
踩的坑
下载源码时,直接用的git clone https://github.com/diydrones/ardupilot.git命令。
但编译过程中发现 在Ardupilot/ArduPlane/modules/的子目录例如uavcan下全是空文件。
后尝试git clone https://github.com/ArduPilot/uavcan.git,但又发现modules/gbenchmark内同样是空文件,甚至全部子文件夹内全是空的,
又尝试git gbenchmark,发现GIT库内只有git clone https://github.com/google/benchmark.git就此只能作罢
重头使用git clone -b plane3.8 https://github.com/ArduPilot/ardupilot.git