PX4 support for Gemstone is still in the development phase. It runs on the
main-domain R5F core, and some peripherals on the board, such as CAN Bus, are
not yet available.
PX4 is an open-source autopilot platform for drones and other unmanned vehicles.
It provides a complete flight-control stack, from low-level sensor drivers up to
vehicle control and mission execution. On the Gemstone board, PX4 runs on the
R5F cores on top of NuttX, using the same custom t3-gem-o1 configuration
created for the bare NuttX build.
Unlike a standalone NuttX build, PX4 vendors both NuttX and its application
framework as git submodules. A recursive clone therefore pulls the correct,
Gemstone-tuned NuttX automatically, so there is no need to download or build
NuttX separately.
1. Compilation
PX4 is compiled with the gcc-arm-none-eabi cross‑compiler for the ARM
Cortex‑R5F cores, and its build system additionally relies on a set of Python
tools such as kconfiglib, empy and jinja2.
On Ubuntu/Debian systems, install the toolchain and the general prerequisites
with the package manager:
Because recent Debian/Ubuntu releases restrict system‑wide pip installations,
install the Python tools into a virtual environment:
The requirements.txt file lives inside the PX4 source tree, so run the
pip install step after downloading the sources (section 1.2). Activate the
environment with source ~/px4-venv/bin/activate in every new shell before
building.
1.2. Downloading Source Codes
PX4 references the Gemstone NuttX and NuttX‑apps as git submodules, so the
sources are downloaded with a single recursive clone:
The --recursive flag checks out the correct NuttX (the Gemstone px4 branch)
and NuttX‑apps into the platforms/nuttx/NuttX directory, so a separate NuttX
download is not required. If you cloned without --recursive, fetch the
submodules afterwards with git submodule update --init --recursive.
1.3. Compiling the Project
PX4 builds a specific board target directly, so no separate configuration step
is required. With the Python environment from section 1.1 active, compile the
Gemstone board image:
This performs a parallel build and produces
build/t3gemstone_o1_default/t3gemstone_o1_default.elf (the image loaded onto
the R5F core) along with .bin and .px4 files.
2. Running
Like the bare NuttX image, PX4 runs on the main-domain R5F core and is loaded
from Linux or U-Boot using the remoteproc mechanism. While PX4 runs on the R5F
core, Linux continues to run on the A53 cores.
Program files to be loaded onto the cores via remoteproc must be copied to the
/lib/firmware directory with predefined names. At system startup, the
remoteproc mechanism will automatically load the programs onto the relevant
cores. Follow the steps below to run PX4 using remoteproc.
- Copy the
build/t3gemstone_o1_default/t3gemstone_o1_default.elf file
resulting from the compilation to the /lib/firmware directory with the
name j722s-main-r5f0_0-fw.
- Reboot the board.
- You can access NuttShell by connecting a USB-to-TTL device to the
UART-MAIN1’s GPIO-14 (TX) and GPIO-15 (RX) pins on the 40-pin HAT.
- From the opened
nsh console you can inspect the running system with
commands such as ver all, top, and uorb status.
3. Using the Sensors
The on‑board InvenSense ICM‑20948, a 9‑axis IMU with an accelerometer,
gyroscope and an integrated AK09916 magnetometer, is connected to the R5F over
SPI. Start its driver from the nsh console:
Here -s selects the SPI interface, -b 1 the SPI bus, -c 3 the
chip‑select, and -M additionally enables the magnetometer. Once the driver is
running, you can stream the live sensor data through PX4’s uORB middleware with
the listener command:
To observe the overall system, uorb top lists the publication rates of all
active topics and work_queue status shows the timing of the driver’s work
queue.