HomeCore 0.1.3 (07b5544)
Bare-metal personal computer firmware for Cortex-M
Loading...
Searching...
No Matches
STM32F4DISCOVERY
The stm32f4discovery target supports ST's STM32F4DISCOVERY board with an STM32F407VGT6. It runs the shell and VFS over a USART2 console (interrupt-driven receive) with a 1 kHz SysTick, clocked from the 16 MHz internal HSI oscillator.
Builds in CIHardware pending

The port is cross-compiled in CI and its linked layout has been checked. QEMU has no model for this board, so nothing executes this port automatically. Physical hardware validation is still required.

STM32F4DISCOVERY board (MB997B), top side
Photo: Teardown Central, CC BY-SA 2.0, resized

At a glance

SoCST STM32F407VGT6 (st/stm32f407)
CoreCortex-M4F, software floating point
Flash1 MB at 0x08000000
RAM128 KB SRAM at 0x20000000; 64 KB CCM unused
Clock16 MHz HSI
ConsoleUSART2, PA2 TX / PA3 RX, 115200 8N1
Presetstm32f4discovery

Build and flash

cmake --preset stm32f4discovery -DPython3_EXECUTABLE="$PWD/.venv/bin/python"
cmake --build --preset stm32f4discovery

The ELF is build/stm32f4discovery/homecore, and the raw flash image is build/stm32f4discovery/homecore.bin. With OpenOCD installed and the on-board ST-LINK connected (CN3 jumpers fitted), program and reset with:

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

Console wiring

STM32F4DISCOVERY console wiring USART2 on PA2 and PA3 crosses to a 3.3 V USB-UART adapter; ground is shared and the adapter's VCC is left unconnected. The ST-LINK USB port powers the board and is used for flashing. ST-LINK USB: power and flashing STM32F4DISCOVERY ST-LINK/V2 USB · SWD STM32F407VGT6 Cortex-M4F P1 USB–UART adapter 3.3 V logic Host PC terminal 115200 8N1 USB PA2 TX RX PA3 RX TX GND GND VCC not connected Schematic, not to scale. Keep BOOT0 low for flash boot.
Board pin Adapter pin
PA2 (USART2 TX) RX
PA3 (USART2 RX) TX
GND GND

Use a 3.3 V USB-to-UART adapter at 115200 baud, 8N1, no flow control. Power the board through its ST-LINK USB connector and leave the adapter's power pin disconnected. Keep BOOT0 low for flash boot. Configure the terminal to display LF as a new line; press Enter to submit commands. The console is /dev/uart0.

Note
The STM32F407G-DISC1 revision has an ST-LINK/V2-A with a virtual COM port, but its UART is not connected to the target by default. To use it, wire PA2 (P1 pin 14) to U2 pin 13 (ST-LINK RX) and PA3 (P1 pin 13) to U2 pin 12 (ST-LINK TX). These are added wires to the ST-LINK MCU pins, not the CN3 SWD jumpers. See ST's board manual (UM1472).

Memory

STM32F4DISCOVERY memory map Flash holds the vector table, code, and the .data load image. Main SRAM holds .data and .bss, including the 64 KB and 16 KB ramdisks, then the heap up to the 3 KB main stack. The 64 KB CCM RAM is unused. Flash · 1 MB 0x0810 0000 0x0800 0000 free .data load image .text, .rodata vector table SRAM · 128 KB 0x2002 0000 0x2000 0000 main stack, 3 KB (grows down) heap (grows up) .data, .bss (80 KB ramdisks) Not to scale. The 64 KB CCM RAM at 0x1000 0000 is not used.

The main stack uses the default CONFIG_HOMECORE_KERNEL_MAIN_STACK_SIZE of 3 KB. Static data includes two ramdisks, 80 KB together: FAT at /ram (64 KB) and littlefs at /lfs (16 KB), formatted at every boot; see Files and storage. The rest of main SRAM after static data is heap.

LEDs

The four user LEDs are GPIO LEDs on port D, lit when the pin is high:

File LED Pin
/dev/led0 LD4 green PD12
/dev/led1 LD3 orange PD13
/dev/led2 LD5 red PD14
/dev/led3 LD6 blue PD15

write /dev/led0 on or PRINT led(0, 1) in BASIC lights LD4; see LEDs. They have not been checked on hardware.

Hardware validation checklist

After reset, check the HomeCore banner and prompt, then run help, mem, uptime, cat /dev/uptime, mkdir /tmp, touch /tmp/test, ls /tmp, write /dev/ledN on and cat /dev/ledN for each LED, and reboot. Compare uptime against elapsed time; its accuracy follows the HSI oscillator tolerance.

Limitations

  • USB, audio, the on-board sensors, and hardware FPU context switching are not implemented.
  • Received bytes are buffered by the USART interrupt in a 64-byte ring; bytes beyond a full ring are dropped. Pasting has not been checked on hardware.
  • Clock startup waits use a finite iteration budget because SysTick is not running yet. An HSI readiness or clock-switch failure halts before the UART starts, so diagnose a silent board with a debugger.

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