Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Flash a real board

How-to · Level 2: Building real applications

Needs first: Run a talker on an emulated board, What you just built, Get started on the Nucleo-F767ZI

Use this page to put an image on a board you hold: record which device on your machine is which board, read the plan nros flash follows, program the board, and watch its console. The image is the one you ran in the board’s twin; nothing is rebuilt for the bench. On a host or in an emulator, nros run does the same job, and on hardware nros flash does.

Boards with hardware

Every board row that names a physical board, from the board support registry:

BoardPackageStatusTwinIn this book
s32z270nros-board-s32z270-freertos (s32z270-freertos)Builds—reference page only
s32z270nros-board-s32z270-freertos (s32z270-freertos-rtd)Not supported—reference page only
s32z270nros-board-zephyr (s32z270-rtu0-zephyr)Builds—reference page only
mr-canhubk344s32k344-safety-islandBoots on hardware, manual (2026-10-26); reads Builds from 2027-02-24—reference page only
nucleo-f767zinros-board-nucleo-f767zi-zephyrBoots, manual (2026-11-01); reads Builds from 2027-03-02renode:nucleo_f767zistarter, platform page, flash steps
rpi-pico-wnros-board-rpi-pico-w-zephyrNot supported—reference page only

A board with a twin and a starter is the path this page follows. A board with only its reference page is one the book does not teach yet: its row says what nano-ros has shown for it.

How a board is described

Every place an image can run is described the same way, in the board’s descriptor:

  • a launcher or flasher: a host process, an emulator, or the tool that programs the board, such as Zephyr’s west flash runner;
  • a console: where the image’s output appears, such as standard output, QEMU’s semihosting, or a serial port;
  • a link: how the image’s middleware reaches the rest of the system, such as a serial port carrying zenoh to a router on your host.

nros reads these, so the same verbs work on every board. nros run launches an image on the host or in an emulator, and refuses a hardware image, naming the flashing step instead. nros flash programs a board, and nros monitor attaches to its console.

Before you start

  • A workspace whose image runs in the board’s twin, as its starter leaves it.
  • The board, on a USB cable. A board whose console is on its pins rather than on the cable, as the Nucleo-F767ZI’s and the Pico W’s are, needs a USB-to-UART adapter to read the console.

Steps

Record the board

With the board attached, nros bench scan matches each attached USB device to a board by its USB id and records it in $NROS_HOME/bench.toml, keyed by its serial number, so the same board is found after a replug or on another USB port. See what it would record first:

nros bench scan --dry-run

Run it without --dry-run to write the file. nros bench list prints the file and what is attached now:

nros bench list

The file belongs to your machine and is never committed. A rescan keeps what you added by hand, such as a debug probe’s serial number (probe) or a command that power-cycles the board (power_cycle).

Read the flash plan

From the workspace root, print what nros flash would do, and where each fact came from, without touching the board:

nros flash --dry-run --why --port /dev/ttyACM0

The plan names the flash method, the port and the probe, and the console --monitor would open. Facts come from five places, highest first: the command line (--port, --probe, --runner, arguments after --), the image, your machine’s bench file, the board’s descriptor, and the runner’s defaults. The port, when you do not pass one, is NROS_PORT, then the bench file’s entry for the board, then the one attached device that matches the board. Two candidates are refused, listing both: nros flash never guesses between two devices.

Flash the board

Flash it:

nros flash

nros flash builds the image if it is stale, then programs it with the board’s flash method. For a Zephyr board that is Zephyr’s own runner for the board, the one zephyr/runners.yaml names: OpenOCD over the ST-LINK for the Nucleo-F767ZI, the UF2 copy for the Pico W (hold BOOTSEL as you plug it in).

Talk to ROS 2

Flash with --monitor to have nros flash then serve the board’s link on your host, the way nros run did for the twin: for a serial link it starts the router on the board’s USB serial device. With --expect '<text>' it exits 0 when the console prints that text, and --timeout <seconds> bounds the wait. From a second terminal, ros2 topic echo hears the board as it heard the twin.

Attach again later

nros monitor opens a running board’s console without flashing it, with the same --port, --expect and --timeout. Outside a workspace, --port alone is enough.

Change how an image is flashed

An image overrides any key of its board’s flash or console description in its own [image.<id>.flash] and [image.<id>.console] tables, key by key, in the bringup’s system.toml. The image keeps every key it does not state:

[image.stm32.flash]
chip = "STM32F767ZITx"    # the part, in the flash method's own spelling (probe-rs)

[image.stm32.console]
baud = 921600             # a serial console's rate

The flash table takes method, command, chip and prepare (steps run before the flash); the console table takes kind, usb, baud and command. For one run, --runner <name> picks the flash method’s own runner (west flash --runner jlink), and arguments after -- go to the flasher unchanged.

Flash a board nano-ros does not ship

A board you add yourself is a board package of your own; Add a board takes one from a descriptor to a first image. Once its descriptor states a flash method, nros flash names its image like any other. Until then, flash the artifact nros build printed with the board vendor’s own tool:

PlatformThe artifactA flashing tool
Zephyrthe west build directory nros build printedwest flash -d <dir>, with the runner your board’s definition declares, run inside the Zephyr west workspace or with ZEPHYR_BASE set to its zephyr/
Bare-metal or FreeRTOS on Cortex-Mthe ELFprobe-rs run --chip <chip> <elf>, or OpenOCD’s program <elf> verify reset exit
NuttXnuttx, nuttx.bin or nuttx.hex from your board’s BOARD_CONFIGthe tool NuttX’s page for your board names

The board needs a link nano-ros can use: a serial port, or a network interface its board package brings up.

If it doesn’t work

  • nros run refuses and names a flashing step: the image’s board is hardware. Use nros flash.
  • nros flash cannot find the board: run nros bench scan with the board attached, or pass --port.
  • Two devices match: pass --port, or record each board with nros bench scan.
  • The image flashes and never talks: the link is not on the port the router listens on. Check the plan’s [link], and that the adapter’s TX and RX are not crossed.
  • Everything else: Troubleshoot.

See also

Design background