1#![no_std]
8
9use core::fmt::Write;
10
11pub mod mpu_v8m;
12
13pub mod mpu {
14 use crate::mpu_v8m;
15 use kernel::utilities::StaticRef;
16
17 pub type MPU<const NUM_REGIONS: usize> = mpu_v8m::MPU<NUM_REGIONS>;
19
20 const MPU_BASE_ADDRESS: StaticRef<crate::mpu_v8m::MpuRegisters> =
21 unsafe { StaticRef::new(0xE000ED90 as *const crate::mpu_v8m::MpuRegisters) };
22
23 pub unsafe fn new<const NUM_REGIONS: usize>() -> mpu_v8m::MPU<NUM_REGIONS> {
24 mpu_v8m::MPU::new(MPU_BASE_ADDRESS)
25 }
26}
27
28pub use cortexm::initialize_ram_jump_to_main;
29pub use cortexm::interrupt_mask;
30pub use cortexm::nvic;
31pub use cortexm::scb;
32pub use cortexm::support;
33pub use cortexm::systick;
34pub use cortexm::thread_id;
35pub use cortexm::unhandled_interrupt;
36pub use cortexm::CortexMVariant;
37
38pub enum CortexM33 {}
42
43impl cortexm::CortexMVariant for CortexM33 {
44 const GENERIC_ISR: unsafe extern "C" fn() = cortexv7m::generic_isr_arm_v7m;
45 const SYSTICK_HANDLER: unsafe extern "C" fn() = cortexv7m::systick_handler_arm_v7m;
46 const SVC_HANDLER: unsafe extern "C" fn() = cortexv7m::svc_handler_arm_v7m;
47 const HARD_FAULT_HANDLER: unsafe extern "C" fn() = cortexv7m::hard_fault_handler_arm_v7m;
48
49 #[cfg(all(target_arch = "arm", target_os = "none"))]
50 unsafe fn switch_to_user(
51 user_stack: *const usize,
52 process_regs: &mut [usize; 8],
53 ) -> *const usize {
54 cortexv7m::switch_to_user_arm_v7m(user_stack, process_regs)
55 }
56
57 #[cfg(not(all(target_arch = "arm", target_os = "none")))]
58 unsafe fn switch_to_user(
59 _user_stack: *const usize,
60 _process_regs: &mut [usize; 8],
61 ) -> *const usize {
62 unimplemented!()
63 }
64
65 #[inline]
66 unsafe fn print_cortexm_state(writer: &mut dyn Write) {
67 cortexm::print_cortexm_state(writer)
68 }
69}
70
71pub mod syscall {
72 pub type SysCall = cortexm::syscall::SysCall<crate::CortexM33>;
73}