Minimal bare-metal C examples for OnMCU. Most count
upwards and stream the count over RTT on real hardware in the cloud; one
logs over a serial port instead. Each signals success to the host via ARM
semihosting so the run exits 0. The structure mirrors the
[rust-examples](../rust-examples) repository.
cd nucleo-h743zi
make run # build + flash + run on a real NUCLEO-H743ZI, returns 0 on successmake run builds the ELF and invokes onmcu run --board <BOARD> --file <elf>,
which uploads the firmware, runs it on real hardware, streams the RTT log back to
your terminal, and exits 0 on success.
-
Arm GNU toolchain:
arm-none-eabi-gcc(andobjcopy,size) onPATH. -
GNU make.
-
OnMCU CLI: install the
onmcubinary, then authenticate once:onmcu login # stores your API key in the OS keyring onmcu list-boards # confirm which boards are available
Create your API key under app.onmcu.com/settings. See github.com/onmcu/onmcu-rs for details.
lib/ reusable, board-independent libraries
rtt/ minimal SEGGER-RTT compatible up channel (target -> host)
semihosting/ ARM semihosting exit, for the run's return code
common.mk shared build rules (toolchain, lib build, run target)
nucleo-h743zi/ one example crate per board
Makefile sets NAME, BOARD, linker script, MCU flags, sources
stm32h743.ld memory map + sections
startup_stm32h743.c vector table + reset handler
main.c the counter
Semihosting is compiled into every example, and RTT into all but the serial-only
one (which sets USE_RTT = 0), so adding a new board only means adding a board
directory with its Makefile, linker script, startup and main.c.
- RTT (
lib/rtt): a statically initialised control block placed at the start of RAM. The debugger OnMCU attaches scans RAM for the signature, then drains channel 0 and prints it as plain text. Only a single blocking up channel is implemented, which is all the examples need. - Semihosting (
lib/semihosting):sys_exit(code)issuesSYS_EXIT_EXTENDEDviabkpt 0xAB. The debugger services the trap and ends the session with that code (0= success, non-zero = failure). - Serial (
nucleo-f401re-serial): logs over USART2 (PA2/PA3, the ST-LINK virtual COM port) at 115200 8N1 instead of RTT. It setsUSE_RTT = 0and runs with--logging serial, so OnMCU captures the board's serial output.
| Directory | Board | MCU | Core | Logging |
|---|---|---|---|---|
nucleo-h743zi |
NUCLEO-H743ZI | STM32H743ZIT6 | Cortex-M7 | RTT |
nucleo-f401re |
NUCLEO-F401RE | STM32F401RET6 | Cortex-M4F | RTT |
nucleo-f401re-serial |
NUCLEO-F401RE | STM32F401RET6 | Cortex-M4F | serial (USART2) |
nucleo-f439zi |
NUCLEO-F439ZI | STM32F439ZIT6 | Cortex-M4F | RTT |
nucleo-wb55rg |
NUCLEO-WB55RG | STM32WB55RGV6 | Cortex-M4F | RTT |
nucleo-wl55jc |
NUCLEO-WL55JC | STM32WL55JC | Cortex-M4 | RTT |