# tomasdileo/stm32-dev-env architecture

> Architecture diagram of the GitHub repository tomasdileo/stm32-dev-env, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-10-25). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/tomasdileo/stm32-dev-env
- Repository: https://github.com/tomasdileo/stm32-dev-env

## Overview

##### Project type and purpose
- This is a bare-metal embedded firmware template targeting the STM32F103C6Tx MCU, built with STM32CubeIDE and STM32Cube HAL (FW_F1 V1.8.6).
- Provides startup/system code, CMSIS and HAL layers, plus three user modules: LCD driver (LCD_NC), keypad scanner, and CLOCK (date/time) helper.

##### File structure
- Top-level files: project settings (`.ioc`, `.ld`, Eclipse `.settings`), `README.md`, simulation project file, `imagenes/` for docs.
- Core/Startup:
- `startup_stm32f103c6tx.s` (vector table & reset handler)
- `system_stm32f1xx.c` (clock configuration)
- Core/Inc & Core/Src: user modules (`CLOCK.c/.h`, `KEYPAD.c/.h`, `LCD_NC.c/.h`), `main.c`, interrupt handlers, HAL MSP.
- Drivers/CMSIS: ARM core headers and device definitions.
- Drivers/STM32F1xx_HAL_Driver: HAL peripheral drivers (GPIO, EXTI, RTC, ADC, DMA, etc.).

##### README for insights
- Confirms it’s a classroom template.
- Pin-out and initialization lives in `main.c`.
- Emphasizes two helpers: LCD_NC (LCD API) and CLOCK.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Startup Layer
    subgraph "Startup Layer"
        Startup["MCU Startup\n(vector table & reset)"]:::firmware
    end

    %% System Initialization
    subgraph "System Init"
        SysInit["System Init\n(clock config)"]:::firmware
    end

    %% CMSIS Layer
    subgraph "CMSIS Layer"
        CM1["core_cm3.h"]:::cmsis
        CM2["stm32f103x6.h"]:::cmsis
        CM3["system_stm32f1xx.h"]:::cmsis
    end

    %% HAL Layer
    subgraph "HAL Layer"
        HALInc["HAL Headers"]:::hal
        HALSrc["HAL Sources"]:::hal
        MSP["HAL MSP Init"]:::hal
    end

    %% Application Layer
    subgraph "Application Layer"
        Main["main.c\n(pin config & main loop)"]:::app
        IT["Interrupt Handlers"]:::app
        LCD["LCD_NC Driver"]:::app
        Keypad["Keypad Scanner"]:::app
        Clock["CLOCK Helper"]:::app
    end

    %% Hardware Peripherals
    subgraph "Hardware Peripherals"
        LCDHW["LCD Panel"]:::ext
        KeypadHW["4x4 Keypad"]:::ext
        RTCEXT["RTC Crystal"]:::ext
    end

    %% Connections
    Startup --> SysInit
    SysInit --> CM1
    SysInit --> CM2
    SysInit --> CM3
    CM1 --> HALInc
    CM2 --> HALInc
    CM3 --> HALInc
    HALInc --> HALSrc
    HALSrc --> MSP
    SysInit --> Main
    MSP --> Main
    Main -->|"GPIO_write"| LCD
    Main -->|"scan_init"| Keypad
    Main -->|"RTC_init"| Clock
    LCD -->|"data_bus"| LCDHW
    Keypad -->|"row/col_scan"| KeypadHW
    Clock -->|"RTC_read/write"| RTCEXT
    KeypadHW -->|"EXTI_interrupt"| IT
    IT -->|"callback"| Keypad

    %% Click Events
    click Startup "https://github.com/tomasdileo/stm32-dev-env/blob/main/Core/Startup/startup_stm32f103c6tx.s"
    click SysInit "https://github.com/tomasdileo/stm32-dev-env/blob/main/Core/Src/system_stm32f1xx.c"
    click Main "https://github.com/tomasdileo/stm32-dev-env/blob/main/Core/Src/main.c"
    click IT "https://github.com/tomasdileo/stm32-dev-env/blob/main/Core/Src/stm32f1xx_it.c"
    click MSP "https://github.com/tomasdileo/stm32-dev-env/blob/main/Core/Src/stm32f1xx_hal_msp.c"
    click LCD "https://github.com/tomasdileo/stm32-dev-env/blob/main/Core/Src/LCD_NC.c"
    click Keypad "https://github.com/tomasdileo/stm32-dev-env/blob/main/Core/Src/KEYPAD.c"
    click Clock "https://github.com/tomasdileo/stm32-dev-env/blob/main/Core/Src/CLOCK.c"
    click CM1 "https://github.com/tomasdileo/stm32-dev-env/blob/main/Drivers/CMSIS/Include/core_cm3.h"
    click CM2 "https://github.com/tomasdileo/stm32-dev-env/blob/main/Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103x6.h"
    click CM3 "https://github.com/tomasdileo/stm32-dev-env/blob/main/Drivers/CMSIS/Device/ST/STM32F1xx/Include/system_stm32f1xx.h"
    click HALInc "https://github.com/tomasdileo/stm32-dev-env/tree/main/Drivers/STM32F1xx_HAL_Driver/Inc/"
    click HALSrc "https://github.com/tomasdileo/stm32-dev-env/tree/main/Drivers/STM32F1xx_HAL_Driver/Src/"

    %% Styles
    classDef firmware fill:#cce5ff,stroke:#004085,color:#004085
    classDef cmsis fill:#b3e6b3,stroke:#0b6623,color:#0b6623
    classDef hal fill:#b3d9ff,stroke:#004080,color:#004080
    classDef app fill:#d4edda,stroke:#155724,color:#155724
    classDef ext fill:#ffe5b3,stroke:#665200,color:#665200
```
