Skip to content

Commit 7bd8e74

Browse files
authored
Merge pull request #542 from newAM/ci-fix-duration
CI: fix data_overflow test
2 parents 2fe5473 + 192e2f7 commit 7bd8e74

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

cortex-m-rt/ci/script.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,8 @@ main() {
5555
cargo rustc --target "$TARGET" --example "$ex" --features "${needed_features}" --release -- $linker
5656
done
5757
for ex in "${fail_examples[@]}"; do
58-
! cargo rustc --target "$TARGET" --example "$ex" --features "${needed_features}" -- $linker
59-
! cargo rustc --target "$TARGET" --example "$ex" --features "${needed_features}" --release -- $linker
58+
cargo rustc --target "$TARGET" --example "$ex" --features "${needed_features}" -- $linker && exit 1
59+
cargo rustc --target "$TARGET" --example "$ex" --features "${needed_features}" --release -- $linker && exit 1
6060
done
6161
cargo rustc --target "$TARGET" --example device --features "device,${needed_features}" -- $linker
6262
cargo rustc --target "$TARGET" --example device --features "device,${needed_features}" --release -- $linker

cortex-m-rt/examples/data_overflow.rs

+6-5
Original file line numberDiff line numberDiff line change
@@ -9,21 +9,22 @@ extern crate cortex_m_rt as rt;
99
extern crate panic_halt;
1010

1111
use core::ptr;
12-
1312
use rt::entry;
1413

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

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

2223
#[entry]
2324
fn main() -> ! {
2425
unsafe {
25-
let _bigdata = ptr::read_volatile(ptr::addr_of!(RODATA));
26-
let _bigdata = ptr::read_volatile(ptr::addr_of!(DATA));
26+
let _bigdata: u8 = ptr::read_volatile(ptr::addr_of!(RODATA) as *const u8);
27+
let _bigdata: u8 = ptr::read_volatile(ptr::addr_of!(DATA) as *const u8);
2728
}
2829

2930
loop {}

0 commit comments

Comments
 (0)