diff --git a/services/spinor/Cargo.toml b/services/spinor/Cargo.toml index e9e9e7633..b23093e0e 100644 --- a/services/spinor/Cargo.toml +++ b/services/spinor/Cargo.toml @@ -16,6 +16,7 @@ susres = { package = "xous-api-susres", version = "0.9.63" } trng = { path = "../trng" } com = { path = "../com" } llio = { path = "../llio" } +precursor-hal = { path = "../../libs/precursor-hal" } rkyv = { version = "0.8.8", default-features = false, features = [ "std", diff --git a/services/spinor/src/main.rs b/services/spinor/src/main.rs index d3010861d..bb1d954a5 100644 --- a/services/spinor/src/main.rs +++ b/services/spinor/src/main.rs @@ -7,6 +7,7 @@ use std::collections::HashSet; use api::*; use num_traits::*; +use precursor_hal::board::*; use xous::{msg_blocking_scalar_unpack, msg_scalar_unpack}; use xous_ipc::Buffer; @@ -929,10 +930,9 @@ fn main() -> ! { let mut wr = buffer.to_original::().unwrap(); let mut authorized = true; if let Some(st) = soc_token { - if staging_write_protect - && ((wr.start >= xous::SOC_REGION_LOC) && (wr.start < xous::LOADER_LOC)) + if staging_write_protect && ((wr.start >= SOC_REGION_LOC) && (wr.start < LOADER_LOC)) || !staging_write_protect - && ((wr.start >= xous::SOC_REGION_LOC) && (wr.start < xous::SOC_STAGING_GW_LOC)) + && ((wr.start >= SOC_REGION_LOC) && (wr.start < SOC_STAGING_GW_LOC)) { // if only the holder of the ID that matches the SoC token can write to the SOC flash // area other areas are not as strictly controlled because @@ -972,9 +972,7 @@ fn main() -> ! { let mut wr = buffer.to_original::().unwrap(); // bounds check to within the PDDB region for bulk erases. Please use standard patching for // other regions. - let authorized = if (wr.start >= xous::PDDB_LOC) - && ((wr.start + wr.len) <= (xous::PDDB_LOC + xous::PDDB_LEN)) - { + let authorized = if (wr.start >= PDDB_LOC) && ((wr.start + wr.len) <= (PDDB_LOC + PDDB_LEN)) { true } else { false