# ch-2020-hc/stm32f446re-baremetal architecture

> Architecture diagram of the GitHub repository ch-2020-hc/stm32f446re-baremetal, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-12). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/ch-2020-hc/stm32f446re-baremetal
- Repository: https://github.com/ch-2020-hc/stm32f446re-baremetal

## Overview

This is a bare-metal STM32F446RE firmware project. Its implemented workflow initializes memory after reset, configures clocks and GPIO/EXTI, then responds to the user button through an interrupt to toggle the onboard LED. The README also describes future PWM, DMA, SPI, and CAN labs, but those applications are absent from the tree. Connections reflect the sampled app and EXTI code plus documented startup behavior; several driver implementations and startup assembly were not sampled.

Main entry points: [`apps/00_blink_exti/main.c`](https://github.com/ch-2020-hc/stm32f446re-baremetal/blob/main/apps/00_blink_exti/main.c) (Blink EXTI App), [`drivers/src/exti.c`](https://github.com/ch-2020-hc/stm32f446re-baremetal/blob/main/drivers/src/exti.c) (EXTI Driver), [`drivers/src/gpio.c`](https://github.com/ch-2020-hc/stm32f446re-baremetal/blob/main/drivers/src/gpio.c) (GPIO Driver), [`startup/startup.s`](https://github.com/ch-2020-hc/stm32f446re-baremetal/blob/main/startup/startup.s) (Reset Startup)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_boot["Boot and Memory"]
  node_startup["Reset Startup<br/>[startup.s]"]
  node_memory["Flash and RAM Layout<br/>[stm32f446re.ld]"]
end

subgraph group_firmware["Stage 0 Firmware"]
  node_app["Blink EXTI App<br/>[main.c]"]
  node_irq["EXTI Handler<br/>[main.c]"]
end

subgraph group_drivers["Peripheral Drivers"]
  node_rcc["Clock Setup<br/>[rcc.c]"]
  node_gpio["GPIO Driver<br/>[gpio.c]"]
  node_exti["EXTI Driver<br/>[exti.c]"]
  node_syscfg["SYSCFG Registers<br/>[syscfg.h]"]
  node_exti_regs["EXTI Registers<br/>[exti.h]"]
end

subgraph group_platform["Platform Support"]
  node_cmsis_device["Device Definitions<br/>[stm32f446re.h]"]
  node_cmsis_core["CMSIS Core Support"]
end

node_button(("User Button"))
node_led(("LD2 LED"))

node_startup -->|"uses layout"| node_memory
node_startup -->|"calls main"| node_app
node_app -->|"initializes clocks"| node_rcc
node_app -->|"initializes pins"| node_gpio
node_app -->|"initializes interrupt"| node_exti
node_exti -->|"maps pin"| node_syscfg
node_exti -->|"configures registers"| node_exti_regs
node_exti -->|"enables IRQ"| node_cmsis_device
node_cmsis_device -->|"includes core"| node_cmsis_core
node_button -->|"triggers interrupt"| node_exti
node_irq -->|"sets flag"| node_app
node_app -->|"toggles output"| node_gpio
node_gpio -->|"drives"| node_led

click node_startup "https://github.com/ch-2020-hc/stm32f446re-baremetal/blob/main/startup/startup.s"
click node_memory "https://github.com/ch-2020-hc/stm32f446re-baremetal/blob/main/ld/stm32f446re.ld"
click node_app "https://github.com/ch-2020-hc/stm32f446re-baremetal/blob/main/apps/00_blink_exti/main.c"
click node_irq "https://github.com/ch-2020-hc/stm32f446re-baremetal/blob/main/apps/00_blink_exti/main.c"
click node_rcc "https://github.com/ch-2020-hc/stm32f446re-baremetal/blob/main/drivers/src/rcc.c"
click node_gpio "https://github.com/ch-2020-hc/stm32f446re-baremetal/blob/main/drivers/src/gpio.c"
click node_exti "https://github.com/ch-2020-hc/stm32f446re-baremetal/blob/main/drivers/src/exti.c"
click node_syscfg "https://github.com/ch-2020-hc/stm32f446re-baremetal/blob/main/drivers/include/syscfg.h"
click node_exti_regs "https://github.com/ch-2020-hc/stm32f446re-baremetal/blob/main/drivers/include/exti.h"
click node_cmsis_device "https://github.com/ch-2020-hc/stm32f446re-baremetal/blob/main/cmsis/stm32f446re.h"
click node_cmsis_core "https://github.com/ch-2020-hc/stm32f446re-baremetal/tree/main/cmsis"

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_memory,node_button toneBlue
class node_app,node_irq toneAmber
class node_rcc,node_gpio,node_exti,node_syscfg,node_exti_regs toneMint
class node_cmsis_device,node_cmsis_core toneRose
class node_led toneIndigo
```

## Components

### Boot and Memory

- [Reset Startup](https://github.com/ch-2020-hc/stm32f446re-baremetal/blob/main/startup/startup.s): `startup/startup.s`
- [Flash and RAM Layout](https://github.com/ch-2020-hc/stm32f446re-baremetal/blob/main/ld/stm32f446re.ld): `ld/stm32f446re.ld`

### Stage 0 Firmware

- [Blink EXTI App](https://github.com/ch-2020-hc/stm32f446re-baremetal/blob/main/apps/00_blink_exti/main.c): `apps/00_blink_exti/main.c`
- [EXTI Handler](https://github.com/ch-2020-hc/stm32f446re-baremetal/blob/main/apps/00_blink_exti/main.c): `apps/00_blink_exti/main.c`

### Peripheral Drivers

- [Clock Setup](https://github.com/ch-2020-hc/stm32f446re-baremetal/blob/main/drivers/src/rcc.c): `drivers/src/rcc.c`
- [GPIO Driver](https://github.com/ch-2020-hc/stm32f446re-baremetal/blob/main/drivers/src/gpio.c): `drivers/src/gpio.c`
- [EXTI Driver](https://github.com/ch-2020-hc/stm32f446re-baremetal/blob/main/drivers/src/exti.c): `drivers/src/exti.c`
- [SYSCFG Registers](https://github.com/ch-2020-hc/stm32f446re-baremetal/blob/main/drivers/include/syscfg.h): `drivers/include/syscfg.h`
- [EXTI Registers](https://github.com/ch-2020-hc/stm32f446re-baremetal/blob/main/drivers/include/exti.h): `drivers/include/exti.h`

### Platform Support

- [Device Definitions](https://github.com/ch-2020-hc/stm32f446re-baremetal/blob/main/cmsis/stm32f446re.h): `cmsis/stm32f446re.h`
- [CMSIS Core Support](https://github.com/ch-2020-hc/stm32f446re-baremetal/tree/main/cmsis): `cmsis`

### Other components

- **User Button**
- **LD2 LED**

## Connections

- Reset Startup → Flash and RAM Layout: uses layout (evidence: `README.md`)
- Reset Startup → Blink EXTI App: calls main (evidence: `README.md`)
- Blink EXTI App → Clock Setup: initializes clocks (evidence: `apps/00_blink_exti/main.c`)
- Blink EXTI App → GPIO Driver: initializes pins (evidence: `apps/00_blink_exti/main.c`)
- Blink EXTI App → EXTI Driver: initializes interrupt (evidence: `apps/00_blink_exti/main.c`)
- EXTI Driver → SYSCFG Registers: maps pin (evidence: `drivers/src/exti.c`)
- EXTI Driver → EXTI Registers: configures registers (evidence: `drivers/src/exti.c`)
- EXTI Driver → Device Definitions: enables IRQ (evidence: `drivers/src/exti.c`)
- Device Definitions → CMSIS Core Support: includes core (evidence: `cmsis/stm32f446re.h`)
- User Button → EXTI Driver: triggers interrupt (evidence: `README.md`)
- EXTI Handler → Blink EXTI App: sets flag (evidence: `apps/00_blink_exti/main.c`)
- Blink EXTI App → GPIO Driver: toggles output (evidence: `apps/00_blink_exti/main.c`)
- GPIO Driver → LD2 LED: drives (evidence: `README.md`)
