Build Environment Setup
This tutorial guides you through setting up a development environment for building NanoVNA-H firmware from source.
What You Will Learn
Section titled “What You Will Learn”- Installing the ARM cross-compiler toolchain
- Extracting and preparing ChibiOS
- Verifying your build environment
- Platform-specific setup (Linux, macOS, Windows)
Prerequisites
Section titled “Prerequisites”Before starting, ensure you have:
- Git installed
- Basic command-line familiarity
- About 500 MB disk space
Getting the Source Code
Section titled “Getting the Source Code”-
Clone the repository
Terminal window git clone https://github.com/hugen79/NanoVNA-H.gitcd NanoVNA-H -
Extract ChibiOS
ChibiOS (the real-time operating system) is stored as a compressed archive, not a git submodule.
Terminal window 7z x ChibiOS.7zIf you do not have
7z, install it:- Linux (Debian/Ubuntu):
sudo apt install p7zip-full - Linux (Arch):
sudo pacman -S p7zip - macOS:
brew install p7zip - Windows: Download from 7-zip.org
- Linux (Debian/Ubuntu):
-
Verify the ChibiOS directory exists
Terminal window ls ChibiOS/You should see directories like
os/,test/,demos/, etc.
Installing the ARM Toolchain
Section titled “Installing the ARM Toolchain”Option 1: From ARM website (recommended for version control)
-
Download ARM toolchain version 8
Visit the ARM Developer website and download:
gcc-arm-none-eabi-8-2019-q3-update-linux.tar.bz2 -
Extract to /opt
Terminal window sudo tar xjf gcc-arm-none-eabi-8-2019-q3-update-linux.tar.bz2 -C /opt -
Add to PATH
Add this line to your
~/.bashrcor~/.zshrc:Terminal window export PATH="/opt/gcc-arm-none-eabi-8-2019-q3-update/bin:$PATH" -
Reload shell configuration
Terminal window source ~/.bashrc
Option 2: From package manager (check version)
sudo apt install gcc-arm-none-eabi-
Install from AUR or manually
The Arch repositories may have a newer version. For version 8, download manually:
Terminal window # Download from ARM websitewget https://developer.arm.com/-/media/Files/downloads/gnu-rm/8-2019q3/RC1.1/gcc-arm-none-eabi-8-2019-q3-update-linux.tar.bz2# Extractsudo tar xjf gcc-arm-none-eabi-8-2019-q3-update-linux.tar.bz2 -C /opt -
Add to PATH
Add to your shell configuration:
Terminal window export PATH="/opt/gcc-arm-none-eabi-8-2019-q3-update/bin:$PATH" -
Install make if needed
Terminal window sudo pacman -S make
-
Install Homebrew (if not already installed)
Terminal window /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" -
Download ARM toolchain version 8
Visit the ARM Developer website and download:
gcc-arm-none-eabi-8-2019-q3-update-mac.tar.bz2 -
Extract and install
Terminal window sudo tar xjf gcc-arm-none-eabi-8-2019-q3-update-mac.tar.bz2 -C /usr/local -
Add to PATH
Add to your
~/.zshrc:Terminal window export PATH="/usr/local/gcc-arm-none-eabi-8-2019-q3-update/bin:$PATH" -
Install make and other dependencies
Terminal window brew install make
Option 1: Native Windows
-
Download ARM toolchain
Visit the ARM Developer website and download:
gcc-arm-none-eabi-8-2019-q3-update-win32.exe -
Run the installer
- Select “Add path to environment variable” during installation
- Install to a path without spaces (e.g.,
C:\gcc-arm)
-
Install Make
Download GNU Make for Windows from ezwinports or use Chocolatey:
Terminal window choco install make -
Verify from Command Prompt
Terminal window arm-none-eabi-gcc --versionmake --version
Option 2: WSL (Windows Subsystem for Linux)
This is often easier than native Windows setup. Install WSL and follow the Linux instructions.
wsl --install -d UbuntuUsing Docker eliminates toolchain version issues.
-
Create a Dockerfile
Create a file named
Dockerfilein the NanoVNA-H directory:FROM ubuntu:20.04RUN apt-get update && apt-get install -y \wget \make \p7zip-full \&& rm -rf /var/lib/apt/lists/*# Install ARM toolchain version 8RUN wget -q https://developer.arm.com/-/media/Files/downloads/gnu-rm/8-2019q3/RC1.1/gcc-arm-none-eabi-8-2019-q3-update-linux.tar.bz2 \&& tar xjf gcc-arm-none-eabi-8-2019-q3-update-linux.tar.bz2 -C /opt \&& rm gcc-arm-none-eabi-8-2019-q3-update-linux.tar.bz2ENV PATH="/opt/gcc-arm-none-eabi-8-2019-q3-update/bin:${PATH}"WORKDIR /firmware -
Build the Docker image
Terminal window docker build -t nanovna-build . -
Run builds inside the container
Terminal window docker run --rm -v $(pwd):/firmware nanovna-build make
Verifying the Installation
Section titled “Verifying the Installation”-
Check compiler version
Terminal window arm-none-eabi-gcc --versionExpected output (must be version 8):
arm-none-eabi-gcc (GNU Tools for Arm Embedded Processors 8-2019-q3-update) 8.3.1 20190703 (release) -
Check make is available
Terminal window make --version -
Test compilation
Terminal window cd /path/to/NanoVNA-Hmake cleanmakeA successful build produces:
build/H.elf- ELF executablebuild/H.bin- Binary for flashing
Project Directory Structure
Section titled “Project Directory Structure”After setup, your directory should look like:
NanoVNA-H/├── ChibiOS/ # Extracted RTOS (from .7z)├── NANOVNA_STM32_F072/ # NanoVNA-H board files├── NANOVNA_STM32_F303/ # NanoVNA-H4 board files (note: NANANOVA typo is intentional)├── FatFs/ # FAT filesystem for SD card├── fonts/ # Display fonts├── vna_modules/ # Measurement modules├── main.c # Main application├── ui.c # User interface├── plot.c # Display plotting├── nanovna.h # Central header├── Makefile # Build configuration├── ChibiOS.7z # ChibiOS archive└── build/ # Build output (created by make)Build Targets
Section titled “Build Targets”The Makefile supports two hardware targets:
| Target | Command | Output | Hardware |
|---|---|---|---|
| F072 (default) | make | build/H.bin | NanoVNA-H |
| F303 | make TARGET=F303 | build/H4.bin | NanoVNA-H4 |
Troubleshooting
Section titled “Troubleshooting””arm-none-eabi-gcc: command not found”
Section titled “”arm-none-eabi-gcc: command not found””- Verify PATH includes the toolchain bin directory
- Restart your terminal after modifying PATH
- On Windows, check environment variables in System Properties
”ChibiOS directory not found” or missing includes
Section titled “”ChibiOS directory not found” or missing includes”- Ensure you extracted
ChibiOS.7z - The
ChibiOS/directory must be in the NanoVNA-H root
Build fails with strange errors
Section titled “Build fails with strange errors”- Verify you have version 8 of the ARM toolchain
- Try
make cleanbefore rebuilding - Check that all files were extracted completely
”make: Nothing to be done”
Section titled “”make: Nothing to be done””- The firmware is already built
- Use
make cleanto force a rebuild
Next Steps
Section titled “Next Steps”- Building and Flashing - Compile and upload firmware
- Debugging with CMSIS-DAP - Hardware debugging setup