Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
74 commits
Select commit Hold shift + click to select a range
fc835cb
ci(deps): bump actions/cache from 5 to 6
dependabot[bot] Jul 1, 2026
a9ce2cf
ci(deps): bump actions/checkout from 6 to 7
dependabot[bot] Jul 10, 2026
5a945cb
[create-pull-request] automated change
cfrantz Jul 14, 2026
ea2b607
target/ast10x0: add .ram_nc section for non-cached DMA buffers
rusty1968 Jul 14, 2026
c8205de
target/ast10x0: fix hardware test .bin resolution and sgpiom_smoke RA…
JesseMelon Jul 14, 2026
8c5d0a4
ast10x0 HACE peripheral
rusty1968 May 28, 2026
af1563b
ast10x0 : drain stale bootloader hash op
rusty1968 Jun 26, 2026
df5b8e7
ast10x0-hace: fix DMA safety violations
rusty1968 Jun 29, 2026
53c86c1
trace
rusty1968 Jun 30, 2026
bfa8926
ast10x0-hace: eliminate remaining panic_is_possible in digest/HMAC path
rusty1968 Jun 30, 2026
d3bfdd6
ast10x0-hace: fix HACE KAT stack overflow (HardFault)
rusty1968 Jun 30, 2026
eca544a
fixing format
rusty1968 Jul 14, 2026
6d3ba62
ast10x0-hace: fix AES crypto engine bugs
rusty1968 Jul 15, 2026
a40d059
ast10x0/hace: fix DMA cache coherency; decouple SCU from HACE ops
rusty1968 Jul 16, 2026
5f5783e
add spi2 master controller test. now it can get jedec id from flash #3
yvettewu1 Jun 18, 2026
f2cda8c
add bazel build for spi2
yvettewu1 Jun 8, 2026
e3346f9
fixed clipping issue and use gpio pac instead of using volatile regis…
yvettewu1 Jun 9, 2026
02d89f0
The SPIMonitor driver now supports basic functionalities.
yvettewu1 Jun 9, 2026
981d74b
add configuration of external-mux GPIOs and Implement policy locking
yvettewu1 Jun 10, 2026
f3ea573
add spimonitor test.
yvettewu1 Jun 10, 2026
4f7c9c1
Tested Spimonitor with Emulated BMC master for write protected region.
yvettewu1 Jun 11, 2026
a402f48
replaced the old demo-board GPIOM5/GPIOH2 pins with SGPIOM outputs 8/…
yvettewu1 Jun 11, 2026
4699848
Complete the AST1060 SPI-monitor handoff from the RoT to the external
yvettewu1 Jun 12, 2026
621955b
now we can see bmc spi and host spi on Master side. HOST spimonitor w…
yvettewu1 Jun 12, 2026
9d84f13
fixed SPIM1/2 CSNIN stuck low(asserted) problem by:
yvettewu1 Jun 15, 2026
4c96cbb
fixed clipping issues
yvettewu1 Jun 17, 2026
36a95f4
fixed merge clipping issue
yvettewu1 Jun 18, 2026
67907f9
board: rename monitor to spi_monitor
chrysh Jul 16, 2026
76ca3cb
spimonitor: prefix bare Monitor* names with SpiMonitor
chrysh Jul 16, 2026
5ef6ece
spimonitor: rustfmt import ordering after rename
chrysh Jul 21, 2026
b65d7bc
board: rustfmt import ordering in spi_monitor.rs
chrysh Jul 21, 2026
8cc91c1
fwmanager: Add BootControl trait and HAL adapter
chrysh Jul 16, 2026
c383a14
Update services/fwmanager/api/src/boot_control.rs
chrysh Jul 21, 2026
1430eb3
fwmanager: Strengthen BootControl error contract
chrysh Jul 21, 2026
06ab198
fwmanager: Move HalBootControl into hal-adapters crate
chrysh Jul 22, 2026
266cb8c
ast10x0: add I3C peripheral driver (port of aspeed-rust i3c)
stevenlee7189 Jun 3, 2026
06d51c6
ast10x0: stabilize I3C IRQ exchange test
stevenlee7189 Jun 3, 2026
abcc88e
ast10x0: clarify I3C IRQ payload logs
stevenlee7189 Jun 3, 2026
a084330
Pin I3C controller before IRQ init
stevenlee7189 Jun 4, 2026
08de34c
Encapsulate I3C controller internals
stevenlee7189 Jun 4, 2026
8d4b91b
Tighten I3C constants and timeout handling
stevenlee7189 Jun 4, 2026
7d8cffc
Address I3C review follow-ups
stevenlee7189 Jun 4, 2026
8ad1ca0
Rework I3C driver to runtime-bus model with register facade
stevenlee7189 Jun 4, 2026
fe88726
Move I3C register operations into the I3cRegisters facade
stevenlee7189 Jun 4, 2026
5e50441
Revert console backend try_lock change
stevenlee7189 Jun 4, 2026
3b994d2
Decouple the I3C ISR from thread-owned state
stevenlee7189 Jun 4, 2026
f676ab7
Fix format issue.
stevenlee7189 Jun 4, 2026
1a033e4
Propagate I3C timeouts and harden private transfers
stevenlee7189 Jun 9, 2026
698c0f9
i3c: fix build after pigweed roll and board descriptor change
stevenlee7189 Jun 9, 2026
6716f33
i3c: fix FIFO/bookkeeping bugs and close gaps vs vendor driver
stevenlee7189 Jun 12, 2026
e9552d3
i3c: add legacy I2C device support and length CCCs
stevenlee7189 Jun 13, 2026
65386c6
ast10x0/i3c: refine state tracking and harden error recovery
stevenlee7189 Jul 23, 2026
4110fd0
ast10x0/i3c: document why reset_ctrl runs unconditionally after enter…
stevenlee7189 Jul 24, 2026
c51f707
ast10x0/i3c: fix RAM region overflow into RAM_NC after merge
stevenlee7189 Jul 24, 2026
0994e9b
peripherals/gpio: port AST1060 GPIO driver from aspeed-rust
rusty1968 Jul 14, 2026
4f5ba4f
target/ast10x0/peripherals/gpio: add pinctrl and tests for gpio.
lxuxx Jul 16, 2026
2795c98
target/ast10x0: fix gpio test RAM size issue.
lxuxx Jul 16, 2026
d6fdd63
fix format issues.
lxuxx Jul 17, 2026
791f3b0
Fix conflict with latest main.
lxuxx Jul 17, 2026
609229f
hal: add a hal for accessing flash memories
cfrantz Jun 7, 2026
264213f
fwmanager: Add device-table schema; declare a mock board in target/mock
chrysh Jul 24, 2026
9a65fba
fwmanager: make DeviceConfig generic over the reset signal type
chrysh Jul 28, 2026
b51a4ee
fwmanager: document why the schema types are intentionally exhaustive
chrysh Jul 28, 2026
de0982c
fwmanager: encode boot-progress checkpointing in the device table
chrysh Jul 28, 2026
708c8f9
fwmanager: test validate()'s reject paths
chrysh Jul 28, 2026
8addc97
Fix to use direction to change open-drain output pins.
lxuxx Jul 25, 2026
902c5b7
add active low/high for gpio open-drain mode
lxuxx Jul 27, 2026
4b638c9
Read Data Value Register for input pins instead of Data Read Register
lxuxx Jul 29, 2026
4d56b5a
Add GPIOI loopback interrupt test for AST1060
lxuxx Jul 29, 2026
c8ebc09
Fix format issues.
lxuxx Jul 29, 2026
63f5207
Clean up GPIO test.
lxuxx Jul 30, 2026
0d5966a
fwmanager: Add BootMonitor capability and GpioBootMonitor adapter
chrysh Jul 24, 2026
a83afbc
fwmanager: Drop InReset; document the BootStatus subset contract
chrysh Jul 29, 2026
eac24ef
fwmanager: Borrow the GPIO port in GpioBootMonitor
chrysh Jul 29, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
name: Presubmit Checks
runs-on: openprot-ci-runner
steps:
- uses: actions/checkout@v6
- uses: actions/checkout@v7

- name: Setup Bazel
uses: bazel-contrib/setup-bazel@0.19.0
Expand All @@ -37,7 +37,7 @@ jobs:
needs: presubmit
runs-on: openprot-ci-runner
steps:
- uses: actions/checkout@v6
- uses: actions/checkout@v7

- name: Setup Bazel
uses: bazel-contrib/setup-bazel@0.19.0
Expand All @@ -56,7 +56,7 @@ jobs:
runs-on: openprot-ci-runner

steps:
- uses: actions/checkout@v6
- uses: actions/checkout@v7

- name: Setup Bazel
uses: bazel-contrib/setup-bazel@0.19.0
Expand All @@ -74,15 +74,15 @@ jobs:
needs: presubmit
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/checkout@v7

- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
components: clippy

- name: Cache cargo registry
uses: actions/cache@v5
uses: actions/cache@v6
with:
path: |
~/.cargo/registry
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/github_pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Checkout
uses: actions/checkout@v6
uses: actions/checkout@v7

- name: Setup Bazel
uses: bazel-contrib/setup-bazel@0.19.0
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
if: github.event_name != 'pull_request' || github.event.label.name == 'run-nightly'

steps:
- uses: actions/checkout@v6
- uses: actions/checkout@v7

- name: Setup Bazel
uses: bazel-contrib/setup-bazel@0.19.0
Expand All @@ -41,7 +41,7 @@ jobs:
needs: nightly-build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/checkout@v7

- name: Setup Bazel
uses: bazel-contrib/setup-bazel@0.19.0
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/roll-pigweed.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout the earlgrey-hwe branch
uses: actions/checkout@v6
uses: actions/checkout@v7

- name: Set up Python
uses: actions/setup-python@v6
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/sync-main-to-earlgrey-hwe.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
private-key: ${{ secrets.SYNCHRONIZE_BOT_PRIVATE_KEY }}

- name: Checkout the main branch
uses: actions/checkout@v6
uses: actions/checkout@v7
with:
ref: main
fetch-depth: 0 # Fetches all history so branches can be compared
Expand Down
2 changes: 1 addition & 1 deletion MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ local_path_override(

git_override(
module_name = "pigweed",
commit = "01465b97384a68fa698392ca5ed15c678738aab6", # roll:pigweed
commit = "e4acf4a3e44b0886fcc2a1c1f64ffccbb810ee6b", # roll:pigweed
patch_args = ["-p1"],
patches = [
# Allow integration_tests to build for armv7-m / armv7e-m so the
Expand Down
706 changes: 515 additions & 191 deletions MODULE.bazel.lock

Large diffs are not rendered by default.

42 changes: 42 additions & 0 deletions hal/blocking/flash/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# Licensed under the Apache-2.0 license
# SPDX-License-Identifier: Apache-2.0

load("@rules_rust//rust:defs.bzl", "rust_library", "rust_test")

rust_library(
name = "driver",
srcs = [
"driver.rs",
],
crate_name = "hal_flash_driver",
edition = "2024",
visibility = ["//visibility:public"],
deps = [
"//util/types",
"@rust_crates//:zerocopy",
],
)

rust_library(
name = "flash",
srcs = [
"flash.rs",
],
crate_name = "hal_flash",
edition = "2024",
visibility = ["//visibility:public"],
deps = [
":driver",
"//util/io",
"//util/types",
],
)

rust_test(
name = "flash_test",
crate = ":flash",
rustc_flags = [
"-C",
"debug-assertions",
],
)
55 changes: 55 additions & 0 deletions hal/blocking/flash/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# Blocking Flash HAL

This HAL provides abstractions for interacting with flash memory. It defines traits for low-level drivers and high-level synchronous interfaces, along with a helper implementation to bridge them.

## Key Abstractions

### `FlashAddress`

A transparent wrapper around a 32-bit offset (`u32`) representing a location in flash memory. It supports basic arithmetic operations (`Add`, `AddAssign`, `BitAnd`, `BitAndAssign`) to facilitate address calculations.

Platform-specific extension traits (like `EarlgreyFlashAddress` in `earlgrey_util`) may use the offset bits to encode additional information (e.g., distinguishing between DATA and INFO partitions using the MSB).

### `FlashDriver` Trait

Defines the low-level interface for flash hardware. It is designed to support both synchronous and asynchronous hardware controllers using a start-poll-complete execution model for erase and program operations:

1. **Start**: Initiated via `start_erase` or `start_program`.
2. **Poll**: Check completion status via `is_busy`, or wait for a hardware interrupt.
3. **Complete**: Finalize the operation and retrieve any execution errors via `complete_op`.

Read operations (`read`) are synchronous for simplicity.

Drivers also define hardware-specific constraints as constants:
* `ERASABLE_SIZES_BITMAP`: A bitmap where bit `i` is set if erasing blocks of size `2^i` is supported.
* `PROGRAM_WINDOW_SIZE`: The maximum size of a single write, and the boundary alignment constraint for writes.
* `MAX_READ_SIZE`: The maximum size of a single read.
* `READ_ALIGNMENT` / `PROGRAM_ALIGNMENT`: Address and size alignment requirements.

### `Flash` Trait

Provides a simplified, synchronous, blocking interface suitable for application use. It abstracts away the low-level start-poll-complete flow and hardware constraints (alignment, windows).

### `BlockingFlash`

A concrete implementation of the `Flash` trait that wraps a `FlashDriver` and a `Blocking` mechanism. It implements the blocking behavior and handles driver constraints automatically:

```mermaid
graph TD
App[Application] -- "Flash::program()" --> BF[BlockingFlash]
BF -- "1. start_program()" --> Driver[FlashDriver]
BF -- "2. wait_for_notification()" --> Blocking[Blocking impl]
Blocking -- "wakes up (IRQ/Poll)" --> BF
BF -- "3. complete_op()" --> Driver
```

#### Read Alignment Handling

If a read request is not aligned to `TDriver::READ_ALIGNMENT`, `BlockingFlash::read` will:
1. Read the aligned block containing the unaligned start address into a temporary buffer.
2. Copy the requested bytes from the temporary buffer.
3. Read the remaining data in aligned chunks directly into the destination buffer.

#### Program Window Handling

Hardware flash controllers often cannot program data that crosses a write window boundary (typically 64 bytes). `BlockingFlash::program` automatically detects these boundaries and splits a large or unaligned write into multiple smaller writes that fit within the program windows.
159 changes: 159 additions & 0 deletions hal/blocking/flash/driver.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,159 @@
// Licensed under the Apache-2.0 license
// SPDX-License-Identifier: Apache-2.0

//! Low-level flash driver interface.

#![no_std]

use core::num::NonZero;

use util_types::PowerOf2Usize;
use zerocopy::{FromBytes, Immutable, IntoBytes, KnownLayout};

/// Low-level flash driver interface.
///
/// This trait defines the interface for interacting with flash hardware at a low level.
/// It supports an asynchronous-style execution model using a start-poll-complete pattern:
/// 1. Start the operation (`start_erase`, `start_program`).
/// 2. Poll status (`is_busy`) or wait for interrupt.
/// 3. Finalize and check errors (`complete_op`).
///
/// Read operations (`read`) are assumed to be synchronous and blocking for simplicity.
pub trait FlashDriver {
/// The error type returned by driver operations.
type Error;

/// The default page size in bytes.
const PAGE_SIZE: usize;

/// The maximum size of a single program operation (write window).
/// Program operations cannot span across boundaries aligned to this size.
const PROGRAM_WINDOW_SIZE: usize;

/// The maximum size of a single read operation.
const MAX_READ_SIZE: usize;

/// The alignment required for read operations (addresses and lengths).
const READ_ALIGNMENT: usize;

/// The alignment required for program operations (addresses and lengths).
const PROGRAM_ALIGNMENT: usize;

/// Returns the total size of the flash in bytes.
fn size(&self) -> NonZero<usize>;

/// Returns a bitmap of supported erase block sizes.
///
/// Each bit `i` represents a supported erase block size of `2^i` bytes.
/// For example, if bit 11 is set, then 2048-byte erases are supported.
fn erasable_sizes_bitmap(&mut self) -> Result<u32, Self::Error>;

/// Reads data from flash synchronously.
///
/// # Arguments
/// * `start_addr`: The address to start reading from. Must be aligned to `READ_ALIGNMENT`.
/// * `buf`: The buffer to read data into. Must have size <= `MAX_READ_SIZE` and be aligned to `READ_ALIGNMENT`.
fn read(&mut self, start_addr: FlashAddress, buf: &mut [u8]) -> Result<(), Self::Error>;

/// Starts an erase operation asynchronously.
///
/// The operation is not guaranteed to be complete until `complete_op` is called
/// and returns `Ok`.
///
/// # Arguments
/// * `start_addr`: The start address of the block to erase. Must be aligned to the block size.
/// * `size`: The size of the block to erase. Must have its corresponding bit set in `ERASABLE_SIZES_BITMAP`.
fn start_erase(
&mut self,
start_addr: FlashAddress,
size: PowerOf2Usize,
) -> Result<(), Self::Error>;

/// Starts a program operation asynchronously.
///
/// The operation is not guaranteed to be complete until `complete_op` is called
/// and returns `Ok`.
///
/// The programmed region must not cross a `PROGRAM_WINDOW_SIZE` boundary.
///
/// # Arguments
/// * `start_address`: The address to start programming at. Must be aligned to `PROGRAM_ALIGNMENT`.
/// * `data`: The data to program. Must have size <= `PROGRAM_WINDOW_SIZE` and be aligned to `PROGRAM_ALIGNMENT`.
fn start_program(
&mut self,
start_address: FlashAddress,
data: &[u8],
) -> Result<(), Self::Error>;

/// Returns whether the driver is currently busy with an operation.
fn is_busy(&mut self) -> bool;

/// Completes a pending erase or program operation and returns the result.
///
/// This should be called after `is_busy` returns false to check for errors and
/// reset the driver state.
fn complete_op(&mut self) -> Result<(), Self::Error>;
}

/// Represents an address in flash memory.
///
/// A flash address consists of an offset within the flash address space.
#[derive(Default, Clone, Copy, PartialEq, Eq, IntoBytes, Immutable, FromBytes, KnownLayout)]
#[repr(transparent)]
pub struct FlashAddress {
offset: u32,
}

impl core::fmt::Display for FlashAddress {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
write!(f, "0x{:08x}", self.offset)
}
}

impl core::fmt::Debug for FlashAddress {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
core::fmt::Display::fmt(self, f)
}
}

impl FlashAddress {
/// Creates a new `FlashAddress`.
pub const fn new(offset: u32) -> Self {
Self { offset }
}

/// Returns the offset.
pub fn offset(&self) -> u32 {
self.offset
}
}

impl core::ops::Add<usize> for FlashAddress {
type Output = Self;
fn add(self, other: usize) -> Self {
Self {
offset: self.offset + other as u32,
}
}
}

impl core::ops::AddAssign<usize> for FlashAddress {
fn add_assign(&mut self, other: usize) {
self.offset += other as u32;
}
}

impl core::ops::BitAnd<usize> for FlashAddress {
type Output = Self;
fn bitand(self, other: usize) -> Self {
Self {
offset: self.offset & other as u32,
}
}
}

impl core::ops::BitAndAssign<usize> for FlashAddress {
fn bitand_assign(&mut self, other: usize) {
self.offset &= other as u32;
}
}
Loading
Loading