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