# kentlouisetonino/hw-blinking-led architecture

> Architecture diagram of the GitHub repository kentlouisetonino/hw-blinking-led, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-31). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/kentlouisetonino/hw-blinking-led
- Repository: https://github.com/kentlouisetonino/hw-blinking-led

## Overview

##### Project type and purpose
- This is an embedded firmware project for a “blinking LED” demo on an ATmega328P microcontroller.
- It uses C (avr-gcc) and AVR libc instead of the Arduino IDE.

##### File structure
- Top-level:
- Makefile – orchestrates build and upload
- README.md – overview, setup and system design
- src/ – firmware source (main.c) and compiled artifacts (main.o, main.hex, etc.)
- No frontend/backend split—this is a single embedded binary project.
- Key build tools invoked: gcc-avr, binutils-avr, avr-libc, avrdude.

##### README for additional insights
- System Design section includes two images:
- “Makefile Process” – build and upload pipeline
- “Breadboarding” – hardware layout (ATmega328P, LED, resistor, breadboard)
- Local development: toolchain install instructions and usage of `make build`.

a. Main components
- Development Host (Linux PC)
- Toolchain & Build System (Makefile, gcc-avr, avr-libc, binutils-avr)
- Programming Utility (avrdude)
- Target Hardware (Arduino UNO R3 / ATmega328P on breadboard)
- Physical LED circuit (LED + resistor wired to microcontroller I/O pin)
b. Relationships & interactions
- Host invokes Makefile
- Makefile calls gcc-avr → compiles main.c to main.o
- binutils-avr (ld, objcopy) → links object, produces main.hex
- avrdude uploads main.hex to ATmega328P via USB
- ATmega328P executes firmware, toggles I/O pin driving LED
c. Architectural patterns / design principles
- Cross-compilation pipeline
- Clear separation between build stages (compile/link/flash)
- Minimal runtime (no OS, bare-metal loop)
d. Key technologies / frameworks
- avr-gcc (C compiler)
- avr-libc (C standard library for AVR)
- binutils-avr (assembler/linker)
- avrdude (flash programmer)
- Makefile (build orchestration)

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Host PC (Linux Ubuntu 22.04)"
        MF["Makefile"]:::software
        GCC["avr-gcc"]:::software
        BINUTILS["binutils-avr"]:::software
        LIBC["avr-libc"]:::software
    end

    source["src/main.c"]:::artifacts
    obj["src/main.o"]:::artifacts
    hex["src/main.hex"]:::artifacts
    bin["src/main.bin"]:::artifacts

    AVRDUDE["avrdude"]:::software

    subgraph "Target Hardware"
        MCU["ATmega328P"]:::hardware
        LED["LED + Resistor Circuit (PD5)"]:::hardware
    end

    subgraph "Documentation"
        Readme["README.md"]:::docs
        DS1["datasheet-ATmega328P.pdf"]:::docs
        DS2["datasheet-Arduino-Uno-R3.pdf"]:::docs
        DocsNotes["computing.md"]:::docs
    end

    MF -->|"calls avr-gcc"| GCC
    GCC -->|"compile src/main.c → src/main.o"| obj
    obj -->|"link + objcopy .o → .hex"| hex
    LIBC -->|"provides C library"| BINUTILS
    BINUTILS -->|"produces .hex"| hex
    hex -->|"convert .hex → .bin"| bin
    hex --> AVRDUDE
    AVRDUDE -->|"flash via USB"| MCU
    MCU -->|"toggle PD5"| LED

    click MF "https://github.com/kentlouisetonino/hw-blinking-led/tree/develop/Makefile"
    click source "https://github.com/kentlouisetonino/hw-blinking-led/blob/develop/src/main.c"
    click obj "https://github.com/kentlouisetonino/hw-blinking-led/blob/develop/src/main.o"
    click hex "https://github.com/kentlouisetonino/hw-blinking-led/blob/develop/src/main.hex"
    click bin "https://github.com/kentlouisetonino/hw-blinking-led/blob/develop/src/main.bin"
    click Readme "https://github.com/kentlouisetonino/hw-blinking-led/blob/develop/README.md"
    click DS1 "https://github.com/kentlouisetonino/hw-blinking-led/blob/develop/docs/datasheet-ATmega328P.pdf"
    click DS2 "https://github.com/kentlouisetonino/hw-blinking-led/blob/develop/docs/datasheet-Arduino-Uno-R3.pdf"
    click DocsNotes "https://github.com/kentlouisetonino/hw-blinking-led/blob/develop/docs/computing.md"

    classDef software fill:#cfe2f3,stroke:#0366d6,color:#0366d6;
    classDef artifacts fill:#e2e3e5,stroke:#6c757d,color:#6c757d;
    classDef hardware fill:#d9ead3,stroke:#54a24b,color:#38761d;
    classDef docs fill:#fff2cc,stroke:#bf9000,color:#bf9000;
```
