Quick Start
This chapter walks through the full pipeline "host toolchain → SDK → cross compilation → deploy to the board → SSH/SCP verification" to get the first sample program running.
Overall block diagram
PC (Ubuntu x86_64) Host board (aarch64)
───────────────────── ─────────────
apt install toolchain /tmp/hello_rk182x
│ │
▼ ▼
aarch64-linux-gnu-gcc ─────scp/ssh────────────► ./hello_rk182x → Hello RK182X!The sample programs in this chapter run on the AArch64 Linux of host boards such as RK3588 and RK3576. The RK182X is a co-processor and does not directly run ordinary Linux user-space programs; if you use RTOS or dedicated firmware, use the dedicated firmware toolchain provided by the SDK.
1. Prerequisites
| Requirement | Minimum | Recommended |
|---|---|---|
| Host OS | Ubuntu 20.04 or compatible Linux | Ubuntu 22.04 LTS |
| Disk space | 30 GB | 50 GB SSD |
| Memory | 8 GB | 16 GB |
| Network | Can fetch the SDK and dependencies | Stable network |
| Development board | AArch64 Linux host board | RK3588/RK3576 + RK182X |
| Connection | SSH, serial, or ADB | SSH over network |
Confirm the target board architecture:
uname -mOutput:
aarch642. Install Basic Dependencies
On Debian/Ubuntu systems:
sudo apt update
sudo apt install -y \
build-essential \
gcc-aarch64-linux-gnu \
g++-aarch64-linux-gnu \
binutils-aarch64-linux-gnu \
git wget curl file openssh-clientVerify the toolchain:
aarch64-linux-gnu-gcc --version
aarch64-linux-gnu-g++ --version
file --versionOutput:
$ aarch64-linux-gnu-gcc --version
aarch64-linux-gnu-gcc (Debian 12.2.0-14+deb12u1) 12.2.0
$ aarch64-linux-gnu-g++ --version
aarch64-linux-gnu-g++ (Debian 12.2.0-14+deb12u1) 12.2.0
$ file --version
file-5.44
magic file from /etc/magic:/usr/share/misc/magicYou can also install QEMU if you have no development board:
sudo apt install -y qemu-user-static libc6-arm64-crossFor RKNN model conversion, use a venv:
sudo apt install -y python3 python3-pip python3-venv
python3 -m venv "$HOME/venvs/rk182x"
source "$HOME/venvs/rk182x/bin/activate"
python -m pip install --upgrade pip
python -m pip install numpy pillow onnxFor the exact RKNN Toolkit packages and Python version requirements, refer to the release notes of the corresponding SDK.
3. Get the SDK
How you obtain the SDK depends on project permissions and how Rockchip publishes it — a Git repository, a repo project, or an archive.
# Path variable (common value: $HOME/rk182x-sdk)
export RK182X_SDK="$HOME/rk182x-sdk"
# Fetch from the authorized repository (replace the address and version with actual values)
git clone --branch "<SDK_TAG>" \
"<AUTHORIZED_SDK_REPOSITORY_URL>" \
"$RK182X_SDK"
cd "$RK182X_SDK"If the SDK already exists, just set the path:
export RK182X_SDK="/userdata/RK1820_RK1828_AI_SDK"
cd "$RK182X_SDK"Check the directories:
find "$RK182X_SDK" -maxdepth 2 -type d | sortOutput (partial):
/userdata/RK1820_RK1828_AI_SDK
/userdata/RK1820_RK1828_AI_SDK/docs
/userdata/RK1820_RK1828_AI_SDK/driver
/userdata/RK1820_RK1828_AI_SDK/driver/pcie-rkep
/userdata/RK1820_RK1828_AI_SDK/examples
/userdata/RK1820_RK1828_AI_SDK/examples/anomaly-detection
/userdata/RK1820_RK1828_AI_SDK/examples/docker
/userdata/RK1820_RK1828_AI_SDK/examples/gstreamer
/userdata/RK1820_RK1828_AI_SDK/examples/rockit_yolo_detect
/userdata/RK1820_RK1828_AI_SDK/examples/vi_yolo_venc
/userdata/RK1820_RK1828_AI_SDK/examples/web
/userdata/RK1820_RK1828_AI_SDK/output
/userdata/RK1820_RK1828_AI_SDK/package
/userdata/RK1820_RK1828_AI_SDK/pkgroot
/userdata/RK1820_RK1828_AI_SDK/rknn
/userdata/RK1820_RK1828_AI_SDK/rknn/rknn3-model-zoo
/userdata/RK1820_RK1828_AI_SDK/rknn/rknn3-runtime
/userdata/RK1820_RK1828_AI_SDK/rknn/rknn3-toolkit
/userdata/RK1820_RK1828_AI_SDK/rknn/rknn-gstreamer-plugins
/userdata/RK1820_RK1828_AI_SDK/scriptsDirectory structures may differ between SDK versions; common directories:
rk182x-sdk/
├── docs/ # SDK documents
├── examples/ # Sample programs
├── driver/ # Driver source
├── rknn/ # RKNN Toolkit, Runtime, or Model Zoo
├── scripts/ # Build and deploy scripts
├── output/ # Build output
└── pkgroot/ # Target-board runtime libraries or tools4. Configure the Cross-Compile Environment
export ARCH=arm64
export CROSS_COMPILE=aarch64-linux-gnu-Verify:
printf 'ARCH=%s\n' "$ARCH"
printf 'CROSS_COMPILE=%s\n' "$CROSS_COMPILE"
"${CROSS_COMPILE}gcc" --versionOutput:
ARCH=arm64
CROSS_COMPILE=aarch64-linux-gnu-
aarch64-linux-gnu-gcc (Debian 12.2.0-14+deb12u1) 12.2.0Make it permanent:
echo 'export RK182X_SDK="/userdata/RK1820_RK1828_AI_SDK"' >> "$HOME/.bashrc"
echo 'export CROSS_COMPILE=aarch64-linux-gnu-' >> "$HOME/.bashrc"
echo 'export ARCH=arm64' >> "$HOME/.bashrc"
source "$HOME/.bashrc"5. Build and Run the First Program
Create hello_rk182x.c:
#include <stdio.h>
#include <unistd.h>
int main(void)
{
printf("Hello RK182X!\n");
printf("PID: %d\n", getpid());
return 0;
}5.1 Cross-Compile on the Host
aarch64-linux-gnu-gcc \
-Wall \
-Wextra \
-O2 \
hello_rk182x.c \
-o hello_rk182xInspect the binary:
file hello_rk182xOutput:
hello_rk182x: ELF 64-bit LSB pie executable, ARM aarch64, version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux-aarch64.so.1, BuildID[sha1]=48533707313881615a22527bb4743e308ce86943, for GNU/Linux 3.7.0, not strippedNewer Ubuntu GCC builds PIE by default;
pie executablein the output is normal.
Confirm the architecture further:
readelf -h hello_rk182x | head -20Output (key line):
系统架构: AArch645.2 Run on the Development Board
Set the board information:
export TARGET_USER=linaro
export TARGET_IP=<board-ip>
export TARGET="$TARGET_USER@$TARGET_IP"Confirm the board architecture:
ssh "$TARGET" 'uname -m'Output:
aarch64Copy and run:
scp hello_rk182x "$TARGET:/tmp/"
ssh "$TARGET" \
'chmod +x /tmp/hello_rk182x && /tmp/hello_rk182x'Output:
Hello RK182X!
PID: 240275.3 Compile Directly on the Board
The board already has a native GCC:
gcc hello_rk182x.c -o hello_rk182x
./hello_rk182x6. Troubleshooting
| Symptom | Cause | Fix |
|---|---|---|
Exec format error | AArch64 program run on x86_64 | Run under QEMU: qemu-aarch64-static -L /usr/aarch64-linux-gnu ./hello_rk182x, or push it to an aarch64 board |
/lib/ld-linux-aarch64.so.1 not found | Target-board runtime libraries missing for dynamic linking / wrong QEMU sysroot | ls -l /lib/ld-linux-aarch64.so.1 + check the -L path |
| Cross compiler command not found | Toolchain not installed / wrong prefix | apt install gcc-aarch64-linux-gnu + command -v aarch64-linux-gnu-gcc |
| Cannot SSH to the board | Wrong IP / username / network | ping <IP> + ssh <user>@<IP> to check |
7. Next Steps
- Hardware Installation & Verification — card installation + health check
- Environment Setup — 30-second overview
- Vendor SDK Data Extraction — key parameters / host reference values quick reference
