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
3 changes: 0 additions & 3 deletions .cargo/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,3 @@ runner = "qemu-system-arm -machine versatileab -cpu arm926 -semihosting -nograph

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

[unstable]
build-std = ["core", "alloc"]
112 changes: 56 additions & 56 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,13 @@ jobs:
echo 'rust_versions={"rust": ["stable", "1.83"]}' >> "$GITHUB_OUTPUT"

# Build the workspace for a target architecture
build:
build-tier2:
runs-on: ubuntu-24.04
needs: setup
strategy:
matrix:
rust: ${{ fromJSON(needs.setup.outputs.matrix).rust }}
target:
- armebv7r-none-eabi
- armebv7r-none-eabihf
- armv7r-none-eabi
- armv7r-none-eabihf
- armv7a-none-eabi
Expand All @@ -38,101 +36,112 @@ jobs:
rustup target add ${{ matrix.target }}
- name: Build
run: |
cargo build --target ${{ matrix.target }} --features "serde, defmt, check-asm"
cargo build --target ${{ matrix.target }} --no-default-features
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"

build-versatileab:
# These targets are in nightly and coming to stable soon
build-tier2-nightly:
runs-on: ubuntu-24.04
needs: setup
strategy:
matrix:
rust: ${{ fromJSON(needs.setup.outputs.matrix).rust }}
target:
- armv7a-none-eabi
- armv7a-none-eabihf
- armv7r-none-eabi
- armv7r-none-eabihf
- armv8r-none-eabihf
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install rust
run: |
rustup install ${{ matrix.rust }}
rustup default ${{ matrix.rust }}
rustup target add armv7a-none-eabi
rustup target add armv7r-none-eabi
rustup target add armv7r-none-eabihf
rustup install nightly-2025-10-29
rustup target add ${{ matrix.target }} --toolchain nightly-2025-10-29
- name: Build
run: |
cargo build --manifest-path ./examples/versatileab/Cargo.toml --target armv7a-none-eabi
cargo build --manifest-path ./examples/versatileab/Cargo.toml --target armv7r-none-eabi
cargo build --manifest-path ./examples/versatileab/Cargo.toml --target armv7r-none-eabihf
cargo +nightly-2025-10-29 build --target ${{ matrix.target }}
cargo +nightly-2025-10-29 build --target ${{ matrix.target }} --features "serde, defmt, critical-section-multi-core, check-asm"
cargo +nightly-2025-10-29 build --target ${{ matrix.target }} --features "serde, defmt, critical-section-single-core, check-asm"

build-mps3-an536:
# These targets need build-std, and have no atomics so cannot build the critical-section module
build-tier3-no-atomics:
runs-on: ubuntu-24.04
needs: setup
strategy:
matrix:
rust: ${{ fromJSON(needs.setup.outputs.matrix).rust }}
target:
- armv4t-none-eabi
- thumbv4t-none-eabi
- armv5te-none-eabi
- thumbv5te-none-eabi
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install rust
run: |
rustup install nightly
rustup default nightly
rustup component add rust-src --toolchain nightly
rustup install nightly-2025-10-29
rustup component add rust-src --toolchain nightly-2025-10-29
- name: Build
run: |
cargo build --manifest-path ./examples/mps3-an536/Cargo.toml --target armv8r-none-eabihf -Zbuild-std=core
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"

# Build the host tools
build-host:
build-versatileab:
runs-on: ubuntu-24.04
needs: setup
strategy:
matrix:
rust: [stable, 1.59]
rust: ${{ fromJSON(needs.setup.outputs.matrix).rust }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install rust
- name: Build
run: |
rustup install ${{ matrix.rust }}
rustup default ${{ matrix.rust }}
cd examples/versatileab
cargo build --target armv7a-none-eabi
cargo build --target armv7r-none-eabi
cargo build --target armv7r-none-eabihf

build-mps3-an536:
runs-on: ubuntu-24.04
needs: setup
strategy:
matrix:
rust: ${{ fromJSON(needs.setup.outputs.matrix).rust }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Build
run: |
cd arm-targets
cargo build
cargo test
cd examples/mps3-an536
cargo build --target armv8r-none-eabihf

# Build the workspace for the target architecture but using nightly to compile libcore
# Technically it doesn't need 'setup' but it makes the graph look nicer
build-tier3:
# Build the host tools
build-host:
runs-on: ubuntu-24.04
needs: setup
strategy:
matrix:
target:
- armv7a-none-eabi
- armv7a-none-eabihf
- armv7r-none-eabi
- armv7r-none-eabihf
- armv8r-none-eabihf
- armebv7r-none-eabi
- armebv7r-none-eabihf
rust: [stable, 1.59]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install rust
run: |
rustup install nightly
rustup default nightly
rustup component add rust-src --toolchain nightly
rustup install ${{ matrix.rust }}
rustup default ${{ matrix.rust }}
- name: Build
run: |
cargo build --target ${{ matrix.target }} -Zbuild-std=core --features "serde, defmt, check-asm"
cargo build --target ${{ matrix.target }} -Zbuild-std=core --no-default-features
cd arm-targets
cargo build
cargo test

# 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, build-tier3, build-host, build-versatileab, build-mps3-an536]
needs: [build-tier2, build-tier2-nightly, build-tier3-no-atomics, build-host, build-versatileab, build-mps3-an536]
steps:
- run: /bin/true

Expand All @@ -145,8 +154,6 @@ jobs:
rust: ${{ fromJSON(needs.setup.outputs.matrix).rust }}
target:
- armv7a-none-eabi
- armebv7r-none-eabi
- armebv7r-none-eabihf
- armv7r-none-eabi
- armv7r-none-eabihf
steps:
Expand All @@ -160,7 +167,6 @@ jobs:
- name: Build docs
run: |
cargo doc --target ${{ matrix.target }}
cargo doc --target ${{ matrix.target }} --no-default-features
cargo doc --target ${{ matrix.target }} --all-features

# Build the docs for the host tools
Expand Down Expand Up @@ -235,8 +241,6 @@ jobs:
matrix:
rust: ${{ fromJSON(needs.setup.outputs.matrix).rust }}
target:
- armebv7r-none-eabi
- armebv7r-none-eabihf
- armv7r-none-eabi
- armv7r-none-eabihf
- armv7a-none-eabi
Expand Down Expand Up @@ -303,10 +307,6 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install rust
run: |
rustup install 1.89
rustup default 1.89
- name: Install Dependencies
run: |
sudo apt-get -y update
Expand Down
1 change: 1 addition & 0 deletions examples/mps3-an536/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,4 @@ arm-targets = {version = "0.3.0", path = "../../arm-targets"}

[features]
eabi-fpu = ["aarch32-rt/eabi-fpu"]
fpu-d32 = ["aarch32-rt/fpu-d32"]
6 changes: 5 additions & 1 deletion examples/mps3-an536/rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
[toolchain]
channel = "nightly"
channel = "nightly-2025-10-29"
targets = [
"armv8r-none-eabihf",
]
components = ["rust-src"]
9 changes: 9 additions & 0 deletions examples/versatileab/rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[toolchain]
channel = "nightly-2025-10-29"
targets = [
"armv7r-none-eabi",
"armv7r-none-eabihf",
"armv7a-none-eabi",
"armv7a-none-eabihf",
]
components = ["rust-src"]
132 changes: 31 additions & 101 deletions tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,6 @@
# Runs a series of sample programs in QEMU and checks that the standard output
# is as expected.

rustup target add armv7r-none-eabi
rustup target add armv7r-none-eabihf
rustup target add armv7a-none-eabi
rustup component add rust-src

# Set this to 1 to exit on the first error
EXIT_FAST=0

Expand All @@ -25,9 +20,6 @@ fail() {

mkdir -p ./target

versatile_ab_cargo="--manifest-path examples/versatileab/Cargo.toml"
mps3_an536_cargo="--manifest-path examples/mps3-an536/Cargo.toml"

my_diff() {
file_a=$1
file_b=$2
Expand All @@ -46,101 +38,39 @@ my_diff() {
fi
}

# armv7r-none-eabi tests
cargo build ${versatile_ab_cargo} --target=armv7r-none-eabi || exit 1
for bin_path in $(ls examples/versatileab/src/bin/*.rs); do
filename=${bin_path##*/}
binary=${filename%.rs}
cargo run ${versatile_ab_cargo} --target=armv7r-none-eabi --bin $binary > ./target/$binary-armv7r-none-eabi.out
my_diff ./examples/versatileab/reference/$binary-armv7r-none-eabi.out ./target/$binary-armv7r-none-eabi.out || fail $binary "armv7r-none-eabi"
done

# armv7r-none-eabihf tests
cargo build ${versatile_ab_cargo} --target=armv7r-none-eabihf || exit 1
for bin_path in $(ls examples/versatileab/src/bin/*.rs); do
filename=${bin_path##*/}
binary=${filename%.rs}
cargo run ${versatile_ab_cargo} --target=armv7r-none-eabihf --bin $binary > ./target/$binary-armv7r-none-eabihf.out
my_diff ./examples/versatileab/reference/$binary-armv7r-none-eabihf.out ./target/$binary-armv7r-none-eabihf.out || fail $binary "armv7r-none-eabihf"
done

# armv7a-none-eabi tests
cargo build ${versatile_ab_cargo} --target=armv7a-none-eabi || exit 1
for bin_path in $(ls examples/versatileab/src/bin/*.rs); do
filename=${bin_path##*/}
binary=${filename%.rs}
cargo run ${versatile_ab_cargo} --target=armv7a-none-eabi --bin $binary > ./target/$binary-armv7a-none-eabi.out
my_diff ./examples/versatileab/reference/$binary-armv7a-none-eabi.out ./target/$binary-armv7a-none-eabi.out || fail $binary "armv7a-none-eabi"
done

# armv7a-none-eabihf tests
RUSTC_BOOTSTRAP=1 cargo build ${versatile_ab_cargo} --target=armv7a-none-eabihf || exit 1
for bin_path in $(ls examples/versatileab/src/bin/*.rs); do
filename=${bin_path##*/}
binary=${filename%.rs}
RUSTC_BOOTSTRAP=1 cargo run ${versatile_ab_cargo} --target=armv7a-none-eabihf --bin $binary > ./target/$binary-armv7a-none-eabihf.out
my_diff ./examples/versatileab/reference/$binary-armv7a-none-eabihf.out ./target/$binary-armv7a-none-eabihf.out || fail $binary "armv7a-none-eabihf"
done

# armv7a-none-eabihf double-precision tests
RUSTC_BOOTSTRAP=1 RUSTFLAGS="-Ctarget-feature=+d32" cargo build ${versatile_ab_cargo} --target=armv7a-none-eabihf --features=fpu-d32 || exit 1
for bin_path in $(ls examples/versatileab/src/bin/*.rs); do
filename=${bin_path##*/}
binary=${filename%.rs}
RUSTC_BOOTSTRAP=1 RUSTFLAGS="-Ctarget-feature=+d32" cargo run ${versatile_ab_cargo} --target=armv7a-none-eabihf --bin $binary --features=fpu-d32 > ./target/$binary-armv7a-none-eabihf-dp.out
my_diff ./examples/versatileab/reference/$binary-armv7a-none-eabihf.out ./target/$binary-armv7a-none-eabihf-dp.out || fail $binary "armv7a-none-eabihf"
done

# armv5te-none-eabi tests
RUSTC_BOOTSTRAP=1 cargo build ${versatile_ab_cargo} --target=armv5te-none-eabi
for bin_path in $(ls examples/versatileab/src/bin/*.rs); do
filename=${bin_path##*/}
binary=${filename%.rs}
RUSTC_BOOTSTRAP=1 cargo run ${versatile_ab_cargo} --target=armv5te-none-eabi --bin $binary > ./target/$binary-armv5te-none-eabi.out
my_diff ./examples/versatileab/reference/$binary-armv5te-none-eabi.out ./target/$binary-armv5te-none-eabi.out || fail $binary "armv5te-none-eabi"
done

# thumbv5te-none-eabi tests
RUSTC_BOOTSTRAP=1 cargo build ${versatile_ab_cargo} --target=thumbv5te-none-eabi
for bin_path in $(ls examples/versatileab/src/bin/*.rs); do
filename=${bin_path##*/}
binary=${filename%.rs}
RUSTC_BOOTSTRAP=1 cargo run ${versatile_ab_cargo} --target=thumbv5te-none-eabi --bin $binary > ./target/$binary-thumbv5te-none-eabi.out
my_diff ./examples/versatileab/reference/$binary-thumbv5te-none-eabi.out ./target/$binary-thumbv5te-none-eabi.out || fail $binary "thumbv5te-none-eabi"
done

# armv4t-none-eabi tests
RUSTC_BOOTSTRAP=1 cargo build ${versatile_ab_cargo} --target=armv4t-none-eabi
for bin_path in $(ls examples/versatileab/src/bin/*.rs); do
filename=${bin_path##*/}
binary=${filename%.rs}
RUSTC_BOOTSTRAP=1 cargo run ${versatile_ab_cargo} --target=armv4t-none-eabi --bin $binary > ./target/$binary-armv4t-none-eabi.out
my_diff ./examples/versatileab/reference/$binary-armv4t-none-eabi.out ./target/$binary-armv4t-none-eabi.out || fail $binary "armv4t-none-eabi"
done

# thumbv4t-none-eabi tests
RUSTC_BOOTSTRAP=1 cargo build ${versatile_ab_cargo} --target=thumbv4t-none-eabi
for bin_path in $(ls examples/versatileab/src/bin/*.rs); do
filename=${bin_path##*/}
binary=${filename%.rs}
RUSTC_BOOTSTRAP=1 cargo run ${versatile_ab_cargo} --target=thumbv4t-none-eabi --bin $binary > ./target/$binary-thumbv4t-none-eabi.out
my_diff ./examples/versatileab/reference/$binary-thumbv4t-none-eabi.out ./target/$binary-thumbv4t-none-eabi.out || fail $binary "thumbv4t-none-eabi"
done

# These tests only run on QEMU 9 or higher.
# Ubuntu 24.04 supplies QEMU 8, which doesn't support the machine we have configured for this target
RUSTC_BOOTSTRAP=1 cargo build ${mps3_an536_cargo} --target=armv8r-none-eabihf || exit 1
if qemu-system-arm --version | grep "version \(9\|10\)"; then
# armv8r-none-eabihf tests
for bin_path in $(ls examples/mps3-an536/src/bin/*.rs); do
filename=${bin_path##*/}
run_tests() {
directory=$1
target="$2"
flags=$3
echo "Running directory=$directory target=$target flags=$flags"
pushd $directory
cargo build --target=$target $flags || exit 1
for bin_path in src/bin/*.rs; do
filename=$(basename $bin_path)
binary=${filename%.rs}
RUSTC_BOOTSTRAP=1 cargo run ${mps3_an536_cargo} --target=armv8r-none-eabihf --bin $binary > ./target/$binary-armv8r-none-eabihf.out
my_diff ./examples/mps3-an536/reference/$binary-armv8r-none-eabihf.out ./target/$binary-armv8r-none-eabihf.out || fail $binary "armv8r-none-eabihf"
cargo run --target=$target --bin $binary $flags > ./target/$binary-$target.out
my_diff ./reference/$binary-$target.out ./target/$binary-$target.out || fail $binary $target
done
RUSTC_BOOTSTRAP=1 cargo run ${mps3_an536_cargo} --target=armv8r-none-eabihf --bin smp_test -- -smp 2 > ./target/smp_test-armv8r-none-eabihf_smp2.out
my_diff ./examples/mps3-an536/reference/smp_test-armv8r-none-eabihf_smp2.out ./target/smp_test-armv8r-none-eabihf_smp2.out || fail smp_test "armv8r-none-eabihf"
fi
popd
}

run_tests examples/versatileab armv7r-none-eabi ""
run_tests examples/versatileab armv7r-none-eabihf ""
run_tests examples/versatileab armv7a-none-eabi ""
run_tests examples/versatileab armv7a-none-eabihf ""
RUSTFLAGS="-Ctarget-feature=+d32" run_tests examples/versatileab armv7a-none-eabihf "--features=fpu-d32"
run_tests examples/versatileab armv5te-none-eabi "-Zbuild-std=core"
run_tests examples/versatileab armv4t-none-eabi "-Zbuild-std=core"
run_tests examples/versatileab thumbv5te-none-eabi "-Zbuild-std=core"
run_tests examples/versatileab thumbv4t-none-eabi "-Zbuild-std=core"
run_tests examples/mps3-an536 armv8r-none-eabihf ""
RUSTFLAGS="-Ctarget-cpu=cortex-r52" run_tests examples/mps3-an536 armv8r-none-eabihf "--features=fpu-d32"

# Special case the SMP test. You can't run the normal examples with two CPUs because nothing stops the second CPU from running :/
pushd examples/mps3-an536
cargo run --target=armv8r-none-eabihf --bin smp_test -- --smp 2 > ./target/smp_test-armv8r-none-eabihf_smp2.out
my_diff ./reference/smp_test-armv8r-none-eabihf_smp2.out ./target/smp_test-armv8r-none-eabihf_smp2.out || fail smp_test armv8r-none-eabihf
popd

if [ "$FAILURE" == "1" ]; then
echo "***************************************************"
Expand Down