reserve ifram locs for swap and/or app uart

This commit is contained in:
bunnie 2024-05-04 01:46:38 +08:00
parent a6a3d29836
commit f85f1a07f3
2 changed files with 12 additions and 4 deletions

View file

@ -32,6 +32,7 @@ rkyv = { version = "0.4.3", default-features = false, features = [
[features]
app-uart = []
swap = []
# add this feature to enable pre-emption
quantum-timer = ["utralib"]
default = ["quantum-timer", "app-uart"]

View file

@ -9,7 +9,9 @@ use cramium_hal::{
use utralib::utra;
#[cfg(feature = "quantum-timer")]
use utralib::*;
use xous::{sender::Sender, SWAPPER_PID};
use xous::sender::Sender;
#[cfg(feature = "swap")]
use xous::SWAPPER_PID;
use xous_pio::*;
struct PreemptionHw {
@ -104,9 +106,14 @@ fn main() {
ifram_allocs[0][31] = Some(Sender::from_usize(usize::MAX));
// Second page from top of IFRAM0 is occupied by the swap handler. This was allocated
// by the loader, before the kernel even started.
ifram_allocs[0][30] = Some(Sender::from_usize(SWAPPER_PID as usize));
#[cfg(feature="app-uart")]
ifram_allocs[0][29] = Some(Sender::from_usize(SWAPPER_PID as usize)); // currently allocated to swapper for debug
#[cfg(feature = "swap")]
{
ifram_allocs[0][30] = Some(Sender::from_usize(SWAPPER_PID as usize));
}
#[cfg(feature = "app-uart")]
{
ifram_allocs[0][29] = Some(Sender::from_usize(usize::MAX));
}
let iox_page = xous::syscall::map_memory(
xous::MemoryAddress::new(utralib::generated::HW_IOX_BASE),