Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
132 changes: 64 additions & 68 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,16 +33,16 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install rust
- name: Install Just
uses: taiki-e/install-action@just
- name: Install Rust
run: |
rustup install ${{ matrix.rust }}
rustup default ${{ matrix.rust }}
rustup target add ${{ matrix.target }}
- name: Build
run: |
cargo build --target ${{ matrix.target }}
cargo build --target ${{ matrix.target }} --features "serde, defmt, critical-section-multi-core, check-asm"
cargo build --target ${{ matrix.target }} --features "serde, defmt, critical-section-single-core, check-asm"
just build-tier2 ${{ matrix.target }}

# These targets need build-std, and have no atomics
build-tier3-no-atomics:
Expand All @@ -58,39 +58,41 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install rust
- name: Install Just
uses: taiki-e/install-action@just
- name: Install Rust
run: |
rustup install nightly-2025-10-29
rustup component add rust-src --toolchain nightly-2025-10-29
rustup default nightly-2025-10-29
- name: Build
run: |
cargo +nightly-2025-10-29 build --target ${{ matrix.target }} -Zbuild-std=core
cargo +nightly-2025-10-29 build --target ${{ matrix.target }} -Zbuild-std=core --features "serde, defmt, check-asm"
just build-tier3-no-atomics ${{ matrix.target }}

# Build the host tools
build-host:
# Build the host-only stuff
build-arm-targets:
runs-on: ubuntu-24.04
needs: setup
strategy:
matrix:
rust: [stable, 1.59]
rust: ${{ fromJSON(needs.setup.outputs.rust-versions) }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install rust
- name: Install Just
uses: taiki-e/install-action@just
- name: Install Rust
run: |
rustup install ${{ matrix.rust }}
rustup default ${{ matrix.rust }}
- name: Build
run: |
cd arm-targets
cargo build
cargo test
just build-arm-targets

# Gather all the above build jobs together for the purposes of getting an overall pass-fail
build-all:
runs-on: ubuntu-24.04
needs: [build-tier2, build-tier3-no-atomics, build-host]
needs: [build-tier2, build-tier3-no-atomics, build-arm-targets]
steps:
- run: /bin/true

Expand All @@ -110,7 +112,7 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install rust
- name: Install Rust
run: |
rustup install ${{ matrix.rust }}
rustup default ${{ matrix.rust }}
Expand All @@ -130,7 +132,7 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install rust
- name: Install Rust
run: |
rustup install ${{ matrix.rust }}
rustup default ${{ matrix.rust }}
Expand All @@ -147,95 +149,86 @@ jobs:
- run: /bin/true

# Format the workspace
fmt:
fmt-all:
runs-on: ubuntu-24.04
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install rust
- name: Install Just
uses: taiki-e/install-action@just
- name: Install Rust
run: |
rustup install stable
rustup default stable
rustup component add rustfmt
- name: Format
run: |
cargo fmt --check
just fmt-check

# Format the host tools
fmt-host:
# Run clippy on the workpace
clippy:
runs-on: ubuntu-24.04
needs: setup
strategy:
matrix:
target: ${{ fromJSON(needs.setup.outputs.stable-targets) }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install rust
- name: Install Just
uses: taiki-e/install-action@just
- name: Install Rust
run: |
rustup install stable
rustup default stable
rustup component add rustfmt
- name: Format
rustup toolchain install 1.92
rustup default 1.92
rustup target add ${{ matrix.target }}
rustup component add clippy
- name: Clippy
run: |
cd arm-targets
cargo fmt --check
just clippy-target ${{ matrix.target }}

# Gather all the above fmt jobs together for the purposes of getting an overall pass-fail
fmt-all:
runs-on: ubuntu-24.04
needs: [fmt, fmt-host]
steps:
- run: /bin/true

# Run clippy on the workpace
clippy:
# Run clippy on the examples
clippy-examples:
runs-on: ubuntu-24.04
needs: setup
strategy:
matrix:
rust: ${{ fromJSON(needs.setup.outputs.rust-versions) }}
target: ${{ fromJSON(needs.setup.outputs.stable-targets) }}
exclude:
- rust: 1.83
target: armv7a-none-eabihf
- rust: 1.83
target: armv8r-none-eabihf
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install rust
- name: Install Just
uses: taiki-e/install-action@just
- name: Install Rust
run: |
rustup install ${{ matrix.rust }}
rustup default ${{ matrix.rust }}
rustup target add ${{ matrix.target }}
rustup toolchain install 1.92
rustup default 1.92
rustup target add armv7r-none-eabihf
rustup target add armv8r-none-eabihf
rustup component add clippy
- name: Clippy
run: |
cargo clippy --target ${{ matrix.target }}
cargo clippy --target ${{ matrix.target }} --no-default-features
cargo clippy --target ${{ matrix.target }} --all-features
just clippy-examples

# Run clippy on the host tools
clippy-host:
runs-on: ubuntu-24.04
needs: setup
strategy:
matrix:
rust: ${{ fromJSON(needs.setup.outputs.rust-versions) }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install rust
- name: Install Just
uses: taiki-e/install-action@just
- name: Install Rust
run: |
rustup install ${{ matrix.rust }}
rustup default ${{ matrix.rust }}
rustup toolchain install 1.92
rustup default 1.92
rustup component add clippy
- name: Clippy
run: |
cd arm-targets
cargo clippy
just clippy-host

# Gather all the above clippy jobs together for the purposes of getting an overall pass-fail
clippy-all:
runs-on: ubuntu-24.04
needs: [clippy, clippy-host]
needs: [clippy, clippy-examples, clippy-host]
steps:
- run: /bin/true

Expand All @@ -245,13 +238,14 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install rust
- name: Install Just
uses: taiki-e/install-action@just
- name: Install Rust
run: |
rustup install stable
rustup default stable
- name: Run cargo test
run: |
cargo test --manifest-path aarch32-cpu/Cargo.toml
- run: |
just test-cargo

# Run some programs in QEMU 9
# These tests build with nightly as pinned by the rust-toolchain.toml file, because they include Tier 3 targets
Expand All @@ -261,6 +255,8 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Just
uses: taiki-e/install-action@just
- name: Install Dependencies
run: |
sudo apt-get -y update
Expand All @@ -271,7 +267,7 @@ jobs:
- name: Run tests in QEMU
run: |
export PATH=/opt/qemu/bin:$PATH
./tests.sh
just test-qemu

# Gather all the above xxx-all jobs together for the purposes of getting an overall pass-fail
all:
Expand Down
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
target
examples/mps3-an536/target
examples/mps3-an536/target-d32
examples/versatileab/target
examples/versatileab/target-d32
Cargo.lock
2 changes: 1 addition & 1 deletion aarch32-rt/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@
//! use aarch32_rt::exception;
//!
//! #[exception(PrefetchAbort)]
//! fn my_handler(addr: usize) -> usize {
//! unsafe fn my_handler(addr: usize) -> usize {
//! // do stuff, then go back to the instruction after the one that failed
//! addr + 4
//! }
Expand Down
2 changes: 1 addition & 1 deletion arm-targets/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ name = "arm-targets"
readme = "README.md"
repository = "https://github.com/rust-embedded/aarch32.git"
homepage = "https://github.com/rust-embedded/aarch32"
rust-version = "1.59"
rust-version = "1.83"
version = "0.4.0"

[dependencies]
2 changes: 1 addition & 1 deletion arm-targets/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ This allows you to write Rust code in your firmware like:

## Minimum Supported Rust Version (MSRV)

This crate is guaranteed to compile on stable Rust 1.59.0 and up, as recorded
This crate is guaranteed to compile on stable Rust 1.83.0 and up, as recorded
by the `package.rust-version` property in `Cargo.toml`.

Increasing the MSRV is not considered a breaking change and may occur in a
Expand Down
7 changes: 1 addition & 6 deletions arm-targets/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -347,12 +347,7 @@ pub enum Abi {
impl Abi {
/// Decode a target string
pub fn get(target: &str) -> Option<Abi> {
if Arch::get(target).is_none() {
// Don't give an ABI for non-Arm targets
//
// e.g. PowerPC also has an ABI called EABI, but it's not the same
return None;
}
let _ = Arch::get(target)?;
if target.ends_with("eabi") {
Some(Abi::Eabi)
} else if target.ends_with("eabihf") {
Expand Down
2 changes: 1 addition & 1 deletion arm-targets/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

/// Entry point to the program
fn main() {
if let Some(target) = std::env::args().skip(1).next() {
if let Some(target) = std::env::args().nth(1) {
println!("// These are the features for the target '{}'", target);
arm_targets::process_target(&target);
} else {
Expand Down
3 changes: 2 additions & 1 deletion examples/mps3-an536/rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
[toolchain]
channel = "stable"
channel = "nightly-2026-01-02"
targets = [
"armv8r-none-eabihf",
]
components = ["rust-src", "clippy", "rustfmt"]
1 change: 1 addition & 0 deletions examples/mps3-an536/src/bin/registers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ fn mpu_pmsa_v8() {
}

// Load a config (but don't enable it)
#[allow(clippy::zero_ptr)]
mpu.configure(&El1Config {
background_config: true,
regions: &[El1Region {
Expand Down
5 changes: 4 additions & 1 deletion examples/mps3-an536/src/bin/smp_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,11 +102,13 @@ fn main() -> ! {
aarch32_cpu::asm::nop();
}

let mut code = 0;
let total_a = SHARED_VARIABLE.load(Ordering::Relaxed);
if total_a == CAS_LOOPS * 2 {
println!("CAS test passed");
} else {
println!("CAS test failed, got {} not 2000", total_a);
code = 1;
}

let total_b = critical_section::with(|cs| {
Expand All @@ -118,9 +120,10 @@ fn main() -> ! {
println!("CS Mutex test passed");
} else {
println!("CS Mutex test failed, got {} not 2000", total_b);
code = 1;
}

semihosting::process::exit(0);
semihosting::process::exit(code);
}

/// The entry-point to the Rust application.
Expand Down
4 changes: 2 additions & 2 deletions examples/versatileab/rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
[toolchain]
channel = "stable"
channel = "nightly-2026-01-02"
targets = [
"armv7r-none-eabi",
"armv7r-none-eabihf",
"armv7a-none-eabi",
"armv7a-none-eabihf",
]
components = ["rust-src"]
components = ["rust-src", "clippy", "rustfmt"]
10 changes: 2 additions & 8 deletions examples/versatileab/src/bin/svc-a32.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,18 +32,12 @@ fn svc_handler(arg: u32) {
}
}

#[cfg_attr(
any(arm_architecture = "v4t", arm_architecture = "v5te"),
instruction_set(arm::a32)
)]
#[instruction_set(arm::a32)]
fn do_svc1() {
aarch32_cpu::svc!(0xABCDEF);
}

#[cfg_attr(
any(arm_architecture = "v4t", arm_architecture = "v5te"),
instruction_set(arm::a32)
)]
#[instruction_set(arm::a32)]
fn do_svc2() {
aarch32_cpu::svc!(0x456789);
}
Loading