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
83 changes: 53 additions & 30 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,11 @@ jobs:
# Build the workspace for a target architecture using the MSRV
build-tier2-msrv:
runs-on: ubuntu-24.04
timeout-minutes: 10
needs: setup
strategy:
matrix:
target: ${{ fromJSON(needs.setup.outputs.msrv-targets) }}
action:
- build
- clippy
- doc
steps:
- name: Checkout
uses: actions/checkout@v7
Expand All @@ -43,21 +40,25 @@ jobs:
run: |
rustup install 1.93
rustup target add ${{ matrix.target }} --toolchain=1.93
- name: Run just
rustup component add clippy --toolchain=1.93
- name: Run build
run: |
RUSTUP_TOOLCHAIN=1.93 just ${{ matrix.action }}-tier2 ${{ matrix.target }}
RUSTUP_TOOLCHAIN=1.93 just build-tier2 ${{ matrix.target }}
- name: Run clippy
run: |
RUSTUP_TOOLCHAIN=1.93 just clippy-tier2 ${{ matrix.target }}
- name: Run doc
run: |
RUSTUP_TOOLCHAIN=1.93 just doc-tier2 ${{ matrix.target }}

# Build the workspace for a target architecture using latest stable
build-tier2-stable:
runs-on: ubuntu-24.04
timeout-minutes: 10
needs: setup
strategy:
matrix:
target: ${{ fromJSON(needs.setup.outputs.stable-targets) }}
action:
- build
- clippy
- doc
steps:
- name: Checkout
uses: actions/checkout@v7
Expand All @@ -67,73 +68,90 @@ jobs:
run: |
rustup install stable
rustup target add ${{ matrix.target }} --toolchain=stable
- name: Run just
rustup component add clippy --toolchain=stable
- name: Run build
run: |
RUSTUP_TOOLCHAIN=stable just build-tier2 ${{ matrix.target }}
- name: Run clippy
run: |
RUSTUP_TOOLCHAIN=stable just clippy-tier2 ${{ matrix.target }}
- name: Run doc
run: |
RUSTUP_TOOLCHAIN=stable just ${{ matrix.action }}-tier2 ${{ matrix.target }}
RUSTUP_TOOLCHAIN=stable just doc-tier2 ${{ matrix.target }}

# Build the workspace for all tier2 target architectures using rust-toolchain.toml
build-tier2-nightly:
runs-on: ubuntu-24.04
timeout-minutes: 10
needs: setup
strategy:
matrix:
target: ${{ fromJSON(needs.setup.outputs.nightly-tier2-targets) }}
action:
- build
- clippy
- doc
steps:
- name: Checkout
uses: actions/checkout@v7
- name: Install Just
uses: taiki-e/install-action@just
- name: Run just
- name: Run build
run: |
just build-tier2 ${{ matrix.target }}
- name: Run clippy
run: |
just clippy-tier2 ${{ matrix.target }}
- name: Run doc
run: |
just ${{ matrix.action }}-tier2 ${{ matrix.target }}
just doc-tier2 ${{ matrix.target }}

# Build the workspace for all tier3 target architectures using rust-toolchain.toml
build-tier3-nightly:
runs-on: ubuntu-24.04
timeout-minutes: 10
needs: setup
strategy:
matrix:
target: ${{ fromJSON(needs.setup.outputs.nightly-tier3-targets) }}
action:
- build
- clippy
- doc
steps:
- name: Checkout
uses: actions/checkout@v7
- name: Install Just
uses: taiki-e/install-action@just
- name: Run just
- name: Run build
run: |
just build-tier3 ${{ matrix.target }}
- name: Run clippy
run: |
just ${{ matrix.action }}-tier3 ${{ matrix.target }}
just clippy-tier3 ${{ matrix.target }}
- name: Run doc
run: |
just doc-tier3 ${{ matrix.target }}

# Build the workspace for all tier3 non atomic target architectures using rust-toolchain.toml
build-tier3-no-atomics:
runs-on: ubuntu-24.04
timeout-minutes: 10
needs: setup
strategy:
matrix:
target: ${{ fromJSON(needs.setup.outputs.nightly-tier3-noatomic-targets) }}
action:
- build
- clippy
- doc
steps:
- name: Checkout
uses: actions/checkout@v7
- name: Install Just
uses: taiki-e/install-action@just
- name: Run just
- name: Run build
run: |
just build-tier3-no-atomics ${{ matrix.target }}
- name: Run clippy
run: |
just clippy-tier3-no-atomics ${{ matrix.target }}
- name: Run doc
run: |
just ${{ matrix.action }}-tier3-no-atomics ${{ matrix.target }}
just doc-tier3-no-atomics ${{ matrix.target }}

# Build the host-only stuff on stable and MSRV
build-arm-targets:
runs-on: ubuntu-24.04
timeout-minutes: 10
needs: setup
strategy:
matrix:
Expand Down Expand Up @@ -165,6 +183,7 @@ jobs:
# Gather all the above build jobs together for the purposes of getting an overall pass-fail
build-all:
runs-on: ubuntu-24.04
timeout-minutes: 10
needs:
- build-tier2-msrv
- build-tier2-stable
Expand All @@ -178,6 +197,7 @@ jobs:
# Format the workspace
fmt-check:
runs-on: ubuntu-24.04
timeout-minutes: 10
needs: setup
steps:
- name: Checkout
Expand All @@ -191,6 +211,7 @@ jobs:
# Run clippy on the examples
clippy-examples:
runs-on: ubuntu-24.04
timeout-minutes: 10
needs: setup
steps:
- name: Checkout
Expand All @@ -208,6 +229,7 @@ jobs:
# Run the unit tests
test-cargo:
runs-on: ubuntu-24.04
timeout-minutes: 10
needs: setup
steps:
- name: Checkout
Expand All @@ -221,6 +243,7 @@ jobs:
# Run some programs in QEMU 9
test-qemu:
runs-on: ubuntu-24.04
timeout-minutes: 10
needs: setup
strategy:
matrix:
Expand Down
43 changes: 21 additions & 22 deletions aarch32-tests/tests/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -137,33 +137,34 @@ fn main() {
for group in MATRIX {
for &target in group.targets {
for variant in group.variants {
let mut name = format!("{}/{}", group.example, target);
if !variant.label.is_empty() {
name.push_str(&format!(" [{}]", variant.label));
}

let example = group.example;
let target = target.to_string();
let rustflags = group.rustflags;
let flags: Vec<&'static str> = group
.flags
.iter()
.chain(variant.extra_flags)
.copied()
.collect();

tests.push(Trial::test(name, move || {
run_target(example, &target, &flags, rustflags);
Ok(())
}));
let dir = test_utils::test_dir(&format!("examples/{example}"));
for bin in test_utils::discover_bins(&dir) {
let target = target.to_string();
let flags: Vec<&'static str> = group
.flags
.iter()
.chain(variant.extra_flags)
.copied()
.collect();
let mut name = format!("{}/{}/{}", group.example, target, bin);
if !variant.label.is_empty() {
name.push_str(&format!(" [{}]", variant.label));
}
tests.push(Trial::test(name, move || {
run_target_bin(example, &bin, &target, &flags, rustflags);
Ok(())
}));
}
}
}
}

libtest_mimic::run(&args, tests).exit();
}

fn run_target(example: &str, target: &str, flags: &[&str], rustflags: Option<&str>) {
fn run_target_bin(example: &str, bin: &str, target: &str, flags: &[&str], rustflags: Option<&str>) {
let dir = test_utils::test_dir(&format!("examples/{example}"));

// Per-example folder: snapshots/<example>/<bin>-<target>.snap
Expand All @@ -174,8 +175,6 @@ fn run_target(example: &str, target: &str, flags: &[&str], rustflags: Option<&st
settings.set_prepend_module_to_snapshot(false);
let _guard = settings.bind_to_scope();

for bin in test_utils::discover_bins(&dir) {
let stdout = test_utils::run_bin(&dir, &bin, target, flags, rustflags);
insta::assert_snapshot!(format!("{bin}-{target}"), stdout);
}
let stdout = test_utils::run_bin(&dir, &bin, target, flags, rustflags);
insta::assert_snapshot!(format!("{bin}-{target}"), stdout);
}
16 changes: 15 additions & 1 deletion examples/mps3-an536-el2/memory.x
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,18 @@ PROVIDE(_irq_stack_size = 8);
PROVIDE(_fiq_stack_size = 8);
PROVIDE(_sys_stack_size = 8);

PROVIDE(_num_cores = 2);
PROVIDE(_num_cores = 2);

EXTERN(_unexpected_undefined_exception_handler);
EXTERN(_unexpected_svc_exception_handler);
EXTERN(_unexpected_hvc_exception_handler);
EXTERN(_unexpected_prefetch_abort_exception_handler);
EXTERN(_unexpected_data_abort_exception_handler);
EXTERN(_unexpected_irq_exception_handler);

PROVIDE(_undefined_handler = _unexpected_undefined_exception_handler);
PROVIDE(_svc_handler = _unexpected_svc_exception_handler);
PROVIDE(_hvc_handler = _unexpected_hvc_exception_handler);
PROVIDE(_prefetch_abort_handler = _unexpected_prefetch_abort_exception_handler);
PROVIDE(_data_abort_handler = _unexpected_data_abort_exception_handler);
PROVIDE(_irq_handler = _unexpected_irq_exception_handler);
36 changes: 36 additions & 0 deletions examples/mps3-an536-el2/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -254,3 +254,39 @@ unsafe fn make_gic() -> arm_gic::gicv3::GicV3<'static> {
arm_gic::gicv3::GicCpuInterface::set_priority_mask(0x80);
gic
}

#[unsafe(no_mangle)]
pub extern "C" fn _unexpected_undefined_exception_handler() -> ! {
semihosting::eprintln!("In _unexpected_undefined_exception_handler!");
semihosting::process::exit(1);
}

#[unsafe(no_mangle)]
pub extern "C" fn _unexpected_svc_exception_handler() -> ! {
semihosting::eprintln!("In _unexpected_svc_exception_handler!");
semihosting::process::exit(1);
}

#[unsafe(no_mangle)]
pub extern "C" fn _unexpected_hvc_exception_handler() -> ! {
semihosting::eprintln!("In _unexpected_hvc_exception_handler!");
semihosting::process::exit(1);
}

#[unsafe(no_mangle)]
pub extern "C" fn _unexpected_prefetch_abort_exception_handler() -> ! {
semihosting::eprintln!("In _unexpected_prefetch_abort_exception_handler!");
semihosting::process::exit(1);
}

#[unsafe(no_mangle)]
pub extern "C" fn _unexpected_data_abort_exception_handler() -> ! {
semihosting::eprintln!("In _unexpected_data_abort_exception_handler!");
semihosting::process::exit(1);
}

#[unsafe(no_mangle)]
pub extern "C" fn _unexpected_irq_exception_handler() -> ! {
semihosting::eprintln!("In _unexpected_irq_exception_handler!");
semihosting::process::exit(1);
}
14 changes: 14 additions & 0 deletions examples/mps3-an536/memory.x
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,17 @@ PROVIDE(_inter_stack_padding = 64);
PROVIDE(_region_alignment = 64K);

PROVIDE(_num_cores = 2);

EXTERN(_unexpected_undefined_exception_handler);
EXTERN(_unexpected_svc_exception_handler);
EXTERN(_unexpected_hvc_exception_handler);
EXTERN(_unexpected_prefetch_abort_exception_handler);
EXTERN(_unexpected_data_abort_exception_handler);
EXTERN(_unexpected_irq_exception_handler);

PROVIDE(_undefined_handler = _unexpected_undefined_exception_handler);
PROVIDE(_svc_handler = _unexpected_svc_exception_handler);
PROVIDE(_hvc_handler = _unexpected_hvc_exception_handler);
PROVIDE(_prefetch_abort_handler = _unexpected_prefetch_abort_exception_handler);
PROVIDE(_data_abort_handler = _unexpected_data_abort_exception_handler);
PROVIDE(_irq_handler = _unexpected_irq_exception_handler);
36 changes: 36 additions & 0 deletions examples/mps3-an536/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -298,3 +298,39 @@ pub extern "C" fn _asm_secondary_core_park() {
fpga_led = const FPGA_LED
);
}

#[unsafe(no_mangle)]
pub extern "C" fn _unexpected_undefined_exception_handler() -> ! {
semihosting::eprintln!("In _unexpected_undefined_exception_handler!");
semihosting::process::exit(1);
}

#[unsafe(no_mangle)]
pub extern "C" fn _unexpected_svc_exception_handler() -> ! {
semihosting::eprintln!("In _unexpected_svc_exception_handler!");
semihosting::process::exit(1);
}

#[unsafe(no_mangle)]
pub extern "C" fn _unexpected_hvc_exception_handler() -> ! {
semihosting::eprintln!("In _unexpected_hvc_exception_handler!");
semihosting::process::exit(1);
}

#[unsafe(no_mangle)]
pub extern "C" fn _unexpected_prefetch_abort_exception_handler() -> ! {
semihosting::eprintln!("In _unexpected_prefetch_abort_exception_handler!");
semihosting::process::exit(1);
}

#[unsafe(no_mangle)]
pub extern "C" fn _unexpected_data_abort_exception_handler() -> ! {
semihosting::eprintln!("In _unexpected_data_abort_exception_handler!");
semihosting::process::exit(1);
}

#[unsafe(no_mangle)]
pub extern "C" fn _unexpected_irq_exception_handler() -> ! {
semihosting::eprintln!("In _unexpected_irq_exception_handler!");
semihosting::process::exit(1);
}
Loading