# exploiitm/mspm0l2228-hal architecture

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

- Interactive diagram: https://gitdiagram.com/exploiitm/mspm0l2228-hal
- Repository: https://github.com/exploiitm/mspm0l2228-hal

## Overview

This repository is a no_std Rust hardware abstraction layer for the TI MSPM0L2228, paired with its peripheral-access crate (PAC). The user-facing workflow is firmware code using HAL drivers for peripherals such as I2C, AES, DMA, GPIO, flash, UART, MPU, and TRNG; those drivers configure and operate device registers through the PAC. The README describes flashing a LaunchPad LED example, but the supplied tree does not include that example. Relationships are limited to those visible in excerpts or documented by the README; several PAC capabilities are represented at subsystem level because their implementation was not sampled.

Main entry points: [`pac/src/lib.rs`](https://github.com/exploiitm/mspm0l2228-hal/blob/main/pac/src/lib.rs) (PAC API), [`hal/src/lib.rs`](https://github.com/exploiitm/mspm0l2228-hal/blob/main/hal/src/lib.rs) (HAL API), [`hal/src/i2c/controller.rs`](https://github.com/exploiitm/mspm0l2228-hal/blob/main/hal/src/i2c/controller.rs) (I2C drivers), [`hal/src/aes/mod.rs`](https://github.com/exploiitm/mspm0l2228-hal/blob/main/hal/src/aes/mod.rs) (AES modes)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_hal["HAL drivers"]
  node_hal_api["HAL API<br/>[lib.rs]"]
  node_gpio["GPIO<br/>[gpio.rs]"]
  node_i2c["I2C drivers<br/>[controller.rs]"]
  node_i2c_support["I2C support"]
  node_uart["UART<br/>[mod.rs]"]
  node_dma["DMA<br/>[mod.rs]"]
  node_flash["Flash<br/>[mod.rs]"]
end

subgraph group_security["Security and memory"]
  node_aes["AES modes<br/>[mod.rs]"]
  node_aes_cbc["AES CBC<br/>[cbc.rs]"]
  node_aes_ecb["AES ECB<br/>[ecb.rs]"]
  node_mpu["MPU<br/>[mod.rs]"]
  node_trng["TRNG<br/>[trng.rs]"]
end

subgraph group_pac["Peripheral access"]
  node_pac_api["PAC API<br/>[lib.rs]"]
  node_pac_generic["Register primitives<br/>[generic.rs]"]
  node_pac_aes["AES registers<br/>[aesadv.rs]"]
  node_pac_aes_ctrl["AES control fields<br/>[aesadv_ctrl.rs]"]
  node_pac_dma["DMA registers<br/>[dma.rs]"]
end

subgraph group_pac_io["PAC I/O blocks"]
  node_pac_i2c["I2C registers<br/>[i2c0_controller.rs]"]
  node_pac_gpioa["GPIO A registers<br/>[gpioa.rs]"]
  node_pac_gpiob["GPIO B registers<br/>[gpiob.rs]"]
  node_pac_gpioc["GPIO C registers<br/>[gpioc.rs]"]
  node_pac_flash["Flash registers<br/>[flashctl.rs]"]
  node_pac_sysctl["System control"]
  node_pac_uart0["UART 0 registers<br/>[uart0.rs]"]
  node_pac_uart1["UART 1 registers<br/>[uart1.rs]"]
  node_pac_other["Other peripherals"]
end

node_firmware(("Firmware application"))

node_firmware -->|"uses"| node_hal_api
node_hal_api -->|"exposes"| node_gpio
node_hal_api -->|"exposes"| node_i2c
node_hal_api -->|"exposes"| node_uart
node_hal_api -->|"exposes"| node_dma
node_hal_api -->|"exposes"| node_flash
node_hal_api -->|"exposes"| node_aes
node_hal_api -->|"exposes"| node_mpu
node_hal_api -->|"exposes"| node_trng
node_i2c -->|"uses"| node_i2c_support
node_aes -->|"uses"| node_aes_cbc
node_aes -->|"uses"| node_aes_ecb
node_aes_cbc -->|"uses"| node_dma
node_aes_ecb -->|"uses"| node_dma
node_pac_api -->|"uses"| node_pac_generic
node_pac_api -->|"exports"| node_pac_aes
node_pac_api -->|"exports"| node_pac_dma
node_pac_api -->|"exports"| node_pac_i2c
node_pac_api -->|"exports"| node_pac_gpioa
node_pac_api -->|"exports"| node_pac_gpiob
node_pac_api -->|"exports"| node_pac_gpioc
node_pac_api -->|"exports"| node_pac_flash
node_pac_api -->|"exports"| node_pac_sysctl
node_pac_api -->|"exports"| node_pac_uart0
node_pac_api -->|"exports"| node_pac_uart1
node_pac_api -->|"exports"| node_pac_other
node_i2c -->|"configures"| node_pac_i2c
node_i2c -->|"configures"| node_pac_sysctl
node_dma -->|"configures"| node_pac_dma
node_aes -->|"configures"| node_pac_aes
node_pac_aes -->|"exposes"| node_pac_aes_ctrl

click node_hal_api "https://github.com/exploiitm/mspm0l2228-hal/blob/main/hal/src/lib.rs"
click node_gpio "https://github.com/exploiitm/mspm0l2228-hal/blob/main/hal/src/gpio.rs"
click node_i2c "https://github.com/exploiitm/mspm0l2228-hal/blob/main/hal/src/i2c/controller.rs"
click node_i2c_support "https://github.com/exploiitm/mspm0l2228-hal/tree/main/hal/src/i2c"
click node_uart "https://github.com/exploiitm/mspm0l2228-hal/blob/main/hal/src/uart/mod.rs"
click node_dma "https://github.com/exploiitm/mspm0l2228-hal/blob/main/hal/src/dma/mod.rs"
click node_flash "https://github.com/exploiitm/mspm0l2228-hal/blob/main/hal/src/flash/mod.rs"
click node_aes "https://github.com/exploiitm/mspm0l2228-hal/blob/main/hal/src/aes/mod.rs"
click node_aes_cbc "https://github.com/exploiitm/mspm0l2228-hal/blob/main/hal/src/aes/cbc.rs"
click node_aes_ecb "https://github.com/exploiitm/mspm0l2228-hal/blob/main/hal/src/aes/ecb.rs"
click node_mpu "https://github.com/exploiitm/mspm0l2228-hal/blob/main/hal/src/mpu/mod.rs"
click node_trng "https://github.com/exploiitm/mspm0l2228-hal/blob/main/hal/src/trng.rs"
click node_pac_api "https://github.com/exploiitm/mspm0l2228-hal/blob/main/pac/src/lib.rs"
click node_pac_generic "https://github.com/exploiitm/mspm0l2228-hal/blob/main/pac/src/generic.rs"
click node_pac_aes "https://github.com/exploiitm/mspm0l2228-hal/blob/main/pac/src/aesadv.rs"
click node_pac_aes_ctrl "https://github.com/exploiitm/mspm0l2228-hal/blob/main/pac/src/aesadv/aesadv_ctrl.rs"
click node_pac_dma "https://github.com/exploiitm/mspm0l2228-hal/blob/main/pac/src/dma.rs"
click node_pac_i2c "https://github.com/exploiitm/mspm0l2228-hal/blob/main/pac/src/i2c0/i2c0_controller.rs"
click node_pac_gpioa "https://github.com/exploiitm/mspm0l2228-hal/blob/main/pac/src/gpioa.rs"
click node_pac_gpiob "https://github.com/exploiitm/mspm0l2228-hal/blob/main/pac/src/gpiob.rs"
click node_pac_gpioc "https://github.com/exploiitm/mspm0l2228-hal/blob/main/pac/src/gpioc.rs"
click node_pac_flash "https://github.com/exploiitm/mspm0l2228-hal/blob/main/pac/src/flashctl.rs"
click node_pac_sysctl "https://github.com/exploiitm/mspm0l2228-hal/blob/main/pac/src/sysctl/sysctl_genclkcfg.rs"
click node_pac_uart0 "https://github.com/exploiitm/mspm0l2228-hal/blob/main/pac/src/uart0.rs"
click node_pac_uart1 "https://github.com/exploiitm/mspm0l2228-hal/blob/main/pac/src/uart1.rs"
click node_pac_other "https://github.com/exploiitm/mspm0l2228-hal/tree/main/pac/src"

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_hal_api,node_gpio,node_i2c,node_i2c_support,node_uart,node_dma,node_flash toneBlue
class node_aes,node_aes_cbc,node_aes_ecb,node_mpu,node_trng toneAmber
class node_pac_api,node_pac_generic,node_pac_aes,node_pac_aes_ctrl,node_pac_dma toneMint
class node_pac_i2c,node_pac_gpioa,node_pac_gpiob,node_pac_gpioc,node_pac_flash,node_pac_sysctl,node_pac_uart0,node_pac_uart1,node_pac_other toneRose
class node_firmware toneIndigo
```

## Components

### HAL drivers

- [HAL API](https://github.com/exploiitm/mspm0l2228-hal/blob/main/hal/src/lib.rs): `hal/src/lib.rs`
- [GPIO](https://github.com/exploiitm/mspm0l2228-hal/blob/main/hal/src/gpio.rs): `hal/src/gpio.rs`
- [I2C drivers](https://github.com/exploiitm/mspm0l2228-hal/blob/main/hal/src/i2c/controller.rs): `hal/src/i2c/controller.rs`
- [I2C support](https://github.com/exploiitm/mspm0l2228-hal/tree/main/hal/src/i2c): `hal/src/i2c`
- [UART](https://github.com/exploiitm/mspm0l2228-hal/blob/main/hal/src/uart/mod.rs): `hal/src/uart/mod.rs`
- [DMA](https://github.com/exploiitm/mspm0l2228-hal/blob/main/hal/src/dma/mod.rs): `hal/src/dma/mod.rs`
- [Flash](https://github.com/exploiitm/mspm0l2228-hal/blob/main/hal/src/flash/mod.rs): `hal/src/flash/mod.rs`

### Security and memory

- [AES modes](https://github.com/exploiitm/mspm0l2228-hal/blob/main/hal/src/aes/mod.rs): `hal/src/aes/mod.rs`
- [AES CBC](https://github.com/exploiitm/mspm0l2228-hal/blob/main/hal/src/aes/cbc.rs): `hal/src/aes/cbc.rs`
- [AES ECB](https://github.com/exploiitm/mspm0l2228-hal/blob/main/hal/src/aes/ecb.rs): `hal/src/aes/ecb.rs`
- [MPU](https://github.com/exploiitm/mspm0l2228-hal/blob/main/hal/src/mpu/mod.rs): `hal/src/mpu/mod.rs`
- [TRNG](https://github.com/exploiitm/mspm0l2228-hal/blob/main/hal/src/trng.rs): `hal/src/trng.rs`

### Peripheral access

- [PAC API](https://github.com/exploiitm/mspm0l2228-hal/blob/main/pac/src/lib.rs): `pac/src/lib.rs`
- [Register primitives](https://github.com/exploiitm/mspm0l2228-hal/blob/main/pac/src/generic.rs): `pac/src/generic.rs`
- [AES registers](https://github.com/exploiitm/mspm0l2228-hal/blob/main/pac/src/aesadv.rs): `pac/src/aesadv.rs`
- [AES control fields](https://github.com/exploiitm/mspm0l2228-hal/blob/main/pac/src/aesadv/aesadv_ctrl.rs): `pac/src/aesadv/aesadv_ctrl.rs`
- [DMA registers](https://github.com/exploiitm/mspm0l2228-hal/blob/main/pac/src/dma.rs): `pac/src/dma.rs`

### PAC I/O blocks

- [I2C registers](https://github.com/exploiitm/mspm0l2228-hal/blob/main/pac/src/i2c0/i2c0_controller.rs): `pac/src/i2c0/i2c0_controller.rs`
- [GPIO A registers](https://github.com/exploiitm/mspm0l2228-hal/blob/main/pac/src/gpioa.rs): `pac/src/gpioa.rs`
- [GPIO B registers](https://github.com/exploiitm/mspm0l2228-hal/blob/main/pac/src/gpiob.rs): `pac/src/gpiob.rs`
- [GPIO C registers](https://github.com/exploiitm/mspm0l2228-hal/blob/main/pac/src/gpioc.rs): `pac/src/gpioc.rs`
- [Flash registers](https://github.com/exploiitm/mspm0l2228-hal/blob/main/pac/src/flashctl.rs): `pac/src/flashctl.rs`
- [System control](https://github.com/exploiitm/mspm0l2228-hal/blob/main/pac/src/sysctl/sysctl_genclkcfg.rs): `pac/src/sysctl/sysctl_genclkcfg.rs`
- [UART 0 registers](https://github.com/exploiitm/mspm0l2228-hal/blob/main/pac/src/uart0.rs): `pac/src/uart0.rs`
- [UART 1 registers](https://github.com/exploiitm/mspm0l2228-hal/blob/main/pac/src/uart1.rs): `pac/src/uart1.rs`
- [Other peripherals](https://github.com/exploiitm/mspm0l2228-hal/tree/main/pac/src): `pac/src`

### Other components

- **Firmware application**

## Connections

- Firmware application → HAL API: uses
- HAL API → GPIO: exposes (evidence: `hal/src/lib.rs`)
- HAL API → I2C drivers: exposes (evidence: `hal/src/lib.rs`)
- HAL API → UART: exposes (evidence: `hal/src/lib.rs`)
- HAL API → DMA: exposes (evidence: `hal/src/lib.rs`)
- HAL API → Flash: exposes (evidence: `hal/src/lib.rs`)
- HAL API → AES modes: exposes (evidence: `hal/src/lib.rs`)
- HAL API → MPU: exposes (evidence: `hal/src/lib.rs`)
- HAL API → TRNG: exposes (evidence: `hal/src/lib.rs`)
- I2C drivers → I2C support: uses (evidence: `hal/src/i2c/controller.rs`)
- AES modes → AES CBC: uses (evidence: `hal/src/aes/mod.rs`)
- AES modes → AES ECB: uses (evidence: `hal/src/aes/mod.rs`)
- AES CBC → DMA: uses (evidence: `hal/src/aes/cbc.rs`)
- AES ECB → DMA: uses (evidence: `hal/src/aes/ecb.rs`)
- PAC API → Register primitives: uses (evidence: `pac/src/lib.rs`)
- PAC API → AES registers: exports (evidence: `pac/src/lib.rs`)
- PAC API → DMA registers: exports (evidence: `pac/src/lib.rs`)
- PAC API → I2C registers: exports (evidence: `pac/src/lib.rs`)
- PAC API → GPIO A registers: exports (evidence: `pac/src/lib.rs`)
- PAC API → GPIO B registers: exports (evidence: `pac/src/lib.rs`)
- PAC API → GPIO C registers: exports (evidence: `pac/src/lib.rs`)
- PAC API → Flash registers: exports (evidence: `pac/src/lib.rs`)
- PAC API → System control: exports (evidence: `pac/src/lib.rs`)
- PAC API → UART 0 registers: exports (evidence: `pac/src/lib.rs`)
- PAC API → UART 1 registers: exports (evidence: `pac/src/lib.rs`)
- PAC API → Other peripherals: exports (evidence: `pac/src/lib.rs`)
- I2C drivers → I2C registers: configures (evidence: `hal/src/i2c/controller.rs`)
- I2C drivers → System control: configures (evidence: `hal/src/i2c/controller.rs`)
- DMA → DMA registers: configures (evidence: `hal/src/dma/mod.rs`)
- AES modes → AES registers: configures (evidence: `hal/src/aes/mod.rs`)
- AES registers → AES control fields: exposes (evidence: `pac/src/aesadv.rs`)
