Skip to main content
Set up and control the process of building, configuring, and packaging MCU images so they run correctly on the target platform. Understand how configuration choices, toolchain alignment, and image preparation affect boot success, debug visibility, and interface validation. This helps you produce consistent, reproducible builds, validate a working baseline quickly, and ensure the image integrates cleanly with platform requirements before expanding to additional features.

8.1 Build MCU firmware

8.1.1 Environment setup

OS Version: Ubuntu 22.04 These steps are verified with Ubuntu 22.04. Other Ubuntu releases may also work but have not been verified. These steps have not been verified on Windows.

Required host packages

Compiling on Windows is currently not supported.
Python version: 3.12.10 Install the following Python packages:
Note: There have been reports of inconsistent behavior when different binary versions of Python are installed in the same bin/ directory. A workaround is to add a symbolic link of the required Python version into a scratch directory and update the PATH environment variable to use it.

Zephyr OS setup

  1. Create a folder at your preferred location for downloading and installing all Zephyr dependencies.
  1. For maintaining a consistent build environment, it is recommended to use a Python virtual environment.
  1. From the virtual environment, install and initialize Zephyr:
  1. Verify the Zephyr versions.
  • Zephyr version: 3.7 LTS
  • Zephyr SDK version: 0.16.x
  1. Check the Zephyr compatibility matrix:
https://github.com/zephyrproject-rtos/sdk-ng/wiki/Zephyr-SDK-Version-Compatibility-Matrix
  1. Create the SDK directory:
  1. Download and set up the required Zephyr SDK version (0.16.x).

Zephyr troubleshooting resources

Install dependencies https://docs.zephyrproject.org/latest/develop/getting_started/index.html#select-and-update-os Zephyr SDK and Python dependencies https://docs.zephyrproject.org/latest/develop/getting_started/index.html#get-zephyr-and-install-python-dependencies Install the Zephyr SDK https://docs.zephyrproject.org/latest/develop/getting_started/index.html#install-the-zephyr-sdk Troubleshooting https://docs.zephyrproject.org/latest/develop/getting_started/index.html#troubleshooting-installation

8.1.2 LLVM setup

  1. Download and install RISC-V Snapdragon LLVM from QPM3. Current supported version:
    • Snapdragon LLVM (RISC-V): 21.1.1
  2. To install QPM3 and LLVM, download the package on a Windows host from: https://www.qpm.qualcomm.com Then copy the package to the Ubuntu host.
  3. Skip this step if QPM3 and the RISC-V toolchain are already installed.
  1. Install QIKService3 from:
  1. From the QPM3 UI, install the Snapdragon LLVM RISCV Toolchain OEM toolchain. Current version: 21.1.1

8.1.3 Device tree compiler installation

  1. Install the Device Tree Compiler (DTC).
Download source from: https://git.kernel.org/pub/scm/utils/dtc/dtc.git Example steps:

8.1.4 Compile subsystem

Environment variables

Run compilation

Navigate to:
Use the commands from the following table.

8.2 Configuration, image generation, and boot flow

  1. Track logging and console choices explicitly so the first-success path has clear output.
  2. Enable only the buses you need initially, such as serial or I2C.
  3. Turn on DMA or GPI only after the simpler path is stable.
  4. Generate the ELF file, memory map, and packaged MCU image.
  5. Load the image using the platform-approved programming flow and validate