# smoothieware/smoothiev2 architecture

> Architecture diagram of the GitHub repository smoothieware/smoothiev2, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-09). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/smoothieware/smoothiev2
- Repository: https://github.com/smoothieware/smoothiev2

## Overview

Smoothie V2 is STM32H745/H743 motion-control firmware built on STM32 HAL and FreeRTOS. The primary runtime path is startup and configuration, followed by command handling and motion execution through the robot, planner, and conveyor. The repository also includes networking, SD/FatFs support, and a USB DFU bootloader. The excerpts establish only part of the wiring; dashed, uncited edges mark plausible but unverified links, and unsampled subsystems are represented at their supported directory paths.

Main entry points: [`Firmware/src/main.cpp`](https://github.com/smoothieware/smoothiev2/blob/master/Firmware/src/main.cpp) (Firmware startup), [`Firmware/src/robot/Robot.cpp`](https://github.com/smoothieware/smoothiev2/blob/master/Firmware/src/robot/Robot.cpp) (Robot actuators), [`Firmware/src`](https://github.com/smoothieware/smoothiev2/tree/master/Firmware/src) (Motion planner), [`Firmware/src/CommandShell.h`](https://github.com/smoothieware/smoothiev2/blob/master/Firmware/src/CommandShell.h) (Command shell)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Firmware runtime"]
  node_startup["Firmware startup<br/>[main.cpp]"]
  node_configuration["Configuration<br/>[ConfigReader.h]"]
  node_command_shell["Command shell<br/>[CommandShell.h]"]
  node_gcode["G-code processing<br/>[GCodeProcessor.h]"]
  node_dispatcher["Command dispatcher<br/>[Dispatcher.h]"]
  node_console["Consoles<br/>[Consoles.h]"]
  node_output["Output stream<br/>[OutputStream.h]"]
end

subgraph group_motion["Motion control"]
  node_robot["Robot actuators<br/>[Robot.cpp]"]
  node_planner["Motion planner"]
  node_conveyor["Motion conveyor<br/>[Conveyor.h]"]
end

subgraph group_platform["Platform services"]
  node_hal["STM32 HAL<br/>[stm32h7xx_hal.h]"]
  node_rtos["FreeRTOS kernel"]
  node_usb_dfu["USB DFU bootloader<br/>[main.c]"]
  node_sd_storage[("SD and FatFs")]
end

subgraph group_network["Networking"]
  node_network_stack["FreeRTOS networking<br/>[FreeRTOS_IP.c]"]
  node_network_services["Network services"]
  node_ntp["NTP client<br/>[ntpclient.cpp]"]
end

node_operator(("Operator"))

node_operator -.->|"sends commands"| node_console
node_startup -->|"configures modules"| node_configuration
node_startup -->|"initializes"| node_robot
node_startup -->|"initializes"| node_planner
node_startup -->|"starts"| node_conveyor
node_startup -->|"creates"| node_command_shell
node_command_shell -.->|"accepts commands"| node_gcode
node_gcode -.->|"dispatches"| node_dispatcher
node_dispatcher -.->|"controls motion"| node_robot
node_robot -->|"provides motor count"| node_planner
node_planner -->|"precedes startup"| node_conveyor
node_console -.->|"writes output"| node_output
node_startup -->|"sets up system"| node_hal
node_startup -.->|"launches task"| node_rtos
node_usb_dfu -.->|"uses hardware layer"| node_hal
node_ntp -->|"uses sockets"| node_network_stack
node_network_services -.->|"uses IP services"| node_network_stack

click node_startup "https://github.com/smoothieware/smoothiev2/blob/master/Firmware/src/main.cpp"
click node_configuration "https://github.com/smoothieware/smoothiev2/blob/master/Firmware/src/ConfigReader.h"
click node_command_shell "https://github.com/smoothieware/smoothiev2/blob/master/Firmware/src/CommandShell.h"
click node_gcode "https://github.com/smoothieware/smoothiev2/blob/master/Firmware/src/GCodeProcessor.h"
click node_dispatcher "https://github.com/smoothieware/smoothiev2/blob/master/Firmware/src/Dispatcher.h"
click node_console "https://github.com/smoothieware/smoothiev2/blob/master/Firmware/src/Consoles.h"
click node_output "https://github.com/smoothieware/smoothiev2/blob/master/Firmware/src/libs/OutputStream.h"
click node_robot "https://github.com/smoothieware/smoothiev2/blob/master/Firmware/src/robot/Robot.cpp"
click node_planner "https://github.com/smoothieware/smoothiev2/tree/master/Firmware/src"
click node_conveyor "https://github.com/smoothieware/smoothiev2/blob/master/Firmware/src/robot/Conveyor.h"
click node_hal "https://github.com/smoothieware/smoothiev2/blob/master/Firmware/Hal/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal.h"
click node_rtos "https://github.com/smoothieware/smoothiev2/tree/master/Firmware/RTOS/include"
click node_usb_dfu "https://github.com/smoothieware/smoothiev2/blob/master/DFUBootloader/Src/main.c"
click node_sd_storage "https://github.com/smoothieware/smoothiev2/tree/master/Firmware/Hal/sdmmc/src"
click node_network_stack "https://github.com/smoothieware/smoothiev2/blob/master/Firmware/Hal/network/FreeRTOS_IP.c"
click node_network_services "https://github.com/smoothieware/smoothiev2/tree/master/Firmware/Hal/network/services"
click node_ntp "https://github.com/smoothieware/smoothiev2/blob/master/Firmware/src/modules/utils/network/ntpclient.cpp"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_startup,node_configuration,node_command_shell,node_gcode,node_dispatcher,node_console,node_output toneBlue
class node_robot,node_planner,node_conveyor toneAmber
class node_hal,node_rtos,node_usb_dfu,node_sd_storage toneMint
class node_network_stack,node_network_services,node_ntp toneRose
class node_operator toneIndigo
```

## Components

### Firmware runtime

- [Firmware startup](https://github.com/smoothieware/smoothiev2/blob/master/Firmware/src/main.cpp): `Firmware/src/main.cpp`
- [Configuration](https://github.com/smoothieware/smoothiev2/blob/master/Firmware/src/ConfigReader.h): `Firmware/src/ConfigReader.h`
- [Command shell](https://github.com/smoothieware/smoothiev2/blob/master/Firmware/src/CommandShell.h): `Firmware/src/CommandShell.h`
- [G-code processing](https://github.com/smoothieware/smoothiev2/blob/master/Firmware/src/GCodeProcessor.h): `Firmware/src/GCodeProcessor.h`
- [Command dispatcher](https://github.com/smoothieware/smoothiev2/blob/master/Firmware/src/Dispatcher.h): `Firmware/src/Dispatcher.h`
- [Consoles](https://github.com/smoothieware/smoothiev2/blob/master/Firmware/src/Consoles.h): `Firmware/src/Consoles.h`
- [Output stream](https://github.com/smoothieware/smoothiev2/blob/master/Firmware/src/libs/OutputStream.h): `Firmware/src/libs/OutputStream.h`

### Motion control

- [Robot actuators](https://github.com/smoothieware/smoothiev2/blob/master/Firmware/src/robot/Robot.cpp): `Firmware/src/robot/Robot.cpp`
- [Motion planner](https://github.com/smoothieware/smoothiev2/tree/master/Firmware/src): `Firmware/src`
- [Motion conveyor](https://github.com/smoothieware/smoothiev2/blob/master/Firmware/src/robot/Conveyor.h): `Firmware/src/robot/Conveyor.h`

### Platform services

- [STM32 HAL](https://github.com/smoothieware/smoothiev2/blob/master/Firmware/Hal/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal.h): `Firmware/Hal/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal.h`
- [FreeRTOS kernel](https://github.com/smoothieware/smoothiev2/tree/master/Firmware/RTOS/include): `Firmware/RTOS/include`
- [USB DFU bootloader](https://github.com/smoothieware/smoothiev2/blob/master/DFUBootloader/Src/main.c): `DFUBootloader/Src/main.c`
- [SD and FatFs](https://github.com/smoothieware/smoothiev2/tree/master/Firmware/Hal/sdmmc/src): `Firmware/Hal/sdmmc/src`

### Networking

- [FreeRTOS networking](https://github.com/smoothieware/smoothiev2/blob/master/Firmware/Hal/network/FreeRTOS_IP.c): `Firmware/Hal/network/FreeRTOS_IP.c`
- [Network services](https://github.com/smoothieware/smoothiev2/tree/master/Firmware/Hal/network/services): `Firmware/Hal/network/services`
- [NTP client](https://github.com/smoothieware/smoothiev2/blob/master/Firmware/src/modules/utils/network/ntpclient.cpp): `Firmware/src/modules/utils/network/ntpclient.cpp`

### Other components

- **Operator**

## Connections

- Operator → Consoles: sends commands
- Firmware startup → Configuration: configures modules (evidence: `Firmware/src/main.cpp`)
- Firmware startup → Robot actuators: initializes (evidence: `Firmware/src/main.cpp`)
- Firmware startup → Motion planner: initializes (evidence: `Firmware/src/main.cpp`)
- Firmware startup → Motion conveyor: starts (evidence: `Firmware/src/main.cpp`)
- Firmware startup → Command shell: creates (evidence: `Firmware/src/main.cpp`)
- Command shell → G-code processing: accepts commands
- G-code processing → Command dispatcher: dispatches
- Command dispatcher → Robot actuators: controls motion
- Robot actuators → Motion planner: provides motor count (evidence: `Firmware/src/main.cpp`)
- Motion planner → Motion conveyor: precedes startup (evidence: `Firmware/src/main.cpp`)
- Consoles → Output stream: writes output
- Firmware startup → STM32 HAL: sets up system (evidence: `Firmware/src/main.cpp`)
- Firmware startup → FreeRTOS kernel: launches task (evidence: `Firmware/src/main.cpp`)
- USB DFU bootloader → STM32 HAL: uses hardware layer (evidence: `DFUBootloader/Src/main.c`)
- NTP client → FreeRTOS networking: uses sockets (evidence: `Firmware/src/modules/utils/network/ntpclient.cpp`)
- Network services → FreeRTOS networking: uses IP services
