Oberon RTK

Build and Load: STM32

Building and loading programs on Cortex-M33 STM32 MCUs.

Overview

This document describes how to build, load, and run RTK-based programs for the Cortex-M33 STM32 series of MCUs for two scenarios:

  • simple loading, without debugging
  • with debugging

Tested with STM32U585 and STM32H573.

Other than with the RP2350, the "native" binary file format is ELF, both with or without debugging. If intended for loading only, you can omit the option --debug when running make-elf. However, it does not hurt if debug data are included in a load-only file, they just increase the load file size. The executable binaries are 100% the same with or without debug data, and consequently there is no "debug overhead" with debug data included.

The suite of tools used is Astrobe for RP2350 – despite its name, at its core it is a compiler and linker for processors based on Cortex-M33, which work well for the STM32U585 and STM32H573. Obviously, different .ini config files are needed with the correct address ranges, and the framework must provide the STM32-specific modules.

For programs with Secure/Non-secure segregation refer to Build and Load: STM32 (S/NS).

See also Practical Notes.

STM32 Configuration

We assume this MCU configuration:

  • TrustZone is enabled

  • the 2MB flash memory has been configured, via option bytes

    • block 1 of 1 MB is Secure (address alias: 0C000000H)
    • block 2 of 1 MB is Non-secure (address alias: 08100000H)
  • Since all programs not using S/NS segregation run as Secure, Secure addresses should be used for compilation and linking (Astrobe .ini config file).

Project Set-up

Build and Load, no Debugging

Build the Program

1. Build the program.

2. Make the ELF file

> python -m make-elf <program>.bin

Note: make-elf uses configuration data from the program's map file in this simple one-binary case

Load the Image

3. For loading, we have two options:

  • STM32CubeProgrammer GUI

    • connect via ST-Link (right top green/yellow-ish button)
    • left hand side, tab "Memory & File editing"
    • new tab => open <program>.elf
    • use the blue-ish Download button
    • after downloading, press the board reset button to start the program
  • STM32_Programmer_CLI

    • run:
> STM32_Programmer_CLI.exe -c port=SWD -d <program>.elf -s

Build and Load for Debugging

Build the Program

1. Build: as above

2. Run gen-rdb to create an .alst file for each module in the program, plus _startup.alst for the startup sequence inserted by the linker at the end of the program; make-elf requires the .alst files to create symbols and DWARF debug data:

> python -m gen-rdb <program>.map

3. Make the ELF file

> python -m make-elf <program>.bin --debug

Notes:

  • both gen-rdb and make-elf use configuration data from the program's map file in this simple one-binary case
  • by default, the .alst files are created in directory rdb in the project directory

Load the Image

4. Load the debug ELF file to the STM32

  • Refer to Debugging:
    • GUI: Cortex-Debug inside VisualStudio Code
    • command line: OpenOCD and GDB

Tools

Examples (Repository)

  • <repo-root>/examples/v3.1/stm/h573i-dk/SignalSync
  • <repo-root>/examples/v3.1/stm/u585i-iot/K4sema

Last updated: 17 April 2026