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).
  • Loading branch information
newAM committed Jun 30, 2024
1 parent 2fe5473 commit d105ded
Showing 1 changed file with 20 additions and 7 deletions.
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 d105ded

Please sign in to comment.