Skip to content

Commit

Permalink
boards: update to use capsules-system
Browse files Browse the repository at this point in the history
  • Loading branch information
bradjc committed May 14, 2024
1 parent 327577b commit ef96f80
Show file tree
Hide file tree
Showing 91 changed files with 230 additions and 107 deletions.
1 change: 1 addition & 0 deletions boards/acd52832/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,4 @@ nrf52_components = { path = "../nordic/nrf52_components" }

capsules-core = { path = "../../capsules/core" }
capsules-extra = { path = "../../capsules/extra" }
capsules-system = { path = "../../capsules/system" }
3 changes: 2 additions & 1 deletion boards/acd52832/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ pub mod io;

// State for loading and holding applications.
// How should the kernel respond when a process faults.
const FAULT_RESPONSE: kernel::process::PanicFaultPolicy = kernel::process::PanicFaultPolicy {};
const FAULT_RESPONSE: capsules_system::process_policies::PanicFaultPolicy =
capsules_system::process_policies::PanicFaultPolicy {};

// Number of concurrent processes this platform supports.
const NUM_PROCS: usize = 4;
Expand Down
1 change: 1 addition & 0 deletions boards/apollo3/lora_things_plus/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,4 @@ apollo3 = { path = "../../../chips/apollo3" }

capsules-core = { path = "../../../capsules/core" }
capsules-extra = { path = "../../../capsules/extra" }
capsules-system = { path = "../../../capsules/system" }
6 changes: 4 additions & 2 deletions boards/apollo3/lora_things_plus/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,12 @@ static mut PROCESSES: [Option<&'static dyn kernel::process::Process>; NUM_PROCS]
// Static reference to chip for panic dumps.
static mut CHIP: Option<&'static apollo3::chip::Apollo3<Apollo3DefaultPeripherals>> = None;
// Static reference to process printer for panic dumps.
static mut PROCESS_PRINTER: Option<&'static kernel::process::ProcessPrinterText> = None;
static mut PROCESS_PRINTER: Option<&'static capsules_system::process_printer::ProcessPrinterText> =
None;

// How should the kernel respond when a process faults.
const FAULT_RESPONSE: kernel::process::PanicFaultPolicy = kernel::process::PanicFaultPolicy {};
const FAULT_RESPONSE: capsules_system::process_policies::PanicFaultPolicy =
capsules_system::process_policies::PanicFaultPolicy {};

// Test access to the peripherals
#[cfg(test)]
Expand Down
1 change: 1 addition & 0 deletions boards/apollo3/redboard_artemis_atp/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,4 @@ apollo3 = { path = "../../../chips/apollo3" }

capsules-core = { path = "../../../capsules/core" }
capsules-extra = { path = "../../../capsules/extra" }
capsules-system = { path = "../../../capsules/system" }
6 changes: 4 additions & 2 deletions boards/apollo3/redboard_artemis_atp/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,12 @@ static mut PROCESSES: [Option<&'static dyn kernel::process::Process>; NUM_PROCS]
// Static reference to chip for panic dumps.
static mut CHIP: Option<&'static apollo3::chip::Apollo3<Apollo3DefaultPeripherals>> = None;
// Static reference to process printer for panic dumps.
static mut PROCESS_PRINTER: Option<&'static kernel::process::ProcessPrinterText> = None;
static mut PROCESS_PRINTER: Option<&'static capsules_system::process_printer::ProcessPrinterText> =
None;

// How should the kernel respond when a process faults.
const FAULT_RESPONSE: kernel::process::PanicFaultPolicy = kernel::process::PanicFaultPolicy {};
const FAULT_RESPONSE: capsules_system::process_policies::PanicFaultPolicy =
capsules_system::process_policies::PanicFaultPolicy {};

// Test access to the peripherals
#[cfg(test)]
Expand Down
1 change: 1 addition & 0 deletions boards/apollo3/redboard_artemis_nano/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,4 @@ apollo3 = { path = "../../../chips/apollo3" }

capsules-core = { path = "../../../capsules/core" }
capsules-extra = { path = "../../../capsules/extra" }
capsules-system = { path = "../../../capsules/system" }
6 changes: 4 additions & 2 deletions boards/apollo3/redboard_artemis_nano/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,12 @@ static mut PROCESSES: [Option<&'static dyn kernel::process::Process>; NUM_PROCS]
// Static reference to chip for panic dumps.
static mut CHIP: Option<&'static apollo3::chip::Apollo3<Apollo3DefaultPeripherals>> = None;
// Static reference to process printer for panic dumps.
static mut PROCESS_PRINTER: Option<&'static kernel::process::ProcessPrinterText> = None;
static mut PROCESS_PRINTER: Option<&'static capsules_system::process_printer::ProcessPrinterText> =
None;

// How should the kernel respond when a process faults.
const FAULT_RESPONSE: kernel::process::PanicFaultPolicy = kernel::process::PanicFaultPolicy {};
const FAULT_RESPONSE: capsules_system::process_policies::PanicFaultPolicy =
capsules_system::process_policies::PanicFaultPolicy {};

// Test access to the peripherals
#[cfg(test)]
Expand Down
1 change: 1 addition & 0 deletions boards/arty_e21/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,4 @@ sifive = { path = "../../chips/sifive" }

capsules-core = { path = "../../capsules/core" }
capsules-extra = { path = "../../capsules/extra" }
capsules-system = { path = "../../capsules/system" }
6 changes: 4 additions & 2 deletions boards/arty_e21/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,17 @@ pub mod io;
const NUM_PROCS: usize = 4;

// How should the kernel respond when a process faults.
const FAULT_RESPONSE: kernel::process::PanicFaultPolicy = kernel::process::PanicFaultPolicy {};
const FAULT_RESPONSE: capsules_system::process_policies::PanicFaultPolicy =
capsules_system::process_policies::PanicFaultPolicy {};

// Actual memory for holding the active process structures.
static mut PROCESSES: [Option<&'static dyn kernel::process::Process>; NUM_PROCS] =
[None, None, None, None];

// Reference to the chip for panic dumps.
static mut CHIP: Option<&'static arty_e21_chip::chip::ArtyExx<ArtyExxDefaultPeripherals>> = None;
static mut PROCESS_PRINTER: Option<&'static kernel::process::ProcessPrinterText> = None;
static mut PROCESS_PRINTER: Option<&'static capsules_system::process_printer::ProcessPrinterText> =
None;

/// Dummy buffer that causes the linker to reserve enough space for the stack.
#[no_mangle]
Expand Down
1 change: 1 addition & 0 deletions boards/clue_nrf52840/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,4 @@ nrf52_components = { path = "../nordic/nrf52_components" }

capsules-core = { path = "../../capsules/core" }
capsules-extra = { path = "../../capsules/extra" }
capsules-system = { path = "../../capsules/system" }
7 changes: 4 additions & 3 deletions boards/clue_nrf52840/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,8 @@ pub mod io;

// State for loading and holding applications.
// How should the kernel respond when a process faults.
const FAULT_RESPONSE: kernel::process::StopWithDebugFaultPolicy =
kernel::process::StopWithDebugFaultPolicy {};
const FAULT_RESPONSE: capsules_system::process_policies::StopWithDebugFaultPolicy =
capsules_system::process_policies::StopWithDebugFaultPolicy {};

// Number of concurrent processes this platform supports.
const NUM_PROCS: usize = 8;
Expand All @@ -113,7 +113,8 @@ static mut PROCESSES: [Option<&'static dyn kernel::process::Process>; NUM_PROCS]
[None; NUM_PROCS];

static mut CHIP: Option<&'static nrf52840::chip::NRF52<Nrf52840DefaultPeripherals>> = None;
static mut PROCESS_PRINTER: Option<&'static kernel::process::ProcessPrinterText> = None;
static mut PROCESS_PRINTER: Option<&'static capsules_system::process_printer::ProcessPrinterText> =
None;
static mut CDC_REF_FOR_PANIC: Option<
&'static capsules_extra::usb::cdc::CdcAcm<
'static,
Expand Down
1 change: 1 addition & 0 deletions boards/components/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@ kernel = { path = "../../kernel" }

capsules-core = { path = "../../capsules/core" }
capsules-extra = { path = "../../capsules/extra" }
capsules-system = { path = "../../capsules/system" }
19 changes: 12 additions & 7 deletions boards/components/src/appid/assigner_name.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use kernel::component::Component;
macro_rules! appid_assigner_names_component_static {
() => {{
kernel::static_buf!(
kernel::process_checker::basic::AppIdAssignerNames<fn(&'static str) -> u32>
capsules_system::process_checker::basic::AppIdAssignerNames<fn(&'static str) -> u32>
)
};};
}
Expand All @@ -26,18 +26,23 @@ impl AppIdAssignerNamesComponent {

impl Component for AppIdAssignerNamesComponent {
type StaticInput = &'static mut MaybeUninit<
kernel::process_checker::basic::AppIdAssignerNames<'static, fn(&'static str) -> u32>,
capsules_system::process_checker::basic::AppIdAssignerNames<
'static,
fn(&'static str) -> u32,
>,
>;

type Output = &'static kernel::process_checker::basic::AppIdAssignerNames<
type Output = &'static capsules_system::process_checker::basic::AppIdAssignerNames<
'static,
fn(&'static str) -> u32,
>;

fn finalize(self, s: Self::StaticInput) -> Self::Output {
s.write(kernel::process_checker::basic::AppIdAssignerNames::new(
&((|s| kernel::utilities::helpers::crc32_posix(s.as_bytes()))
as fn(&'static str) -> u32),
))
s.write(
capsules_system::process_checker::basic::AppIdAssignerNames::new(
&((|s| kernel::utilities::helpers::crc32_posix(s.as_bytes()))
as fn(&'static str) -> u32),
),
)
}
}
3 changes: 2 additions & 1 deletion boards/components/src/appid/checker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ macro_rules! process_checker_machine_component_static {
};};
}

pub type ProcessCheckerMachineComponentType = kernel::process_checker::basic::AppCheckerSha256;
pub type ProcessCheckerMachineComponentType =
capsules_system::process_checker::basic::AppCheckerSha256;

pub struct ProcessCheckerMachineComponent {
policy: &'static dyn kernel::process_checker::AppCredentialsPolicy<'static>,
Expand Down
16 changes: 8 additions & 8 deletions boards/components/src/appid/checker_sha.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,14 @@ use kernel::hil::digest;
macro_rules! app_checker_sha256_component_static {
() => {{
let buffer = kernel::static_buf!([u8; 32]);
let checker = kernel::static_buf!(kernel::process_checker::basic::AppCheckerSha256);
let checker =
kernel::static_buf!(capsules_system::process_checker::basic::AppCheckerSha256);

(checker, buffer)
};};
}

pub type AppCheckerSha256ComponentType = kernel::process_checker::basic::AppCheckerSha256;
pub type AppCheckerSha256ComponentType = capsules_system::process_checker::basic::AppCheckerSha256;

pub struct AppCheckerSha256Component<S: 'static + digest::Digest<'static, 32>> {
sha: &'static S,
Expand All @@ -38,19 +39,18 @@ impl<
> Component for AppCheckerSha256Component<S>
{
type StaticInput = (
&'static mut MaybeUninit<kernel::process_checker::basic::AppCheckerSha256>,
&'static mut MaybeUninit<capsules_system::process_checker::basic::AppCheckerSha256>,
&'static mut MaybeUninit<[u8; 32]>,
);

type Output = &'static kernel::process_checker::basic::AppCheckerSha256;
type Output = &'static capsules_system::process_checker::basic::AppCheckerSha256;

fn finalize(self, s: Self::StaticInput) -> Self::Output {
let buffer = s.1.write([0; 32]);

let checker =
s.0.write(kernel::process_checker::basic::AppCheckerSha256::new(
self.sha, buffer,
));
let checker = s.0.write(
capsules_system::process_checker::basic::AppCheckerSha256::new(self.sha, buffer),
);

digest::Digest::set_client(self.sha, checker);

Expand Down
9 changes: 5 additions & 4 deletions boards/components/src/process_printer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ use kernel::component::Component;
#[macro_export]
macro_rules! process_printer_text_component_static {
() => {{
kernel::static_buf!(kernel::process::ProcessPrinterText)
kernel::static_buf!(capsules_system::process_printer::ProcessPrinterText)
};};
}

Expand All @@ -30,10 +30,11 @@ impl ProcessPrinterTextComponent {
}

impl Component for ProcessPrinterTextComponent {
type StaticInput = &'static mut MaybeUninit<kernel::process::ProcessPrinterText>;
type Output = &'static kernel::process::ProcessPrinterText;
type StaticInput =
&'static mut MaybeUninit<capsules_system::process_printer::ProcessPrinterText>;
type Output = &'static capsules_system::process_printer::ProcessPrinterText;

fn finalize(self, static_buffer: Self::StaticInput) -> Self::Output {
static_buffer.write(kernel::process::ProcessPrinterText::new())
static_buffer.write(capsules_system::process_printer::ProcessPrinterText::new())
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,4 @@ nrf52_components = { path = "../../../nordic/nrf52_components" }

capsules-core = { path = "../../../../capsules/core" }
capsules-extra = { path = "../../../../capsules/extra" }
capsules-system = { path = "../../../../capsules/system" }
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ pub mod io;

// State for loading and holding applications.
// How should the kernel respond when a process faults.
const FAULT_RESPONSE: kernel::process::PanicFaultPolicy = kernel::process::PanicFaultPolicy {};
const FAULT_RESPONSE: capsules_system::process_policies::PanicFaultPolicy =
capsules_system::process_policies::PanicFaultPolicy {};

// Number of concurrent processes this platform supports.
const NUM_PROCS: usize = 8;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,4 @@ nrf52_components = { path = "../../../nordic/nrf52_components" }

capsules-core = { path = "../../../../capsules/core" }
capsules-extra = { path = "../../../../capsules/extra" }
capsules-system = { path = "../../../../capsules/system" }
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ static mut PROCESSES: [Option<&'static dyn kernel::process::Process>; NUM_PROCS]
[None; NUM_PROCS];

static mut CHIP: Option<&'static nrf52840::chip::NRF52<Nrf52840DefaultPeripherals>> = None;
static mut PROCESS_PRINTER: Option<&'static kernel::process::ProcessPrinterText> = None;
static mut PROCESS_PRINTER: Option<&'static capsules_system::process_printer::ProcessPrinterText> =
None;

/// Dummy buffer that causes the linker to reserve enough space for the stack.
#[no_mangle]
Expand Down
1 change: 1 addition & 0 deletions boards/esp32-c3-devkitM-1/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,4 @@ esp32-c3 = { path = "../../chips/esp32-c3" }

capsules-core = { path = "../../capsules/core" }
capsules-extra = { path = "../../capsules/extra" }
capsules-system = { path = "../../capsules/system" }
6 changes: 4 additions & 2 deletions boards/esp32-c3-devkitM-1/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,12 @@ static mut PROCESSES: [Option<&'static dyn kernel::process::Process>; NUM_PROCS]
// Reference to the chip for panic dumps.
static mut CHIP: Option<&'static esp32_c3::chip::Esp32C3<Esp32C3DefaultPeripherals>> = None;
// Static reference to process printer for panic dumps.
static mut PROCESS_PRINTER: Option<&'static kernel::process::ProcessPrinterText> = None;
static mut PROCESS_PRINTER: Option<&'static capsules_system::process_printer::ProcessPrinterText> =
None;

// How should the kernel respond when a process faults.
const FAULT_RESPONSE: kernel::process::PanicFaultPolicy = kernel::process::PanicFaultPolicy {};
const FAULT_RESPONSE: capsules_system::process_policies::PanicFaultPolicy =
capsules_system::process_policies::PanicFaultPolicy {};

// Test access to the peripherals
#[cfg(test)]
Expand Down
1 change: 1 addition & 0 deletions boards/hail/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,4 @@ sam4l = { path = "../../chips/sam4l" }

capsules-core = { path = "../../capsules/core" }
capsules-extra = { path = "../../capsules/extra" }
capsules-system = { path = "../../capsules/system" }
7 changes: 4 additions & 3 deletions boards/hail/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ static mut PROCESSES: [Option<&'static dyn kernel::process::Process>; NUM_PROCS]
[None; NUM_PROCS];

static mut CHIP: Option<&'static sam4l::chip::Sam4l<Sam4lDefaultPeripherals>> = None;
static mut PROCESS_PRINTER: Option<&'static kernel::process::ProcessPrinterText> = None;
static mut PROCESS_PRINTER: Option<&'static capsules_system::process_printer::ProcessPrinterText> =
None;

/// Dummy buffer that causes the linker to reserve enough space for the stack.
#[no_mangle]
Expand Down Expand Up @@ -484,8 +485,8 @@ unsafe fn start() -> (

// Configure application fault policy
let fault_policy = static_init!(
kernel::process::ThresholdRestartThenPanicFaultPolicy,
kernel::process::ThresholdRestartThenPanicFaultPolicy::new(4)
capsules_system::process_policies::ThresholdRestartThenPanicFaultPolicy,
capsules_system::process_policies::ThresholdRestartThenPanicFaultPolicy::new(4)
);

let scheduler = components::sched::round_robin::RoundRobinComponent::new(&*addr_of!(PROCESSES))
Expand Down
1 change: 1 addition & 0 deletions boards/hifive1/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,4 @@ sifive = { path = "../../chips/sifive" }

capsules-core = { path = "../../capsules/core" }
capsules-extra = { path = "../../capsules/extra" }
capsules-system = { path = "../../capsules/system" }
6 changes: 4 additions & 2 deletions boards/hifive1/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,12 @@ static mut PROCESSES: [Option<&'static dyn kernel::process::Process>; NUM_PROCS]
// Reference to the chip for panic dumps.
static mut CHIP: Option<&'static e310_g002::chip::E310x<E310G002DefaultPeripherals>> = None;
// Reference to the process printer for panic dumps.
static mut PROCESS_PRINTER: Option<&'static kernel::process::ProcessPrinterText> = None;
static mut PROCESS_PRINTER: Option<&'static capsules_system::process_printer::ProcessPrinterText> =
None;

// How should the kernel respond when a process faults.
const FAULT_RESPONSE: kernel::process::PanicFaultPolicy = kernel::process::PanicFaultPolicy {};
const FAULT_RESPONSE: capsules_system::process_policies::PanicFaultPolicy =
capsules_system::process_policies::PanicFaultPolicy {};

/// Dummy buffer that causes the linker to reserve enough space for the stack.
#[no_mangle]
Expand Down
1 change: 1 addition & 0 deletions boards/hifive_inventor/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,4 @@ sifive = { path = "../../chips/sifive" }

capsules-core = { path = "../../capsules/core" }
capsules-extra = { path = "../../capsules/extra" }
capsules-system = { path = "../../capsules/system" }
6 changes: 4 additions & 2 deletions boards/hifive_inventor/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,12 @@ static mut PROCESSES: [Option<&'static dyn kernel::process::Process>; NUM_PROCS]
// Reference to the chip for panic dumps.
static mut CHIP: Option<&'static e310_g003::chip::E310x<E310G003DefaultPeripherals>> = None;
// Reference to the process printer for panic dumps.
static mut PROCESS_PRINTER: Option<&'static kernel::process::ProcessPrinterText> = None;
static mut PROCESS_PRINTER: Option<&'static capsules_system::process_printer::ProcessPrinterText> =
None;

// How should the kernel respond when a process faults.
const FAULT_RESPONSE: kernel::process::PanicFaultPolicy = kernel::process::PanicFaultPolicy {};
const FAULT_RESPONSE: capsules_system::process_policies::PanicFaultPolicy =
capsules_system::process_policies::PanicFaultPolicy {};

/// Dummy buffer that causes the linker to reserve enough space for the stack.
#[no_mangle]
Expand Down
1 change: 1 addition & 0 deletions boards/imix/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,4 @@ sam4l = { path = "../../chips/sam4l" }

capsules-core = { path = "../../capsules/core" }
capsules-extra = { path = "../../capsules/extra" }
capsules-system = { path = "../../capsules/system" }
6 changes: 4 additions & 2 deletions boards/imix/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,13 +94,15 @@ const DEFAULT_CTX_PREFIX: [u8; 16] = [0x0_u8; 16]; //Context for 6LoWPAN Compres
const PAN_ID: u16 = 0xABCD;

// how should the kernel respond when a process faults
const FAULT_RESPONSE: kernel::process::StopFaultPolicy = kernel::process::StopFaultPolicy {};
const FAULT_RESPONSE: capsules_system::process_policies::StopFaultPolicy =
capsules_system::process_policies::StopFaultPolicy {};

static mut PROCESSES: [Option<&'static dyn kernel::process::Process>; NUM_PROCS] =
[None; NUM_PROCS];

static mut CHIP: Option<&'static sam4l::chip::Sam4l<Sam4lDefaultPeripherals>> = None;
static mut PROCESS_PRINTER: Option<&'static kernel::process::ProcessPrinterText> = None;
static mut PROCESS_PRINTER: Option<&'static capsules_system::process_printer::ProcessPrinterText> =
None;

/// Dummy buffer that causes the linker to reserve enough space for the stack.
#[no_mangle]
Expand Down
1 change: 1 addition & 0 deletions boards/imxrt1050-evkb/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,4 @@ imxrt10xx = { path = "../../chips/imxrt10xx" }

capsules-core = { path = "../../capsules/core" }
capsules-extra = { path = "../../capsules/extra" }
capsules-system = { path = "../../capsules/system" }

0 comments on commit ef96f80

Please sign in to comment.