Getting Started (STM32)
Newcomer quickstart for the STM32 (HAL) platform of kbox-stack — get the distribution, build the led-indicator example, and flash it over ST-Link.
This is the fastest path from a fresh checkout to a running KNX device on the
STM32 (HAL) platform. It builds the led-indicator reference example and
flashes it to an STM32F103 + NCN5130 board.
Prerequisites
- ARM toolchain:
arm-none-eabi-gcc(bundled with STM32CubeIDE, or standalone). - CMake 3.22+.
- A development board with an STM32F103TBUx and an NCN5130 KNX transceiver.
- An ST-Link probe for flashing and debugging.
You do not build the stack itself. It ships as a prebuilt static library plus
public headers. You only compile your application and link the .a.
Get the distribution
The stack is consumed as a distribution (dist/) with two parts:
| Path | What it is |
|---|---|
dist/include/ | Public headers only, reached as <Stack/...>. |
dist/lib/libkbox-stack---cortexm3---STM32F103xB.a | The prebuilt Cortex-M3 / STM32F103xB static library. |
The led-indicator example lives inside the distribution at
examples/STM32F103-HAL/led-indicator/ and links the library by a relative path
(three directories up), so no copying is needed.
If the stack is rebuilt, keep dist/ in sync. The example links the .a by
relative path and does not vendor its own copy.
There are two examples: led-indicator (Standard / Non-Secure, used below)
and led-indicator-secure (KNX Data Secure). The secure example builds and
flashes the same way — just run the commands below from
examples/STM32F103-HAL/led-indicator-secure/ instead. See
Your First Secure Application (STM32)
for what is different in its code.
Build the example
From the example folder (examples/STM32F103-HAL/led-indicator/):
Configure a Debug build.
cmake -S . -B build_dbg -DCMAKE_BUILD_TYPE=DebugIf your ARM toolchain is not on the default path, point CMake at its bin/
directory:
cmake -S . -B build_dbg -DCMAKE_BUILD_TYPE=Debug \
-DTOOLCHAIN_BIN=/path/to/arm-none-eabi/binCompile.
cmake --build build_dbgThis produces led-indicator.elf, led-indicator.hex, and led-indicator.bin
inside build_dbg/, and prints the flash/RAM size.
(Optional) Build a size-optimized Release. Release is -Os and enables the
watchdog.
cmake -S . -B build_rel -DCMAKE_BUILD_TYPE=Release
cmake --build build_relFlash it
Flash the .elf (or .hex) with OpenOCD over ST-Link. The example ships an
OpenOCD config, led-indicator Debug.cfg:
openocd -f "led-indicator Debug.cfg" \
-c "program build_dbg/led-indicator.elf verify reset exit"program … verify reset exit writes the image, verifies it, resets the MCU, and
exits OpenOCD. After reset the device is a live KNX node: send a 1-bit
GroupValueWrite to its On/Off object and the indicator LED turns on.
More flashing options — the .hex/.bin outputs, the OpenOCD config in detail,
and IDE flashing — are on the Flashing (STM32)
page.
What you just ran
led-indicator is a complete KNX device built entirely on the public stack API:
On/Off and 1-byte state control of an LED, status feedback, and an optional
periodic "alive" telegram. To understand its code — global construction, the
event wiring, and the main loop — read
Your First Application (STM32).