From d434e700755ac0aa73307fda88d715081eb5b563 Mon Sep 17 00:00:00 2001 From: bunnie Date: Fri, 3 May 2024 16:04:37 +0800 Subject: [PATCH] move the IFRAM specifiers to a more public location The IFRAM allocation used by the loader is now exposed so we can pick it up and use it in the actual HAL implementation in usermode. --- loader/src/platform/cramium/cramium.rs | 10 ---------- loader/src/swap.rs | 16 +++++++++++++++- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/loader/src/platform/cramium/cramium.rs b/loader/src/platform/cramium/cramium.rs index 83c5452d3..e93f910b0 100644 --- a/loader/src/platform/cramium/cramium.rs +++ b/loader/src/platform/cramium/cramium.rs @@ -19,16 +19,6 @@ pub const RAM_SIZE: usize = utralib::generated::HW_SRAM_MEM_LEN; pub const RAM_BASE: usize = utralib::generated::HW_SRAM_MEM; pub const FLASH_BASE: usize = utralib::generated::HW_RERAM_MEM; -// Locate the hard-wired IFRAM allocations for UDMA -pub const UART_IFRAM_ADDR: usize = utralib::HW_IFRAM0_MEM + utralib::HW_IFRAM0_MEM_LEN - 4096; -// RAM needs two buffers of 1k + 16 bytes = 2048 + 16 = 2064 bytes; round up to one page -#[allow(dead_code)] -pub const SPIM_RAM_IFRAM_ADDR: usize = utralib::HW_IFRAM0_MEM + utralib::HW_IFRAM0_MEM_LEN - 2 * 4096; -// Flash will be released after the loader is done: it's only accessed to copy the IniS sectors into swap, -// then abandoned. It needs 4096 bytes for Rx, and 0 bytes for Tx + 16 bytes for cmd. -#[allow(dead_code)] -pub const SPIM_FLASH_IFRAM_ADDR: usize = utralib::HW_IFRAM0_MEM + utralib::HW_IFRAM0_MEM_LEN - 4 * 4096; - // location of kernel, as offset from the base of ReRAM. This needs to match up with what is in link.x. // exclusive of the signature block offset pub const KERNEL_OFFSET: usize = 0x4_0000; diff --git a/loader/src/swap.rs b/loader/src/swap.rs index f9234844a..6aa0e6c0c 100644 --- a/loader/src/swap.rs +++ b/loader/src/swap.rs @@ -59,6 +59,20 @@ pub struct SwapSpec { pub swap_len: u32, /// Base of the message authentication code (MAC) region pub mac_base: u32, - /// LENGTH of the MAC region in bytes + /// Length of the MAC region in bytes pub mac_len: u32, } + +// Locate the hard-wired IFRAM allocations for UDMA +#[allow(dead_code)] +#[cfg(feature = "cramium-soc")] +pub const UART_IFRAM_ADDR: usize = utralib::HW_IFRAM0_MEM + utralib::HW_IFRAM0_MEM_LEN - 4096; +// RAM needs two buffers of 1k + 16 bytes = 2048 + 16 = 2064 bytes; round up to one page +#[allow(dead_code)] +#[cfg(feature = "cramium-soc")] +pub const SPIM_RAM_IFRAM_ADDR: usize = utralib::HW_IFRAM0_MEM + utralib::HW_IFRAM0_MEM_LEN - 2 * 4096; +// Flash will be released after the loader is done: it's only accessed to copy the IniS sectors into swap, +// then abandoned. It needs 4096 bytes for Rx, and 0 bytes for Tx + 16 bytes for cmd. +#[allow(dead_code)] +#[cfg(feature = "cramium-soc")] +pub const SPIM_FLASH_IFRAM_ADDR: usize = utralib::HW_IFRAM0_MEM + utralib::HW_IFRAM0_MEM_LEN - 4 * 4096;