Set-up: Build Scripts on RP
Step-by-step set-up for command-line builds of RTK programs for RP2040 and RP2350
Overview
This is the first of two set-up stages for RP targets. It gets command-line builds working – enough to compile and link single-image and S/NS programs from a terminal, and to load the result via UF2. The debugger toolchain (GDB, OpenOCD, VS Code + Cortex-Debug) is added in the second stage, Set-up: Debugging on RP.
If you only build via the Astrobe IDE and load via drag-and-drop UF2, no set-up is needed – see Your First Build.
For STM32, see Set-up: Build Scripts on STM32.
This guide configures the [SHIPPED] tier of
<repo>/tools/setup/set-rtk-env.cmd (Windows) or
set-rtk-env.sh (macOS / Git Bash); the script's header documents
the same tier structure from a different angle.
Prerequisites
-
A checkout of the
oberon-rtkrepository. -
Python 3 (3.9 or later) – runs the framework's Python tools (
make-uf2,make-elf,gen-rdb, etc.). Install per External Tools § Python 3. -
Astrobe – one or both IDE/toolsets, matched to your target(s):
- Astrobe for RP2040 (the M0+ IDE/tools) – for RP2040 targets.
- Astrobe for RP2350 (the M33 IDE/tools) – for RP2350 targets.
-
picotool (optional, but useful) – command-line loader for RP boards. Install per External Tools § picotool.
The ARM GNU toolchain (GDB, objdump, readelf) is not required at this stage – it belongs to the debug set-up.
Steps
1. Note Your Repo Install Location
Note the absolute path to your oberon-rtk checkout. You will
set RTK_REPO_ROOT to this in step 3.
Example: %USERPROFILE%\Projects\oberon\dev\oberon-rtk.
Also note your Astrobe folder value, which is the substitution
base for %AstrobeRP2350% and %AstrobeRP2040% tokens in .ini
library search paths.
For more information, see Framework Installation.
2. Note Your Astrobe Install Paths
Astrobe's installer embeds the version number in the install path, eg.:
C:\Program Files\Astrobe RP2350 v10.0.2
C:\Program Files\Astrobe RP2040 v9.0.0
Note the exact paths – they go into RTK_ASTROBE_* in step 3, and
will need updating when you upgrade Astrobe.
3. Edit set-rtk-env.cmd
Open <repo>/tools/setup/set-rtk-env.cmd (Windows) in a text
editor. The file ships configured for the build-scripts tier. Adjust
the example paths in the [EDIT] sections to match your setup:
-
RTK_REPO_ROOT– youroberon-rtkcheckout. -
For RP2350:
RTK_ASTROBE_FOLDER_2350RTK_ASTROBE_BUILD_2350RTK_ASTROBE_LINK_2350
-
For RP2040:
RTK_ASTROBE_FOLDER_2040RTK_ASTROBE_BUILD_2040RTK_ASTROBE_LINK_2040
If you only build for one of the two RP products, comment out the
unused set – both the set line and the corresponding setx line
at the bottom of the script.
RTK_ARM_ATTR_CFG and RTK_BOOT2 are derived from RTK_REPO_ROOT
and rarely need changes.
On macOS or Git Bash, use set-rtk-env.sh and source it from
~/.bashrc (or ~/.zshrc on macOS zsh). The variable layout is the
same; the script also wires up RTK_EXERUN=mono for Mono-based
Astrobe invocations (see Astrobe on macOS).
For the meaning of each variable, see Environment Variables.
4. Run the Script
Open a cmd window (not admin) and run:
tools\setup\set-rtk-env.cmd
The script uses setx to persist the values to
HKCU\Environment, so they survive across cmd sessions, VS Code,
and any tool launched from the Start menu.
5. Verify
In a freshly launched cmd window:
set RTK_
The list should include RTK_REPO_ROOT, the RTK_ASTROBE_* set(s)
you enabled, RTK_ARM_ATTR_CFG, and RTK_BOOT2. Spot-check that
RTK_REPO_ROOT points to an existing directory and that the
RTK_ASTROBE_BUILD_* paths point to existing .exe files.
Next Steps
-
To build a program from the command line: see Compile and Link: RP2040 or Compile and Link: RP2350, then Build & Load: RP2040 / Build & Load: RP2350 for the load step.
-
To add debugging on top of this stage: Set-up: Debugging on RP.
See Also
Last updated: 15 May 2026