# Overview of Bare-Metal Rust --- ## A Layered Approach When building bare-metal Systems in Rust, we use Rust crates to help us build a modular system. The elements in our system are: * The program you are writing * The MCU are running on * The PCB (or Board) your MCU is on * The external devices connected to your MCU --- ## The Layers To support these elements, we (usually) have these layers. * Application * Board Support * External Drivers (e.g. SPI LCD Driver) * Hardware Abstraction Layer Traits * MCU Hardware Abstraction Layer Implementation * MCU Peripheral Access Crate * Core Peripherals * Core Runtime ---
%3
app
Application
(my_application)
bsc
Board Support
(nrf52840_dk)
app->bsc
lcd_driver
SPI LCD Driver
(ssd1306)
app->lcd_driver
rt
Core Runtime
(cortex_m_rt)
app->rt
hal
MCU HAL Implementation
(nrf52480_hal)
bsc->hal
hal_traits
HAL Traits
(embedded_hal)
bsc->hal_traits
pac
MCU PAC
(nrf52840-pac)
hal->pac
hal->hal_traits
implements
pac->rt
cp
Core Peripherals
(cortex_m)
pac->cp
lcd_driver->hal_traits
rt->cp
--- ## Don't worry There's a lot here. We're going to take it step by step, starting at the bottom.