From f76dd23067fe23546be70436873128fa006699c2 Mon Sep 17 00:00:00 2001 From: bunnie Date: Sun, 11 May 2025 14:40:19 +0800 Subject: [PATCH] fix weird PDDB dependency issue more of a work-around than anything else. the observation is the PDDB_A* series of constants aren't used outide of the crate for gen2-targets and so we just remove it as a dependency in the lib.rs side of things. This clears up the cargo error we're getting. still don't know why the dependency tree is not working for that particular target, but someone is pulling a pddb dependency and it's not obvious who. --- services/pddb/Cargo.toml | 4 ++-- services/pddb/src/api.rs | 4 ---- services/pddb/src/backend/hosted.rs | 2 +- services/pddb/src/backend/hw.rs | 2 +- services/pddb/src/main.rs | 5 +++++ 5 files changed, 9 insertions(+), 8 deletions(-) diff --git a/services/pddb/Cargo.toml b/services/pddb/Cargo.toml index c4792b0a2..b4125208b 100644 --- a/services/pddb/Cargo.toml +++ b/services/pddb/Cargo.toml @@ -91,7 +91,7 @@ gen1 = [ "modals", "precursor-hal", ] -gen2 = ["keystore", "keystore-api/gen2", "cramium-hal"] +gen2 = ["keystore", "keystore-api/gen2"] # gen 1 targets precursor = ["utralib/precursor", "sha2/precursor", "gen1"] hosted = ["utralib/hosted", "sha2/hosted", "gen1"] @@ -119,7 +119,7 @@ board-baosor = [ ] # Precursor form factor # board-dabao is not a valid target as it lacks external SPI flash -doc-deps = [] +doc-deps = ["precursor-hal"] # when selected, physical disk addresses are set to 64 bits, otherwise, they are 32 bits. # 32 bit addressing is recommended for Precursor, as its disk is only 128MiB and it has limited RAM for bookkeeping. diff --git a/services/pddb/src/api.rs b/services/pddb/src/api.rs index a1429cba0..6f6294d15 100644 --- a/services/pddb/src/api.rs +++ b/services/pddb/src/api.rs @@ -55,12 +55,8 @@ pub(crate) const PDDB_A_LEN: usize = precursor_hal::board::PDDB_LEN as usize; not(feature = "gen2") ))] pub const PDDB_A_LEN: usize = 4 * 1024 * 1024; -#[cfg(feature = "gen2")] -pub const PDDB_A_LEN: usize = cramium_hal::board::PDDB_LEN as usize; #[cfg(feature = "gen1")] pub const PDDB_A_LOC: u32 = precursor_hal::board::PDDB_LOC as u32; -#[cfg(feature = "gen2")] -pub const PDDB_A_LOC: u32 = cramium_hal::board::PDDB_LOC as u32; /// range for the starting point of a journal number, picked from a random seed /// the goal is to reduce info leakage about the age of structures relative to each other diff --git a/services/pddb/src/backend/hosted.rs b/services/pddb/src/backend/hosted.rs index b4b6afbc1..1c2ecb5d9 100644 --- a/services/pddb/src/backend/hosted.rs +++ b/services/pddb/src/backend/hosted.rs @@ -6,7 +6,7 @@ use std::io::prelude::*; use std::mem::MaybeUninit; use std::sync::Once; -use crate::api::*; +use crate::{PDDB_A_LEN, PDDB_A_LOC}; // This is considered bad practice for Rust to use a global singleton. // However, this hack puts the burden of emulation on the emulator, while diff --git a/services/pddb/src/backend/hw.rs b/services/pddb/src/backend/hw.rs index f89256448..39f545a48 100644 --- a/services/pddb/src/backend/hw.rs +++ b/services/pddb/src/backend/hw.rs @@ -28,7 +28,7 @@ use sha2::{Digest, Sha512_256Hw, Sha512_256Sw}; use spinor::{SPINOR_BULK_ERASE_SIZE, SPINOR_ERASE_SIZE}; use subtle::ConstantTimeEq; -use crate::api::PDDB_A_LOC; +use crate::PDDB_A_LOC; use crate::*; #[cfg(not(feature = "deterministic"))] diff --git a/services/pddb/src/main.rs b/services/pddb/src/main.rs index 0e39ec446..5f049575b 100644 --- a/services/pddb/src/main.rs +++ b/services/pddb/src/main.rs @@ -485,6 +485,11 @@ use rkyv::{ use xous::{Message, msg_blocking_scalar_unpack, send_message}; use xous_ipc::Buffer; +#[cfg(feature = "gen2")] +pub const PDDB_A_LEN: usize = PDDB_LEN as usize; +#[cfg(feature = "gen2")] +pub const PDDB_A_LOC: u32 = PDDB_LOC as u32; + #[cfg(feature = "perfcounter")] const FILE_ID_SERVICES_PDDB_SRC_MAIN: u32 = 0; #[cfg(feature = "perfcounter")]