From 6f5633761528e484e8d0963c7ac59403f7210093 Mon Sep 17 00:00:00 2001 From: Ian McIntyre Date: Mon, 13 Mar 2023 06:50:57 -0400 Subject: Prototype API to build runtime in RAM Just a proof-of-concept. The new inspect_elf test seems to show that we're building the correct image. We need another commit in order to help the program run in FlexRAM. --- src/host.rs | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'src') diff --git a/src/host.rs b/src/host.rs index 6a01f9d..56a9d0f 100644 --- a/src/host.rs +++ b/src/host.rs @@ -401,6 +401,27 @@ impl RuntimeBuilder { linker_script_name: DEFAULT_LINKER_SCRIPT_NAME.into(), } } + + /// Create a runtime that executes from RAM. + pub fn from_ram(family: Family) -> Self { + Self { + family, + flexram_banks: family.default_flexram_banks(), + text: Memory::Itcm, + rodata: Memory::Ocram, + data: Memory::Ocram, + vectors: Memory::Dtcm, + bss: Memory::Ocram, + uninit: Memory::Ocram, + stack: Memory::Dtcm, + stack_size: EnvOverride::new(8 * 1024), + heap: Memory::Dtcm, + heap_size: EnvOverride::new(0), + flash_opts: None, + linker_script_name: DEFAULT_LINKER_SCRIPT_NAME.into(), + } + } + /// Set the FlexRAM bank allocation. /// /// Use this to customize the sizes of DTCM, ITCM, and OCRAM. -- cgit v1.2.3