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 pio_spi;
17pub mod pwm;
18pub mod resets;
19pub mod rtc;
20pub mod spi;
21pub mod sysinfo;
22pub mod test;
23pub mod timer;
24pub mod uart;
25pub mod usb;
26pub mod watchdog;
27pub mod xosc;
28
29use cortexm0p::{initialize_ram_jump_to_main, unhandled_interrupt, CortexM0P, CortexMVariant};
30
31extern "C" {
32 fn _estack();
35}
36
37#[cfg_attr(
38 all(target_arch = "arm", target_os = "none"),
39 link_section = ".vectors"
40)]
41#[cfg_attr(all(target_arch = "arm", target_os = "none"), used)]
43pub static BASE_VECTORS: [unsafe extern "C" fn(); 16] = [
44 _estack,
45 initialize_ram_jump_to_main,
46 unhandled_interrupt, CortexM0P::HARD_FAULT_HANDLER, unhandled_interrupt, unhandled_interrupt, unhandled_interrupt, unhandled_interrupt,
52 unhandled_interrupt,
53 unhandled_interrupt,
54 unhandled_interrupt,
55 CortexM0P::SVC_HANDLER, unhandled_interrupt, unhandled_interrupt,
58 unhandled_interrupt, CortexM0P::SYSTICK_HANDLER, ];
61
62#[cfg_attr(all(target_arch = "arm", target_os = "none"), link_section = ".irqs")]
64#[cfg_attr(all(target_arch = "arm", target_os = "none"), used)]
66pub static IRQS: [unsafe extern "C" fn(); 32] = [
67 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, ];
100
101extern "C" {
102 static mut _szero: usize;
103 static mut _ezero: usize;
104 static mut _etext: usize;
105 static mut _srelocate: usize;
106 static mut _erelocate: usize;
107}
108
109pub unsafe fn init() {
110 cortexm0p::nvic::disable_all();
111 cortexm0p::nvic::clear_all_pending();
112 let sio = gpio::SIO::new();
113 let processor = sio.get_processor();
114 match processor {
115 chip::Processor::Processor0 => {}
116 _ => panic!(
117 "Kernel should run only using processor 0 (now processor {})",
118 processor as u8
119 ),
120 }
121}