migrate loader board parameters to board files

This commit is contained in:
bunnie 2024-10-02 01:44:57 +08:00
parent d6790489f1
commit 1eb1a1a671
4 changed files with 5 additions and 16 deletions

View file

@ -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

View file

@ -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,

View file

@ -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 {

View file

@ -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.