2024-07-12
한어Русский языкEnglishFrançaisIndonesianSanskrit日本語DeutschPortuguêsΕλληνικάespañolItalianoSuomalainenLatina
To compile the PX4 firmware yourself, you need a cross-compiler. The cross-compiler can x86 architecture The program is written and compiled on the platform, and the compiled executable file can be usedarm architecture on the platform.
This compilation is based on
px4 v1.13.2
For example.
My configuration is as follows:
Virtual machine Ubuntu 18.04 (running memory 4G, hard disk memory 80G), cross compiler arm-none-eabi-gcc
sudo apt-get install git # 安装git
git clone https://github.com/PX4/PX4-Autopilot.git
mv PX4-Autopilot PX4_Firmware # 更改目录名
cd PX4_Firmware
git checkout -b dev v1.13.2 # 切换版本
git submodule update --init --recursive # 更新下载子模块
If the download is slow, you can download it from the network disk or from the QQ group (961297255)
Link: https://pan.baidu.com/s/1eNB9dWlKoVmRMAYsSPI0vw
Extraction code: s8uh
sudo apt-get install libjpeg8-dev
cd ~/PX4_Firmware/Tools/setup
./ubuntu.sh --no-sim-tools # 大概要几分钟,跟个人网络情况而定
# 这是官方提供的脚本 有两个可选参数
# --no-sim-tools 不安装仿真环境
# --no-nuttx 不安装交叉编译环境
The reason for the error in the above picture is that the shell script does not have executable permissions (this error may occur if you use the file I provided). Run the following command to grant executable permissions and then execute:
chmod +x ubuntu.sh
./ubuntu.sh --no-sim-tools
The script execution result is shown in the figure below:
arm-none-eabi-gcc --version
Note: The suffix _default is optional. For example, using px4_fmu-v5 is the same as px4_fmu-v5_default.
The following figure shows the firmware versions supported by the flight control board:
Use the following command to view the firmware that supports compilation:
cd ~/PX4_Firmware/
make list_config_targets
Here we take Pixhwak4 as an example
make px4_fmu-v5_default
The results are shown in the figure below.The red frame part is the folder where the compiled firmware is located
For burning, you can use QGC, or use the following command
make px4_fmu-v4_default upload
Development Environment for Ubuntu LTS/Debian Linux | PX4 Guide (main)
Compiling PX4 Software | PX4 Guide (main)
If you have any other questions or find errors in the article, please leave a message in the comment section
Keep learning!