# madhumitha7478/crc_storage_overhead_final_project architecture

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

- Interactive diagram: https://gitdiagram.com/madhumitha7478/crc_storage_overhead_final_project
- Repository: https://github.com/madhumitha7478/crc_storage_overhead_final_project

## Overview

This S32K144 firmware configures EEPROM blocks, totals data and CRC overhead, validates ranges and the 512-byte limit, then calculates and appends a CRC-8 before page/bank-aware LPI2C writes. It reports calculations and per-block results over UART. The application stages are implemented together in `src/main.c`; board configuration and SDK drivers provide peripheral setup and transport. EEPROM behavior and capacity are documented in the README. SDK internals beyond the shown clock excerpt were not inspected, so their internal interactions are omitted.

Main entry points: [`src/main.c`](https://github.com/madhumitha7478/crc_storage_overhead_final_project/blob/main/src/main.c) (Block data config), [`SDK/platform/drivers/src/lpi2c/lpi2c_driver.c`](https://github.com/madhumitha7478/crc_storage_overhead_final_project/blob/main/SDK/platform/drivers/src/lpi2c/lpi2c_driver.c) (LPI2C driver), [`SDK/platform/drivers/src/lpuart/lpuart_driver.c`](https://github.com/madhumitha7478/crc_storage_overhead_final_project/blob/main/SDK/platform/drivers/src/lpuart/lpuart_driver.c) (LPUART driver), [`board/clock_config.c`](https://github.com/madhumitha7478/crc_storage_overhead_final_project/blob/main/board/clock_config.c) (Clock config)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["EEPROM application"]
  node_blocks["Block data config<br/>[main.c]"]
  node_storage["Storage validation<br/>[main.c]"]
  node_crc["CRC-8 calculator<br/>[main.c]"]
  node_blockwrite["Block writer<br/>[main.c]"]
  node_chunkwrite["Page write splitter<br/>[main.c]"]
  node_report["UART reporting<br/>[main.c]"]
end

subgraph group_board["Board setup"]
  node_clockconfig["Clock config<br/>[clock_config.c]"]
  node_pinconfig["Pin mux config<br/>[pin_mux.c]"]
  node_i2cconfig["LPI2C config"]
  node_uartconfig["LPUART config"]
end

subgraph group_sdk["SDK drivers"]
  node_clockdriver["Clock driver<br/>[clock_S32K1xx.c]"]
  node_pinsdriver["Pins driver<br/>[pins_driver.c]"]
  node_i2cdriver["LPI2C driver<br/>[lpi2c_driver.c]"]
  node_uartdriver["LPUART driver<br/>[lpuart_driver.c]"]
end

subgraph group_hardware["External hardware"]
  node_eeprom[("M24C04 EEPROM")]
  node_terminal(("UART terminal"))
end

node_operator(("Firmware operator"))

node_operator -->|"configures"| node_blocks
node_blocks -->|"validates"| node_storage
node_storage -->|"reports totals"| node_report
node_storage -->|"permits writes"| node_blockwrite
node_blockwrite -->|"calculates CRC"| node_crc
node_blockwrite -->|"writes buffer"| node_chunkwrite
node_chunkwrite -->|"sends chunks"| node_i2cdriver
node_i2cdriver -->|"writes over I2C"| node_eeprom
node_blockwrite -->|"reports status"| node_report
node_report -->|"sends text"| node_uartdriver
node_uartdriver -->|"outputs UART"| node_terminal
node_clockconfig -.->|"initializes"| node_clockdriver
node_pinconfig -.->|"provides pin setup"| node_pinsdriver
node_i2cconfig -.->|"configures"| node_i2cdriver
node_uartconfig -.->|"configures"| node_uartdriver
node_blocks -->|"uses setup"| node_clockconfig
node_blocks -->|"uses setup"| node_pinconfig
node_blocks -->|"uses config"| node_i2cconfig
node_blocks -->|"uses config"| node_uartconfig

click node_blocks "https://github.com/madhumitha7478/crc_storage_overhead_final_project/blob/main/src/main.c"
click node_storage "https://github.com/madhumitha7478/crc_storage_overhead_final_project/blob/main/src/main.c"
click node_crc "https://github.com/madhumitha7478/crc_storage_overhead_final_project/blob/main/src/main.c"
click node_blockwrite "https://github.com/madhumitha7478/crc_storage_overhead_final_project/blob/main/src/main.c"
click node_chunkwrite "https://github.com/madhumitha7478/crc_storage_overhead_final_project/blob/main/src/main.c"
click node_report "https://github.com/madhumitha7478/crc_storage_overhead_final_project/blob/main/src/main.c"
click node_clockconfig "https://github.com/madhumitha7478/crc_storage_overhead_final_project/blob/main/board/clock_config.c"
click node_pinconfig "https://github.com/madhumitha7478/crc_storage_overhead_final_project/blob/main/board/pin_mux.c"
click node_i2cconfig "https://github.com/madhumitha7478/crc_storage_overhead_final_project/blob/main/board/peripherals_lpi2c_config_1.c"
click node_uartconfig "https://github.com/madhumitha7478/crc_storage_overhead_final_project/blob/main/board/peripherals_lpuart_1.c"
click node_clockdriver "https://github.com/madhumitha7478/crc_storage_overhead_final_project/blob/main/SDK/platform/drivers/src/clock/S32K1xx/clock_S32K1xx.c"
click node_pinsdriver "https://github.com/madhumitha7478/crc_storage_overhead_final_project/blob/main/SDK/platform/drivers/src/pins/pins_driver.c"
click node_i2cdriver "https://github.com/madhumitha7478/crc_storage_overhead_final_project/blob/main/SDK/platform/drivers/src/lpi2c/lpi2c_driver.c"
click node_uartdriver "https://github.com/madhumitha7478/crc_storage_overhead_final_project/blob/main/SDK/platform/drivers/src/lpuart/lpuart_driver.c"

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_blocks,node_storage,node_crc,node_blockwrite,node_chunkwrite,node_report toneBlue
class node_clockconfig,node_pinconfig,node_i2cconfig,node_uartconfig toneAmber
class node_clockdriver,node_pinsdriver,node_i2cdriver,node_uartdriver toneMint
class node_eeprom,node_terminal toneRose
class node_operator toneIndigo
```

## Components

### EEPROM application

- [Block data config](https://github.com/madhumitha7478/crc_storage_overhead_final_project/blob/main/src/main.c): `src/main.c`
- [Storage validation](https://github.com/madhumitha7478/crc_storage_overhead_final_project/blob/main/src/main.c): `src/main.c`
- [CRC-8 calculator](https://github.com/madhumitha7478/crc_storage_overhead_final_project/blob/main/src/main.c): `src/main.c`
- [Block writer](https://github.com/madhumitha7478/crc_storage_overhead_final_project/blob/main/src/main.c): `src/main.c`
- [Page write splitter](https://github.com/madhumitha7478/crc_storage_overhead_final_project/blob/main/src/main.c): `src/main.c`
- [UART reporting](https://github.com/madhumitha7478/crc_storage_overhead_final_project/blob/main/src/main.c): `src/main.c`

### Board setup

- [Clock config](https://github.com/madhumitha7478/crc_storage_overhead_final_project/blob/main/board/clock_config.c): `board/clock_config.c`
- [Pin mux config](https://github.com/madhumitha7478/crc_storage_overhead_final_project/blob/main/board/pin_mux.c): `board/pin_mux.c`
- [LPI2C config](https://github.com/madhumitha7478/crc_storage_overhead_final_project/blob/main/board/peripherals_lpi2c_config_1.c): `board/peripherals_lpi2c_config_1.c`
- [LPUART config](https://github.com/madhumitha7478/crc_storage_overhead_final_project/blob/main/board/peripherals_lpuart_1.c): `board/peripherals_lpuart_1.c`

### SDK drivers

- [Clock driver](https://github.com/madhumitha7478/crc_storage_overhead_final_project/blob/main/SDK/platform/drivers/src/clock/S32K1xx/clock_S32K1xx.c): `SDK/platform/drivers/src/clock/S32K1xx/clock_S32K1xx.c`
- [Pins driver](https://github.com/madhumitha7478/crc_storage_overhead_final_project/blob/main/SDK/platform/drivers/src/pins/pins_driver.c): `SDK/platform/drivers/src/pins/pins_driver.c`
- [LPI2C driver](https://github.com/madhumitha7478/crc_storage_overhead_final_project/blob/main/SDK/platform/drivers/src/lpi2c/lpi2c_driver.c): `SDK/platform/drivers/src/lpi2c/lpi2c_driver.c`
- [LPUART driver](https://github.com/madhumitha7478/crc_storage_overhead_final_project/blob/main/SDK/platform/drivers/src/lpuart/lpuart_driver.c): `SDK/platform/drivers/src/lpuart/lpuart_driver.c`

### External hardware

- **M24C04 EEPROM**
- **UART terminal**

### Other components

- **Firmware operator**

## Connections

- Firmware operator → Block data config: configures
- Block data config → Storage validation: validates (evidence: `src/main.c`)
- Storage validation → UART reporting: reports totals (evidence: `src/main.c`)
- Storage validation → Block writer: permits writes (evidence: `src/main.c`)
- Block writer → CRC-8 calculator: calculates CRC (evidence: `src/main.c`)
- Block writer → Page write splitter: writes buffer (evidence: `src/main.c`)
- Page write splitter → LPI2C driver: sends chunks (evidence: `src/main.c`)
- LPI2C driver → M24C04 EEPROM: writes over I2C
- Block writer → UART reporting: reports status (evidence: `src/main.c`)
- UART reporting → LPUART driver: sends text (evidence: `src/main.c`)
- LPUART driver → UART terminal: outputs UART
- Clock config → Clock driver: initializes
- Pin mux config → Pins driver: provides pin setup
- LPI2C config → LPI2C driver: configures
- LPUART config → LPUART driver: configures
- Block data config → Clock config: uses setup (evidence: `src/main.c`)
- Block data config → Pin mux config: uses setup (evidence: `src/main.c`)
- Block data config → LPI2C config: uses config (evidence: `src/main.c`)
- Block data config → LPUART config: uses config (evidence: `src/main.c`)
