Skip to content

Commit

Permalink
CI: reduce duration
Browse files Browse the repository at this point in the history
The data_overflow test takes 3 minutes to compile on my system.
On the GitHub actions runners it takes 10-15 minutes.
I do not know the underlying reason for this.

Splitting up the arrays in data_overflow into smaller 8k chunks does not
change the test outcome, but rustc compiles it in 5 seconds (36x faster).

I also fixed shellcheck warnings in ci.sh
  • Loading branch information
newAM committed Jun 30, 2024
1 parent 2fe5473 commit e8e38bf
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 19 deletions.
24 changes: 12 additions & 12 deletions cortex-m-rt/ci/script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -51,22 +51,22 @@ main() {

for linker in "${linkers[@]}"; do
for ex in "${examples[@]}"; do
cargo rustc --target "$TARGET" --example "$ex" --features "${needed_features}" -- $linker
cargo rustc --target "$TARGET" --example "$ex" --features "${needed_features}" --release -- $linker
cargo rustc --target "$TARGET" --example "$ex" --features "${needed_features}" -- "$linker"
cargo rustc --target "$TARGET" --example "$ex" --features "${needed_features}" --release -- "$linker"
done
for ex in "${fail_examples[@]}"; do
! cargo rustc --target "$TARGET" --example "$ex" --features "${needed_features}" -- $linker
! cargo rustc --target "$TARGET" --example "$ex" --features "${needed_features}" --release -- $linker
! cargo rustc --target "$TARGET" --example "$ex" --features "${needed_features}" -- "$linker" && exit 1
! cargo rustc --target "$TARGET" --example "$ex" --features "${needed_features}" --release -- "$linker" && exit 1
done
cargo rustc --target "$TARGET" --example device --features "device,${needed_features}" -- $linker
cargo rustc --target "$TARGET" --example device --features "device,${needed_features}" --release -- $linker
cargo rustc --target "$TARGET" --example device --features "device,${needed_features}" -- "$linker"
cargo rustc --target "$TARGET" --example device --features "device,${needed_features}" --release -- "$linker"

cargo rustc --target "$TARGET" --example minimal --features "set-sp,${needed_features}" -- $linker
cargo rustc --target "$TARGET" --example minimal --features "set-sp,${needed_features}" --release -- $linker
cargo rustc --target "$TARGET" --example minimal --features "zero-init-ram,${needed_features}" -- $linker
cargo rustc --target "$TARGET" --example minimal --features "zero-init-ram,${needed_features}" --release -- $linker
cargo rustc --target "$TARGET" --example minimal --features "set-vtor,${needed_features}" -- $linker
cargo rustc --target "$TARGET" --example minimal --features "set-vtor,${needed_features}" --release -- $linker
cargo rustc --target "$TARGET" --example minimal --features "set-sp,${needed_features}" -- "$linker"
cargo rustc --target "$TARGET" --example minimal --features "set-sp,${needed_features}" --release -- "$linker"
cargo rustc --target "$TARGET" --example minimal --features "zero-init-ram,${needed_features}" -- "$linker"
cargo rustc --target "$TARGET" --example minimal --features "zero-init-ram,${needed_features}" --release -- "$linker"
cargo rustc --target "$TARGET" --example minimal --features "set-vtor,${needed_features}" -- "$linker"
cargo rustc --target "$TARGET" --example minimal --features "set-vtor,${needed_features}" --release -- "$linker"
done
fi

Expand Down
27 changes: 20 additions & 7 deletions cortex-m-rt/examples/data_overflow.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,31 @@ use core::ptr;

use rt::entry;

// This large static array uses most of .rodata
static RODATA: [u8; 48 * 1024] = [1u8; 48 * 1024];

// This large mutable array causes .data to use the rest of FLASH
// Large static arrays uses most of .rodata
static RODATA_0: [u8; 8 * 1024] = [1u8; 8 * 1024];
static RODATA_1: [u8; 8 * 1024] = [1u8; 8 * 1024];
static RODATA_2: [u8; 8 * 1024] = [1u8; 8 * 1024];
static RODATA_3: [u8; 8 * 1024] = [1u8; 8 * 1024];
static RODATA_4: [u8; 8 * 1024] = [1u8; 8 * 1024];
static RODATA_5: [u8; 8 * 1024] = [1u8; 8 * 1024];

// These large mutable arrays causes .data to use the rest of FLASH
// without also overflowing RAM.
static mut DATA: [u8; 16 * 1024] = [1u8; 16 * 1024];
static mut DATA_0: [u8; 8 * 1024] = [1u8; 8 * 1024];
static mut DATA_1: [u8; 8 * 1024] = [1u8; 8 * 1024];

#[entry]
fn main() -> ! {
unsafe {
let _bigdata = ptr::read_volatile(ptr::addr_of!(RODATA));
let _bigdata = ptr::read_volatile(ptr::addr_of!(DATA));
let _ = ptr::read_volatile(ptr::addr_of!(RODATA_0));
let _ = ptr::read_volatile(ptr::addr_of!(RODATA_1));
let _ = ptr::read_volatile(ptr::addr_of!(RODATA_2));
let _ = ptr::read_volatile(ptr::addr_of!(RODATA_3));
let _ = ptr::read_volatile(ptr::addr_of!(RODATA_4));
let _ = ptr::read_volatile(ptr::addr_of!(RODATA_5));

let _ = ptr::read_volatile(ptr::addr_of!(DATA_0));
let _ = ptr::read_volatile(ptr::addr_of!(DATA_1));
}

loop {}
Expand Down

0 comments on commit e8e38bf

Please sign in to comment.