Skip to content

Commit

Permalink
Merge pull request #542 from newAM/ci-fix-duration
Browse files Browse the repository at this point in the history
CI: fix data_overflow test
  • Loading branch information
newAM authored Jun 30, 2024
2 parents 21960da + 192e2f7 commit 0b17bdb
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
4 changes: 2 additions & 2 deletions cortex-m-rt/ci/script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ main() {
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
Expand Down
11 changes: 6 additions & 5 deletions cortex-m-rt/examples/data_overflow.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,22 @@ extern crate cortex_m_rt as rt;
extern crate panic_halt;

use core::ptr;

use rt::entry;

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

// This large mutable array causes .data to use the rest of FLASH
// without also overflowing RAM.
static mut DATA: [u8; 16 * 1024] = [1u8; 16 * 1024];
const DATA_SIZE: usize = 8 * 1024;
static mut DATA: [u8; DATA_SIZE] = [1u8; DATA_SIZE];

#[entry]
fn main() -> ! {
unsafe {
let _bigdata = ptr::read_volatile(ptr::addr_of!(RODATA));
let _bigdata = ptr::read_volatile(ptr::addr_of!(DATA));
let _bigdata: u8 = ptr::read_volatile(ptr::addr_of!(RODATA) as *const u8);
let _bigdata: u8 = ptr::read_volatile(ptr::addr_of!(DATA) as *const u8);
}

loop {}
Expand Down

0 comments on commit 0b17bdb

Please sign in to comment.