From feca35c7c12b3ad2fb8cd5c4e48003da2b283b8b Mon Sep 17 00:00:00 2001 From: Ian McIntyre Date: Thu, 22 Feb 2024 16:55:34 -0500 Subject: Add environment variable overrides for stack, heap If you define a runtime, you can call `stack_size_env_override` to define an optional environment variable checked by the runtime builder. Same goes for the heap. A user can set these environment variables to override the runtime's stack / heap size. You can use this package's examples to try it out; see the updated build script. There's no default environment variable for either memory region. The package that defines the runtime needs to opt-in to this feature. --- board/build.rs | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'board/build.rs') diff --git a/board/build.rs b/board/build.rs index 9ee64e8..8474e85 100644 --- a/board/build.rs +++ b/board/build.rs @@ -28,6 +28,9 @@ fn main() { .data(imxrt_rt::Memory::Dtcm) .bss(imxrt_rt::Memory::Dtcm) .uninit(imxrt_rt::Memory::Dtcm) + .stack_size_env_override("THIS_WONT_BE_CONSIDERED") + .stack_size_env_override("BOARD_STACK") + .heap_size_env_override("BOARD_HEAP") .build() .unwrap() } @@ -37,6 +40,8 @@ fn main() { ) .heap_size(1024) .rodata(imxrt_rt::Memory::Flash) + .stack_size_env_override("BOARD_STACK") + .heap_size_env_override("BOARD_HEAP") .build() .unwrap(), "imxrt1170evk_cm7" => imxrt_rt::RuntimeBuilder::from_flexspi( @@ -44,6 +49,8 @@ fn main() { 16 * 1024 * 1024, ) .rodata(imxrt_rt::Memory::Dtcm) + .stack_size_env_override("BOARD_STACK") + .heap_size_env_override("BOARD_HEAP") .build() .unwrap(), _ => continue, -- cgit v1.2.3