准备编译环境

brew tap PX4/homebrew-px4
brew update
brew install genromfs
brew install kconfig-frontends
brew install gcc-arm-none-eabi

 安装 pyserial

sudo easy_install pip
sudo pip install pyserial

测试编译器版本

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

 

下载固件源文件和  NuttX OS

mkdir ~/src
cd ~/src/
git clone https://github.com/PX4/Firmware
cd Firmware
git clone https://github.com/PX4/NuttX

刷写固件

准备刷写固件之前,需确认是否已经烧写过 Bootloader,还有是否已经安装 FTDI Virutal COM Ports 驱动

cd /path/to/Firmware
make archives
make 
make upload px4fmu-v1_default

固件编译后,如需重复上传程序,只需执行:

make upload px4fmu-v1_default

当命令行(Terminal)出现 Loaded firmware for 5,0, waiting for the bootloader…,重新插拔 USB 线即可,重新识别设备后,会自动擦除原有固件。

如果更改过固件源文件,需要执行:

make clean

后,再重复执行刷写固件的步骤。