diff --git a/loader/src/lib.rs b/loader/src/lib.rs index 3b047db27..e9e285a04 100644 --- a/loader/src/lib.rs +++ b/loader/src/lib.rs @@ -26,10 +26,10 @@ pub const FLG_SWAP_USED: u32 = 0x8000_0000; // 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; +pub const UART_IFRAM_ADDR: usize = cramium_hal::board::UART_DMA_TX_BUF_PHYS; #[allow(dead_code)] #[cfg(feature = "cramium-soc")] -pub const APP_UART_IFRAM_ADDR: usize = utralib::HW_IFRAM0_MEM + utralib::HW_IFRAM0_MEM_LEN - 3 * 4096; +pub const APP_UART_IFRAM_ADDR: usize = cramium_hal::board::APP_UART_IFRAM_ADDR; /// This is the amount of space that the loader stack will occupy as it runs, assuming no swap and giving one /// page for the clean suspend marker diff --git a/loader/src/platform/cramium/cramium.rs b/loader/src/platform/cramium/cramium.rs index f3f87fcae..e1110063c 100644 --- a/loader/src/platform/cramium/cramium.rs +++ b/loader/src/platform/cramium/cramium.rs @@ -333,11 +333,11 @@ pub fn early_init() { #[cfg(feature = "spim-test")] { + use cramium_hal::board::{SPIM_FLASH_IFRAM_ADDR, SPIM_RAM_IFRAM_ADDR}; use cramium_hal::ifram::IframRange; use cramium_hal::iox::*; use cramium_hal::udma::*; use loader::swap::SPIM_FLASH_IFRAM_ADDR; - use loader::swap::SPIM_RAM_IFRAM_ADDR; fn setup_port( iox: &mut Iox, diff --git a/loader/src/platform/cramium/swap.rs b/loader/src/platform/cramium/swap.rs index 102380298..7513f9c3b 100644 --- a/loader/src/platform/cramium/swap.rs +++ b/loader/src/platform/cramium/swap.rs @@ -1,12 +1,11 @@ use core::mem::size_of; use aes_gcm_siv::{AeadInPlace, Aes256GcmSiv, KeyInit, Nonce, Tag}; +use cramium_hal::board::{APP_UART_IFRAM_ADDR, SPIM_FLASH_IFRAM_ADDR, SPIM_RAM_IFRAM_ADDR}; use cramium_hal::ifram::IframRange; use cramium_hal::iox::*; use cramium_hal::sce; use cramium_hal::udma::*; -use loader::APP_UART_IFRAM_ADDR; -use loader::swap::SPIM_RAM_IFRAM_ADDR; use rand_chacha::ChaCha8Rng; use rand_chacha::rand_core::RngCore; use rand_chacha::rand_core::SeedableRng; @@ -44,7 +43,7 @@ impl SwapHal { // setup the I/O pins let iox = Iox::new(utralib::generated::HW_IOX_BASE as *mut u32); let channel = cramium_hal::board::setup_memory_pins(&iox); - udma_global.clock_off(PeriphId::from(channel)); + udma_global.clock_on(PeriphId::from(channel)); // safety: this is safe because clocks have been set up let mut flash_spim = unsafe { diff --git a/loader/src/swap.rs b/loader/src/swap.rs index 101712029..af1a68474 100644 --- a/loader/src/swap.rs +++ b/loader/src/swap.rs @@ -98,16 +98,6 @@ pub struct SwapSpec { pub sram_size: u32, } -// 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 - 5 * 4096; - /// Function that derives the usable amount of swap space from the total length of swap memory available. /// This is used repeatedly in the initialization process to define the boundary between the swap page /// storage and the message authentication code (MAC) tables.