1#![no_std]
6#![recursion_limit = "256"]
9
10pub mod chip;
11pub mod clocks;
12pub mod gpio;
13pub mod interrupts;
14pub mod resets;
15pub mod ticks;
16pub mod timer;
17pub mod uart;
18pub mod xosc;
19
20use cortexm33::{initialize_ram_jump_to_main, unhandled_interrupt, CortexM33, CortexMVariant};
21
22extern "C" {
23 fn _estack();
26}
27
28#[cfg_attr(
29 all(target_arch = "arm", target_os = "none"),
30 link_section = ".vectors"
31)]
32#[cfg_attr(all(target_arch = "arm", target_os = "none"), used)]
34pub static BASE_VECTORS: [unsafe extern "C" fn(); 16] = [
35 _estack,
36 initialize_ram_jump_to_main,
37 unhandled_interrupt, CortexM33::HARD_FAULT_HANDLER, unhandled_interrupt, unhandled_interrupt, unhandled_interrupt, unhandled_interrupt, unhandled_interrupt,
44 unhandled_interrupt,
45 unhandled_interrupt,
46 CortexM33::SVC_HANDLER, unhandled_interrupt, unhandled_interrupt,
49 unhandled_interrupt, CortexM33::SYSTICK_HANDLER, ];
52
53#[cfg_attr(all(target_arch = "arm", target_os = "none"), link_section = ".irqs")]
54#[cfg_attr(all(target_arch = "arm", target_os = "none"), used)]
56pub static IRQS: [unsafe extern "C" fn(); 52] = [
57 CortexM33::GENERIC_ISR, CortexM33::GENERIC_ISR, CortexM33::GENERIC_ISR, CortexM33::GENERIC_ISR, CortexM33::GENERIC_ISR, CortexM33::GENERIC_ISR, CortexM33::GENERIC_ISR, CortexM33::GENERIC_ISR, CortexM33::GENERIC_ISR, CortexM33::GENERIC_ISR, CortexM33::GENERIC_ISR, CortexM33::GENERIC_ISR, CortexM33::GENERIC_ISR, CortexM33::GENERIC_ISR, CortexM33::GENERIC_ISR, CortexM33::GENERIC_ISR, CortexM33::GENERIC_ISR, CortexM33::GENERIC_ISR, CortexM33::GENERIC_ISR, CortexM33::GENERIC_ISR, CortexM33::GENERIC_ISR, CortexM33::GENERIC_ISR, CortexM33::GENERIC_ISR, CortexM33::GENERIC_ISR, CortexM33::GENERIC_ISR, CortexM33::GENERIC_ISR, CortexM33::GENERIC_ISR, CortexM33::GENERIC_ISR, CortexM33::GENERIC_ISR, CortexM33::GENERIC_ISR, CortexM33::GENERIC_ISR, CortexM33::GENERIC_ISR, CortexM33::GENERIC_ISR, CortexM33::GENERIC_ISR, CortexM33::GENERIC_ISR, CortexM33::GENERIC_ISR, CortexM33::GENERIC_ISR, CortexM33::GENERIC_ISR, CortexM33::GENERIC_ISR, CortexM33::GENERIC_ISR, CortexM33::GENERIC_ISR, CortexM33::GENERIC_ISR, CortexM33::GENERIC_ISR, CortexM33::GENERIC_ISR, CortexM33::GENERIC_ISR, CortexM33::GENERIC_ISR, unhandled_interrupt, unhandled_interrupt, unhandled_interrupt, unhandled_interrupt, unhandled_interrupt, unhandled_interrupt, ];
110
111extern "C" {
112 static mut _szero: usize;
113 static mut _ezero: usize;
114 static mut _etext: usize;
115 static mut _srelocate: usize;
116 static mut _erelocate: usize;
117}
118
119pub unsafe fn init() {
120 cortexm33::nvic::disable_all();
121 cortexm33::nvic::clear_all_pending();
122 let sio = gpio::SIO::new();
123 let processor = sio.get_processor();
124 match processor {
125 chip::Processor::Processor0 => {}
126 _ => panic!(
127 "Kernel should run only using processor 0 (now processor {})",
128 processor as u8
129 ),
130 }
131}