Set-up: Build Scripts on STM32
Step-by-step set-up for command-line builds of RTK programs for STM32U585 and STM32H573
Overview
This is the first of two set-up stages for STM32 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 resulting ELF file via STM32CubeProgrammer. The debugger toolchain (GDB, OpenOCD, VS Code + Cortex-Debug) is added in the second stage, Set-up: Debugging on STM32.
If you only build via the Astrobe IDE and load via STM32CubeProgrammer manually, no set-up is needed – see Your First Build.
For RP2040 / RP2350, see Set-up: Build Scripts on RP.
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-elf,gen-rdb, etc.). Install per External Tools § Python 3. -
Astrobe for RP2350 (the M33 IDE/toolset) – builds for both STM32U585 and STM32H573. Despite the product name, at its core it is a compiler and linker for Cortex-M33 processors and works unchanged for STM32 M33 boards. STM32-specific
.iniconfigs and framework modules supply the address ranges and device drivers. -
STM32CubeProgrammer – ST's loader for STM32 devices, used to flash the ELF file (STM32 does not use UF2). Also the easiest way to configure option bytes (TZEN, SECWM) for TrustZone work, and to update ST-LINK firmware. Install per External Tools § STM32CubeProgrammer.
The ARM GNU toolchain (GDB, objdump, readelf), OpenOCD, and SVD files are not required at this stage – they belong 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% tokens in .ini library search paths.
For more information, see Framework Installation.
2. Note Your Astrobe Install Path
Astrobe's installer embeds the version number in the install path, eg.:
C:\Program Files\Astrobe RP2350 v10.0.2
Note the exact path – it goes into RTK_ASTROBE_BUILD_2350 and
RTK_ASTROBE_LINK_2350 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
set-up:
-
RTK_REPO_ROOT– youroberon-rtkcheckout. -
RTK_ASTROBE_FOLDER_2350 -
RTK_ASTROBE_BUILD_2350 -
RTK_ASTROBE_LINK_2350
If you build only for STM32 and not for RP2040, comment out the
RTK_ASTROBE_*_2040 set – both the set lines and the
corresponding setx lines at the bottom of the script.
RTK_ARM_ATTR_CFG and RTK_BOOT2 are derived from RTK_REPO_ROOT
and rarely need changes. RTK_BOOT2 is only used by RP2040 builds
and can be left set (harmless) or commented out.
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_*_2350
set, and RTK_ARM_ATTR_CFG. Spot-check that RTK_REPO_ROOT points
to an existing directory and that RTK_ASTROBE_BUILD_2350 points
to an existing .exe file.
Next Steps
-
To build a program from the command line: see Compile and Link: STM32, then Build & Load: STM32 for the load step.
-
To add debugging on top of this stage: Set-up: Debugging on STM32.
See Also
Last updated: 15 May 2026