1#![no_std]
6
7pub mod adc;
8pub mod chip;
9pub mod clocks;
10mod deferred_calls;
11pub mod gpio;
12pub mod i2c;
13pub mod interrupts;
14pub mod pio;
15pub mod pio_pwm;
16pub mod pwm;
17pub mod resets;
18pub mod rtc;
19pub mod spi;
20pub mod sysinfo;
21pub mod test;
22pub mod timer;
23pub mod uart;
24pub mod usb;
25pub mod watchdog;
26pub mod xosc;
27
28use cortexm0p::{initialize_ram_jump_to_main, unhandled_interrupt, CortexM0P, CortexMVariant};
29
30extern "C" {
31 fn _estack();
34}
35
36#[cfg_attr(
37 all(target_arch = "arm", target_os = "none"),
38 link_section = ".vectors"
39)]
40#[cfg_attr(all(target_arch = "arm", target_os = "none"), used)]
42pub static BASE_VECTORS: [unsafe extern "C" fn(); 16] = [
43 _estack,
44 initialize_ram_jump_to_main,
45 unhandled_interrupt, CortexM0P::HARD_FAULT_HANDLER, unhandled_interrupt, unhandled_interrupt, unhandled_interrupt, unhandled_interrupt,
51 unhandled_interrupt,
52 unhandled_interrupt,
53 unhandled_interrupt,
54 CortexM0P::SVC_HANDLER, unhandled_interrupt, unhandled_interrupt,
57 unhandled_interrupt, CortexM0P::SYSTICK_HANDLER, ];
60
61#[cfg_attr(all(target_arch = "arm", target_os = "none"), link_section = ".irqs")]
63#[cfg_attr(all(target_arch = "arm", target_os = "none"), used)]
65pub static IRQS: [unsafe extern "C" fn(); 32] = [
66 CortexM0P::GENERIC_ISR, CortexM0P::GENERIC_ISR, CortexM0P::GENERIC_ISR, CortexM0P::GENERIC_ISR, CortexM0P::GENERIC_ISR, CortexM0P::GENERIC_ISR, CortexM0P::GENERIC_ISR, CortexM0P::GENERIC_ISR, CortexM0P::GENERIC_ISR, CortexM0P::GENERIC_ISR, CortexM0P::GENERIC_ISR, CortexM0P::GENERIC_ISR, CortexM0P::GENERIC_ISR, CortexM0P::GENERIC_ISR, CortexM0P::GENERIC_ISR, CortexM0P::GENERIC_ISR, CortexM0P::GENERIC_ISR, CortexM0P::GENERIC_ISR, CortexM0P::GENERIC_ISR, CortexM0P::GENERIC_ISR, CortexM0P::GENERIC_ISR, CortexM0P::GENERIC_ISR, CortexM0P::GENERIC_ISR, CortexM0P::GENERIC_ISR, CortexM0P::GENERIC_ISR, CortexM0P::GENERIC_ISR, unhandled_interrupt, unhandled_interrupt, unhandled_interrupt, unhandled_interrupt, unhandled_interrupt, unhandled_interrupt, ];
99
100extern "C" {
101 static mut _szero: usize;
102 static mut _ezero: usize;
103 static mut _etext: usize;
104 static mut _srelocate: usize;
105 static mut _erelocate: usize;
106}
107
108pub unsafe fn init() {
109 cortexm0p::nvic::disable_all();
110 cortexm0p::nvic::clear_all_pending();
111 let sio = gpio::SIO::new();
112 let processor = sio.get_processor();
113 match processor {
114 chip::Processor::Processor0 => {}
115 _ => panic!(
116 "Kernel should run only using processor 0 (now processor {})",
117 processor as u8
118 ),
119 }
120}