Application development¶
Copyright © Quectel Wireless Solutions Co., Ltd. 2026. All rights reserved.
This document describes how to develop applications on Debian for the Quectel Pi H1 single-board computer (encompassing writing, compiling, and running software on the board). The board supports two development workflows:
Native development: Write, compile, and run code directly on the board, which is ideal for rapid development and iterative debugging.
Cross-compilation: Compile source code on a host PC to generate executable binaries for the board, suited for large-scale builds, complex system-level software, or workflows requiring maximum build speed.
Using a classic HelloWorld program as an example, this document details the complete end-to-end workflow for both methods to help developers get started quickly with application development on the board.
HelloWorld example¶
HelloWorld is a simple C program mainly used to verify that the development environment has been set up correctly. By writing, compiling, and running this basic program, you can check that the system's components, such as the compiler and the runtime environment, work properly. It is a fundamental exercise for getting started with embedded development.
Native development¶
Native development means developing, compiling, and running applications directly on the board. This approach is simple and suitable for quick verification and debugging.
Set up the development environment¶
After logging in to the Debian system of the board, open a terminal window, type the following command, and press Enter to install the required development environment:
sudo apt update && sudo apt install vim gawk gcc g++ build-essential chrpath socat wget diffstat file unzip tar locales zstd debianutils iputils-ping cpio python3 python3-pip net-tools git make cmake
Write the code¶
Create a helloworld.c file in the ~/Desktop directory.
Copy the following code and paste it into the helloworld.c file:
#include <stdio.h>
int main(void)
{
printf("Hello World!\n");
return 0;
}
Compile and run¶
Run the following commands to compile the code:
cd Desktop/
gcc helloworld.c -o helloworld
Run the following command to execute the helloworld program:
./helloworld
The program output is as follows:
./helloworld
Hello World!
Cross-compilation¶
Cross-compilation refers to generating executable binaries on one architecture (such as x86_64) that run on a target platform with a different architecture (such as an AArch64/ ARM64 device). Compiling on a higher-performance host PC reduces build times and improves development efficiency.
Prerequisites¶
A 64-bit (x86_64) development host (physical machine or virtual machine) running Ubuntu (20.04/22.04 LTS recommended) or Debian to compile the code.
A board to run the compiled executable binaries.
Using an x86_64 development host as an example, execute the following steps on the host machine:
Install the ARM64 toolchain¶
sudo apt update
sudo apt install gcc-aarch64-linux-gnu g++-aarch64-linux-gnu
Verify the installation¶
aarch64-linux-gnu-gcc --version
The expected output displays the aarch64-linux-gnu-gcc version information (for example, 11.4.0).
Create the code file¶
vim helloworld.c
Press i to enter insert mode, type the following code, then press Esc, type :wq, and press Enter to save and exit.
#include <stdio.h>
int main(void)
{
printf("Hello World!\n");
return 0;
}
Compile the code file¶
aarch64-linux-gnu-gcc -o <output_filename> <source_filename>
Example: aarch64-linux-gnu-gcc -o hello_arm64 helloworld.c
Check the file architecture¶
file <filename>
Run the file command to verify the binary's target architecture. The expected output should confirm that the file is an ARM aarch64 ELF executable.
Upload the compiled file¶
Download the compiled file from the host to your local computer, then upload it to the board with the scp command in the Windows command line.
# Note: the path of the compiled file on the host must not contain Chinese characters
scp -O </local/file> username@<remote_IP>:</target_path/>
Example: scp -O D:\hello_arm64 pi@192.168.x.x:/home/pi
The transfer progress is displayed during the upload. Once the transfer is complete, you can run the binary on the board.
Run the compiled file¶
In the board's terminal, grant execute permissions to the compiled binary and run it. The expected output will be "Hello World!".
sudo chmod 777 <filename>
./<filename>