Skip to content

CI: fix data_overflow test #542

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 30, 2024
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
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
Loading