HomeCore 0.1.3 (07b5544)
Bare-metal personal computer firmware for Cortex-M
Loading...
Searching...
No Matches
STM32VLDISCOVERY
The stm32vldiscovery target supports ST's STM32VLDISCOVERY board with an STM32F100RB. With 8 KB of RAM it is the smallest HomeCore target. It runs the shell and VFS over a USART1 console (interrupt-driven receive) with a 1 kHz SysTick.
QEMU tested in CIHardware pending

QEMU's stm32vldiscovery machine runs this port, so it is the STM32 code path covered by the CI regression. The physical-board build, which adds PLL clock setup, has not been validated on hardware.

STM32VLDISCOVERY board (MB913C), top side
Photo: Viswesr, CC BY-SA 3.0, resized

At a glance

SoCST STM32F100RB (st/stm32f100)
CoreCortex-M3
Flash128 KB at 0x08000000
RAM8 KB at 0x20000000
Clock24 MHz, PLL from HSI/2 × 6
ConsoleUSART1, PA9 TX / PA10 RX, 115200 8N1
Presetsstm32vldiscovery, stm32vldiscovery-qemu

Build configurations

Preset Configuration Clock setup Use
stm32vldiscovery configs/stm32vldiscovery_defconfig PLL to 24 MHz Physical board
stm32vldiscovery-qemu same defconfig + overlay src/board/stm32vldiscovery/qemu.yaml Skipped QEMU only
cmake --preset stm32vldiscovery-qemu -DPython3_EXECUTABLE="$PWD/.venv/bin/python"
cmake --build --preset stm32vldiscovery-qemu
bash scripts/run-qemu-stm32vldiscovery.sh
python3 tests/qemu_files_test.py --board stm32vldiscovery

QEMU maps its first serial port to USART1. Exit the interactive session with Ctrl-A, then X.

Warning
Do not flash the QEMU build to a physical board. It skips clock setup, so the board would run at the 8 MHz reset clock while assuming 24 MHz.

Clock

With clock_setup true (the default in board.yaml), board_init() runs the PLL from HSI/2 × 6 = 24 MHz, the STM32F100 maximum, with undivided AHB, APB1, and APB2 clocks. Each step waits with a bounded iteration budget; a failure halts before the console starts, so diagnose it with a debugger.

QEMU does not model the clock controller or GPIO: reads return 0 and writes are ignored. Its CPU and SysTick clock is fixed at 24 MHz, so the QEMU overlay (qemu.yaml, clock_setup: false) skips clock setup and the board reports 24 MHz in both configurations.

Memory budget

STM32VLDISCOVERY memory map Flash holds the vector table, code, and the .data load image. The 8 KB of RAM holds about 1.9 KB of static data, about 4.2 KB of heap, and a 2 KB main stack. Flash · 128 KB 0x0802 0000 0x0800 0000 free .data load image .text, .rodata vector table RAM · 8 KB 0x2000 2000 0x2000 0000 main stack, 2 KB heap, about 4.2 KB .data, .bss, about 1.9 KB RAM drawn to scale; flash not to scale. Sizes are approximate QEMU measurements.

Both defconfigs change four defaults to fit 8 KB of RAM:

Setting Default This board
CONFIG_HOMECORE_KERNEL_MAIN_STACK_SIZE 3072 2048
CONFIG_HOMECORE_SHELL_BASIC_MAX_NESTING 8 4
CONFIG_HOMECORE_VFS_MAX_FILE_SIZE 4096 1024
CONFIG_HOMECORE_KERNEL_STDIO_BUFFERED y n (saves about 2 KB of heap)

VFS entries and descriptors use heap only while they exist, so the default caps of 16 files, 16 directories, and 16 open files are kept. In QEMU, about 450 bytes of heap are used after boot, and 16 directories plus 16 empty files add about 2 KB. File contents, BASIC programs, and variables share the remaining heap. When it runs out, creating an entry fails with "Not enough space" (ENOMEM), which differs from "No space left on device" at a cap.

BASIC lines may nest parentheses, unary signs, function calls, and IF ... THEN up to 4 levels. Measured stack peaks in QEMU are about 0.9 KB for file commands and 1.7 KB for BASIC at the nesting limit, leaving about 380 bytes of margin. mem reports heap use and the stack high-water mark.

Console wiring (physical board)

STM32VLDISCOVERY console wiring USART1 on PA9 and PA10 crosses to a 3.3 V USB-UART adapter; ground is shared and the adapter's VCC is left unconnected. The ST-LINK/V1 has no virtual COM port, so the adapter is required. ST-LINK USB: power and flashing STM32VLDISCOVERY ST-LINK/V1 USB · SWD, no VCP STM32F100RB Cortex-M3 Header USB–UART adapter 3.3 V logic Host PC terminal 115200 8N1 USB PA9 TX RX PA10 RX TX GND GND VCC not connected Schematic, not to scale. Not yet validated on a physical board.
Board pin Adapter pin
PA9 (USART1 TX) RX
PA10 (USART1 RX) TX
GND GND

Use a 3.3 V USB-to-UART adapter at 115200 baud, 8N1, no flow control. The on-board ST-LINK/V1 has no virtual COM port. OpenOCD provides board/stm32vldiscovery.cfg for it; on Linux the ST-LINK/V1 needs the usb-storage quirk 483:3744:i. These flashing steps have not been checked with this port:

openocd -f board/stm32vldiscovery.cfg \
-c "program build/stm32vldiscovery/homecore verify reset exit"

LEDs

File LED Pin
/dev/led0 LD3 green PC9
/dev/led1 LD4 blue PC8

Both are GPIO LEDs on port C, lit when the pin is high. QEMU models no GPIO, so the stm32vldiscovery-qemu build's overlay disables them and enables console LEDs with the same files, which print [led0] on and similar lines. See LEDs.

Hardware validation checklist

Confirm the banner, uptime against elapsed time (which checks the 24 MHz PLL), mem, the file commands, basic, the LEDs (write /dev/led0 on lights LD3), and reboot, as described in the porting guide.

The full board guide is docs/boards/stm32vldiscovery.md.