Skip to content
Draft
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
22 changes: 20 additions & 2 deletions .cargo/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,45 @@
# Note, this requires QEMU 9 or higher
runner = "qemu-system-arm -machine mps3-an536 -cpu cortex-r52 -semihosting -nographic -audio none -kernel"

[target.thumbv8r-none-eabihf]
# Note, this requires QEMU 9 or higher
runner = "qemu-system-arm -machine mps3-an536 -cpu cortex-r52 -semihosting -nographic -audio none -kernel"

[target.armv7r-none-eabihf]
runner = "qemu-system-arm -machine versatileab -cpu cortex-r5f -semihosting -nographic -audio none -kernel"

[target.thumbv7r-none-eabihf]
runner = "qemu-system-arm -machine versatileab -cpu cortex-r5f -semihosting -nographic -audio none -kernel"

[target.armv7r-none-eabi]
# change '-mcpu=cortex-r5' to '-mcpu=cortex-r5f' if you use eabi-fpu feature, otherwise
# qemu-system-arm will lock up
runner = "qemu-system-arm -machine versatileab -cpu cortex-r5 -semihosting -nographic -audio none -kernel"

[target.thumbv7r-none-eabi]
# change '-mcpu=cortex-r5' to '-mcpu=cortex-r5f' if you use eabi-fpu feature, otherwise
# qemu-system-arm will lock up
runner = "qemu-system-arm -machine versatileab -cpu cortex-r5 -semihosting -nographic -audio none -kernel"

[target.armv7a-none-eabihf]
runner = "qemu-system-arm -machine versatileab -cpu cortex-a8 -semihosting -nographic -audio none -kernel"

[target.thumbv7a-none-eabihf]
runner = "qemu-system-arm -machine versatileab -cpu cortex-a8 -semihosting -nographic -audio none -kernel"

[target.armv7a-none-eabi]
runner = "qemu-system-arm -machine versatileab -cpu cortex-a8 -semihosting -nographic -audio none -kernel"

[target.thumbv7a-none-eabi]
runner = "qemu-system-arm -machine versatileab -cpu cortex-a8 -semihosting -nographic -audio none -kernel"

[target.armv5te-none-eabi]
runner = "qemu-system-arm -machine versatileab -cpu arm926 -semihosting -nographic -audio none -kernel"

[target.armv4t-none-eabi]
[target.thumbv5te-none-eabi]
runner = "qemu-system-arm -machine versatileab -cpu arm926 -semihosting -nographic -audio none -kernel"

[target.thumbv5te-none-eabi]
[target.armv4t-none-eabi]
runner = "qemu-system-arm -machine versatileab -cpu arm926 -semihosting -nographic -audio none -kernel"

[target.thumbv4t-none-eabi]
Expand Down
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
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,8 @@
target
examples/mps3-an536/target
examples/mps3-an536/target-d32
examples/versatileab/target
examples/versatileab/target-d32
Cargo.lock
**/.DS_Store

12 changes: 8 additions & 4 deletions aarch32-rt/src/arch_v7/svc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,14 @@ core::arch::global_asm!(
r#"
mrs r0, spsr // Load processor status that was banked on entry
tst r0, {t_bit} // SVC occurred from Thumb state?
ldrhne r0, [lr,#-2] // Yes: Load halfword and...
bicne r0, r0, #0xFF00 // ...extract comment field
ldreq r0, [lr,#-4] // No: Load word and...
biceq r0, r0, #0xFF000000 // ...extract comment field
beq 1f
ldrh r0, [lr,#-2] // Yes: Load halfword and...
bic r0, r0, #0xFF00 // ...extract comment field
b 2f
1:
ldr r0, [lr,#-4] // No: Load word and...
bic r0, r0, #0xFF000000 // ...extract comment field
2:
// r0 now contains SVC number
bl _svc_handler
"#,
Expand Down
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
Loading