1#![no_std]
10#![no_main]
11#![deny(missing_docs)]
12
13use core::ptr::{addr_of, addr_of_mut};
14
15use kernel::capabilities;
16use kernel::component::Component;
17use kernel::hil::led::LedLow;
18use kernel::hil::time::Counter;
19use kernel::hil::usb::Client;
20use kernel::platform::{KernelResources, SyscallDriverLookup};
21use kernel::scheduler::round_robin::RoundRobinSched;
22#[allow(unused_imports)]
23use kernel::{create_capability, debug, debug_gpio, debug_verbose, static_init};
24
25use nrf52840::gpio::Pin;
26use nrf52840::interrupt_service::Nrf52840DefaultPeripherals;
27
28const LED_PIN: Pin = Pin::P1_11;
34
35const BUTTON_RST_PIN: Pin = Pin::P0_18;
36const BUTTON_PIN: Pin = Pin::P1_15;
37
38const GPIO_D0: Pin = Pin::P0_23;
39const GPIO_D1: Pin = Pin::P0_12;
40const GPIO_D2: Pin = Pin::P0_09;
41const GPIO_D3: Pin = Pin::P0_07;
42
43const _UART_TX_PIN: Pin = Pin::P0_06;
44const _UART_RX_PIN: Pin = Pin::P0_08;
45
46const I2C_SDA_PIN: Pin = Pin::P0_26;
48const I2C_SCL_PIN: Pin = Pin::P0_27;
49
50const PAN_ID: u16 = 0xABCD;
53const DST_MAC_ADDR: capsules_extra::net::ieee802154::MacAddress =
55 capsules_extra::net::ieee802154::MacAddress::Short(49138);
56const DEFAULT_CTX_PREFIX_LEN: u8 = 8; const DEFAULT_CTX_PREFIX: [u8; 16] = [0x0_u8; 16]; pub mod io;
61
62const FAULT_RESPONSE: capsules_system::process_policies::StopWithDebugFaultPolicy =
67 capsules_system::process_policies::StopWithDebugFaultPolicy {};
68
69const NUM_PROCS: usize = 8;
71
72static mut PROCESSES: [Option<&'static dyn kernel::process::Process>; NUM_PROCS] =
74 [None; NUM_PROCS];
75
76static mut CHIP: Option<&'static nrf52840::chip::NRF52<Nrf52840DefaultPeripherals>> = None;
77static mut PROCESS_PRINTER: Option<&'static capsules_system::process_printer::ProcessPrinterText> =
78 None;
79static mut CDC_REF_FOR_PANIC: Option<
80 &'static capsules_extra::usb::cdc::CdcAcm<
81 'static,
82 nrf52::usbd::Usbd,
83 capsules_core::virtualizers::virtual_alarm::VirtualMuxAlarm<'static, nrf52::rtc::Rtc>,
84 >,
85> = None;
86static mut NRF52_POWER: Option<&'static nrf52840::power::Power> = None;
87
88#[no_mangle]
90#[link_section = ".stack_buffer"]
91pub static mut STACK_MEMORY: [u8; 0x1000] = [0; 0x1000];
92
93fn baud_rate_reset_bootloader_enter() {
95 unsafe {
96 NRF52_POWER.unwrap().set_gpregret(0x90);
98 cortexm4::scb::reset();
99 }
100}
101
102fn crc(s: &'static str) -> u32 {
103 kernel::utilities::helpers::crc32_posix(s.as_bytes())
104}
105
106type AlarmDriver = components::alarm::AlarmDriverComponentType<nrf52840::rtc::Rtc<'static>>;
111
112type Screen = components::ssd1306::Ssd1306ComponentType<nrf52840::i2c::TWI<'static>>;
113type ScreenDriver = components::screen::ScreenSharedComponentType<Screen>;
114
115type Ieee802154MacDevice = components::ieee802154::Ieee802154ComponentMacDeviceType<
116 nrf52840::ieee802154_radio::Radio<'static>,
117 nrf52840::aes::AesECB<'static>,
118>;
119type Ieee802154Driver = components::ieee802154::Ieee802154ComponentType<
120 nrf52840::ieee802154_radio::Radio<'static>,
121 nrf52840::aes::AesECB<'static>,
122>;
123type RngDriver = components::rng::RngComponentType<nrf52840::trng::Trng<'static>>;
124
125pub struct Platform {
127 ble_radio: &'static capsules_extra::ble_advertising_driver::BLE<
128 'static,
129 nrf52::ble_radio::Radio<'static>,
130 capsules_core::virtualizers::virtual_alarm::VirtualMuxAlarm<
131 'static,
132 nrf52::rtc::Rtc<'static>,
133 >,
134 >,
135 ieee802154_radio: &'static Ieee802154Driver,
136 console: &'static capsules_core::console::Console<'static>,
137 pconsole: &'static capsules_core::process_console::ProcessConsole<
138 'static,
139 { capsules_core::process_console::DEFAULT_COMMAND_HISTORY_LEN },
140 capsules_core::virtualizers::virtual_alarm::VirtualMuxAlarm<
141 'static,
142 nrf52::rtc::Rtc<'static>,
143 >,
144 components::process_console::Capability,
145 >,
146 gpio: &'static capsules_core::gpio::GPIO<'static, nrf52::gpio::GPIOPin<'static>>,
147 led: &'static capsules_core::led::LedDriver<
148 'static,
149 LedLow<'static, nrf52::gpio::GPIOPin<'static>>,
150 1,
151 >,
152 adc: &'static capsules_core::adc::AdcVirtualized<'static>,
153 rng: &'static RngDriver,
154 ipc: kernel::ipc::IPC<{ NUM_PROCS as u8 }>,
155 alarm: &'static AlarmDriver,
156 button: &'static capsules_core::button::Button<'static, nrf52840::gpio::GPIOPin<'static>>,
157 screen: &'static ScreenDriver,
158 udp_driver: &'static capsules_extra::net::udp::UDPDriver<'static>,
159 scheduler: &'static RoundRobinSched<'static>,
160 systick: cortexm4::systick::SysTick,
161}
162
163impl SyscallDriverLookup for Platform {
164 fn with_driver<F, R>(&self, driver_num: usize, f: F) -> R
165 where
166 F: FnOnce(Option<&dyn kernel::syscall::SyscallDriver>) -> R,
167 {
168 match driver_num {
169 capsules_core::console::DRIVER_NUM => f(Some(self.console)),
170 capsules_core::gpio::DRIVER_NUM => f(Some(self.gpio)),
171 capsules_core::alarm::DRIVER_NUM => f(Some(self.alarm)),
172 capsules_core::led::DRIVER_NUM => f(Some(self.led)),
173 capsules_core::button::DRIVER_NUM => f(Some(self.button)),
174 capsules_core::adc::DRIVER_NUM => f(Some(self.adc)),
175 capsules_core::rng::DRIVER_NUM => f(Some(self.rng)),
176 capsules_extra::screen::DRIVER_NUM => f(Some(self.screen)),
177 capsules_extra::ble_advertising_driver::DRIVER_NUM => f(Some(self.ble_radio)),
178 capsules_extra::ieee802154::DRIVER_NUM => f(Some(self.ieee802154_radio)),
179 capsules_extra::net::udp::DRIVER_NUM => f(Some(self.udp_driver)),
180 kernel::ipc::DRIVER_NUM => f(Some(&self.ipc)),
181 _ => f(None),
182 }
183 }
184}
185
186impl KernelResources<nrf52::chip::NRF52<'static, Nrf52840DefaultPeripherals<'static>>>
187 for Platform
188{
189 type SyscallDriverLookup = Self;
190 type SyscallFilter = ();
191 type ProcessFault = ();
192 type Scheduler = RoundRobinSched<'static>;
193 type SchedulerTimer = cortexm4::systick::SysTick;
194 type WatchDog = ();
195 type ContextSwitchCallback = ();
196
197 fn syscall_driver_lookup(&self) -> &Self::SyscallDriverLookup {
198 self
199 }
200 fn syscall_filter(&self) -> &Self::SyscallFilter {
201 &()
202 }
203 fn process_fault(&self) -> &Self::ProcessFault {
204 &()
205 }
206 fn scheduler(&self) -> &Self::Scheduler {
207 self.scheduler
208 }
209 fn scheduler_timer(&self) -> &Self::SchedulerTimer {
210 &self.systick
211 }
212 fn watchdog(&self) -> &Self::WatchDog {
213 &()
214 }
215 fn context_switch_callback(&self) -> &Self::ContextSwitchCallback {
216 &()
217 }
218}
219
220#[inline(never)]
224pub unsafe fn start() -> (
225 &'static kernel::Kernel,
226 Platform,
227 &'static nrf52840::chip::NRF52<'static, Nrf52840DefaultPeripherals<'static>>,
228) {
229 nrf52840::init();
230
231 let ieee802154_ack_buf = static_init!(
232 [u8; nrf52840::ieee802154_radio::ACK_BUF_SIZE],
233 [0; nrf52840::ieee802154_radio::ACK_BUF_SIZE]
234 );
235
236 let nrf52840_peripherals = static_init!(
238 Nrf52840DefaultPeripherals,
239 Nrf52840DefaultPeripherals::new(ieee802154_ack_buf)
240 );
241
242 nrf52840_peripherals.init();
244 let base_peripherals = &nrf52840_peripherals.nrf52;
245
246 NRF52_POWER = Some(&base_peripherals.pwr_clk);
249
250 let board_kernel = static_init!(kernel::Kernel, kernel::Kernel::new(&*addr_of!(PROCESSES)));
251
252 nrf52_components::startup::NrfStartupComponent::new(
255 false,
256 BUTTON_RST_PIN,
257 nrf52840::uicr::Regulator0Output::DEFAULT,
258 &base_peripherals.nvmc,
259 )
260 .finalize(());
261
262 let chip = static_init!(
263 nrf52840::chip::NRF52<Nrf52840DefaultPeripherals>,
264 nrf52840::chip::NRF52::new(nrf52840_peripherals)
265 );
266 CHIP = Some(chip);
267
268 let memory_allocation_capability = create_capability!(capabilities::MemoryAllocationCapability);
275
276 kernel::debug::assign_gpios(Some(&nrf52840_peripherals.gpio_port[LED_PIN]), None, None);
284
285 let gpio = components::gpio::GpioComponent::new(
290 board_kernel,
291 capsules_core::gpio::DRIVER_NUM,
292 components::gpio_component_helper!(
293 nrf52840::gpio::GPIOPin,
294 0 => &nrf52840_peripherals.gpio_port[GPIO_D0],
295 1 => &nrf52840_peripherals.gpio_port[GPIO_D1],
296 2 => &nrf52840_peripherals.gpio_port[GPIO_D2],
297 3 => &nrf52840_peripherals.gpio_port[GPIO_D3],
298 ),
299 )
300 .finalize(components::gpio_component_static!(nrf52840::gpio::GPIOPin));
301
302 let led = components::led::LedsComponent::new().finalize(components::led_component_static!(
307 LedLow<'static, nrf52840::gpio::GPIOPin>,
308 LedLow::new(&nrf52840_peripherals.gpio_port[LED_PIN]),
309 ));
310
311 let button = components::button::ButtonComponent::new(
316 board_kernel,
317 capsules_core::button::DRIVER_NUM,
318 components::button_component_helper!(
319 nrf52840::gpio::GPIOPin,
320 (
321 &nrf52840_peripherals.gpio_port[BUTTON_PIN],
322 kernel::hil::gpio::ActivationMode::ActiveLow,
323 kernel::hil::gpio::FloatingState::PullUp
324 )
325 ),
326 )
327 .finalize(components::button_component_static!(
328 nrf52840::gpio::GPIOPin
329 ));
330
331 let rtc = &base_peripherals.rtc;
336 let _ = rtc.start();
337
338 let mux_alarm = components::alarm::AlarmMuxComponent::new(rtc)
339 .finalize(components::alarm_mux_component_static!(nrf52::rtc::Rtc));
340 let alarm = components::alarm::AlarmDriverComponent::new(
341 board_kernel,
342 capsules_core::alarm::DRIVER_NUM,
343 mux_alarm,
344 )
345 .finalize(components::alarm_component_static!(nrf52::rtc::Rtc));
346
347 let serial_number_buf = static_init!([u8; 17], [0; 17]);
357 let serial_number_string: &'static str =
358 (*addr_of!(nrf52::ficr::FICR_INSTANCE)).address_str(serial_number_buf);
359 let strings = static_init!(
360 [&str; 3],
361 [
362 "MakePython", "NRF52840 - TockOS", serial_number_string, ]
366 );
367
368 let cdc = components::cdc::CdcAcmComponent::new(
369 &nrf52840_peripherals.usbd,
370 capsules_extra::usb::cdc::MAX_CTRL_PACKET_SIZE_NRF52840,
371 0x2341,
372 0x005a,
373 strings,
374 mux_alarm,
375 Some(&baud_rate_reset_bootloader_enter),
376 )
377 .finalize(components::cdc_acm_component_static!(
378 nrf52::usbd::Usbd,
379 nrf52::rtc::Rtc
380 ));
381 CDC_REF_FOR_PANIC = Some(cdc); let process_printer = components::process_printer::ProcessPrinterTextComponent::new()
385 .finalize(components::process_printer_text_component_static!());
386 PROCESS_PRINTER = Some(process_printer);
387
388 let uart_mux = components::console::UartMuxComponent::new(cdc, 115200)
390 .finalize(components::uart_mux_component_static!());
391
392 let pconsole = components::process_console::ProcessConsoleComponent::new(
393 board_kernel,
394 uart_mux,
395 mux_alarm,
396 process_printer,
397 Some(cortexm4::support::reset),
398 )
399 .finalize(components::process_console_component_static!(
400 nrf52::rtc::Rtc<'static>
401 ));
402
403 let console = components::console::ConsoleComponent::new(
405 board_kernel,
406 capsules_core::console::DRIVER_NUM,
407 uart_mux,
408 )
409 .finalize(components::console_component_static!());
410 components::debug_writer::DebugWriterComponent::new(
412 uart_mux,
413 create_capability!(capabilities::SetDebugWriterCapability),
414 )
415 .finalize(components::debug_writer_component_static!());
416
417 let rng = components::rng::RngComponent::new(
422 board_kernel,
423 capsules_core::rng::DRIVER_NUM,
424 &base_peripherals.trng,
425 )
426 .finalize(components::rng_component_static!(nrf52840::trng::Trng));
427
428 base_peripherals.adc.calibrate();
432
433 let adc_mux = components::adc::AdcMuxComponent::new(&base_peripherals.adc)
434 .finalize(components::adc_mux_component_static!(nrf52840::adc::Adc));
435
436 let adc_syscall =
437 components::adc::AdcVirtualComponent::new(board_kernel, capsules_core::adc::DRIVER_NUM)
438 .finalize(components::adc_syscall_component_helper!(
439 components::adc::AdcComponent::new(
441 adc_mux,
442 nrf52840::adc::AdcChannelSetup::new(nrf52840::adc::AdcChannel::AnalogInput2)
443 )
444 .finalize(components::adc_component_static!(nrf52840::adc::Adc)),
445 components::adc::AdcComponent::new(
447 adc_mux,
448 nrf52840::adc::AdcChannelSetup::new(nrf52840::adc::AdcChannel::AnalogInput3)
449 )
450 .finalize(components::adc_component_static!(nrf52840::adc::Adc)),
451 components::adc::AdcComponent::new(
453 adc_mux,
454 nrf52840::adc::AdcChannelSetup::new(nrf52840::adc::AdcChannel::AnalogInput6)
455 )
456 .finalize(components::adc_component_static!(nrf52840::adc::Adc)),
457 components::adc::AdcComponent::new(
459 adc_mux,
460 nrf52840::adc::AdcChannelSetup::new(nrf52840::adc::AdcChannel::AnalogInput5)
461 )
462 .finalize(components::adc_component_static!(nrf52840::adc::Adc)),
463 components::adc::AdcComponent::new(
465 adc_mux,
466 nrf52840::adc::AdcChannelSetup::new(nrf52840::adc::AdcChannel::AnalogInput7)
467 )
468 .finalize(components::adc_component_static!(nrf52840::adc::Adc)),
469 components::adc::AdcComponent::new(
471 adc_mux,
472 nrf52840::adc::AdcChannelSetup::new(nrf52840::adc::AdcChannel::AnalogInput0)
473 )
474 .finalize(components::adc_component_static!(nrf52840::adc::Adc)),
475 components::adc::AdcComponent::new(
477 adc_mux,
478 nrf52840::adc::AdcChannelSetup::new(nrf52840::adc::AdcChannel::AnalogInput4)
479 )
480 .finalize(components::adc_component_static!(nrf52840::adc::Adc)),
481 components::adc::AdcComponent::new(
483 adc_mux,
484 nrf52840::adc::AdcChannelSetup::new(nrf52840::adc::AdcChannel::AnalogInput1)
485 )
486 .finalize(components::adc_component_static!(nrf52840::adc::Adc)),
487 ));
488
489 let i2c_bus = components::i2c::I2CMuxComponent::new(&base_peripherals.twi1, None)
494 .finalize(components::i2c_mux_component_static!(nrf52840::i2c::TWI));
495 base_peripherals.twi1.configure(
496 nrf52840::pinmux::Pinmux::new(I2C_SCL_PIN as u32),
497 nrf52840::pinmux::Pinmux::new(I2C_SDA_PIN as u32),
498 );
499
500 let ssd1306_i2c = components::i2c::I2CComponent::new(i2c_bus, 0x3c)
502 .finalize(components::i2c_component_static!(nrf52840::i2c::TWI));
503
504 let ssd1306 = components::ssd1306::Ssd1306Component::new(ssd1306_i2c, true)
506 .finalize(components::ssd1306_component_static!(nrf52840::i2c::TWI));
507
508 let apps_regions = static_init!(
518 [capsules_extra::screen_shared::AppScreenRegion; 3],
519 [
520 capsules_extra::screen_shared::AppScreenRegion::new(
521 kernel::process::ShortId::Fixed(core::num::NonZeroU32::new(crc("circle")).unwrap()),
522 0, 0, 8 * 8, 8 * 8 ),
527 capsules_extra::screen_shared::AppScreenRegion::new(
528 kernel::process::ShortId::Fixed(core::num::NonZeroU32::new(crc("count")).unwrap()),
529 8 * 8, 0, 8 * 8, 4 * 8 ),
534 capsules_extra::screen_shared::AppScreenRegion::new(
535 kernel::process::ShortId::Fixed(
536 core::num::NonZeroU32::new(crc("tock-scroll")).unwrap()
537 ),
538 8 * 8, 4 * 8, 8 * 8, 4 * 8 )
543 ]
544 );
545
546 let screen = components::screen::ScreenSharedComponent::new(
547 board_kernel,
548 capsules_extra::screen::DRIVER_NUM,
549 ssd1306,
550 apps_regions,
551 )
552 .finalize(components::screen_shared_component_static!(1032, Screen));
553
554 let ble_radio = components::ble::BLEComponent::new(
559 board_kernel,
560 capsules_extra::ble_advertising_driver::DRIVER_NUM,
561 &base_peripherals.ble_radio,
562 mux_alarm,
563 )
564 .finalize(components::ble_component_static!(
565 nrf52840::rtc::Rtc,
566 nrf52840::ble_radio::Radio
567 ));
568
569 use capsules_extra::net::ieee802154::MacAddress;
570
571 let aes_mux = components::ieee802154::MuxAes128ccmComponent::new(&base_peripherals.ecb)
572 .finalize(components::mux_aes128ccm_component_static!(
573 nrf52840::aes::AesECB
574 ));
575
576 let device_id = (*addr_of!(nrf52840::ficr::FICR_INSTANCE)).id();
577 let device_id_bottom_16 = u16::from_le_bytes([device_id[0], device_id[1]]);
578 let (ieee802154_radio, mux_mac) = components::ieee802154::Ieee802154Component::new(
579 board_kernel,
580 capsules_extra::ieee802154::DRIVER_NUM,
581 &nrf52840_peripherals.ieee802154_radio,
582 aes_mux,
583 PAN_ID,
584 device_id_bottom_16,
585 device_id,
586 )
587 .finalize(components::ieee802154_component_static!(
588 nrf52840::ieee802154_radio::Radio,
589 nrf52840::aes::AesECB<'static>
590 ));
591 use capsules_extra::net::ipv6::ip_utils::IPAddr;
592
593 let local_ip_ifaces = static_init!(
594 [IPAddr; 3],
595 [
596 IPAddr([
597 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d,
598 0x0e, 0x0f,
599 ]),
600 IPAddr([
601 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d,
602 0x1e, 0x1f,
603 ]),
604 IPAddr::generate_from_mac(capsules_extra::net::ieee802154::MacAddress::Short(
605 device_id_bottom_16
606 )),
607 ]
608 );
609
610 let (udp_send_mux, udp_recv_mux, udp_port_table) = components::udp_mux::UDPMuxComponent::new(
611 mux_mac,
612 DEFAULT_CTX_PREFIX_LEN,
613 DEFAULT_CTX_PREFIX,
614 DST_MAC_ADDR,
615 MacAddress::Short(device_id_bottom_16),
616 local_ip_ifaces,
617 mux_alarm,
618 )
619 .finalize(components::udp_mux_component_static!(
620 nrf52840::rtc::Rtc,
621 Ieee802154MacDevice
622 ));
623
624 let udp_driver = components::udp_driver::UDPDriverComponent::new(
626 board_kernel,
627 capsules_extra::net::udp::DRIVER_NUM,
628 udp_send_mux,
629 udp_recv_mux,
630 udp_port_table,
631 local_ip_ifaces,
632 )
633 .finalize(components::udp_driver_component_static!(nrf52840::rtc::Rtc));
634
635 let sha = components::sha::ShaSoftware256Component::new()
641 .finalize(components::sha_software_256_component_static!());
642
643 let checking_policy = components::appid::checker_sha::AppCheckerSha256Component::new(sha)
645 .finalize(components::app_checker_sha256_component_static!());
646
647 let assigner = components::appid::assigner_name::AppIdAssignerNamesComponent::new()
649 .finalize(components::appid_assigner_names_component_static!());
650
651 let checker = components::appid::checker::ProcessCheckerMachineComponent::new(checking_policy)
653 .finalize(components::process_checker_machine_component_static!());
654
655 let storage_permissions_policy =
660 components::storage_permissions::individual::StoragePermissionsIndividualComponent::new()
661 .finalize(
662 components::storage_permissions_individual_component_static!(
663 nrf52840::chip::NRF52<Nrf52840DefaultPeripherals>,
664 kernel::process::ProcessStandardDebugFull,
665 ),
666 );
667
668 extern "C" {
674 static _sapps: u8;
676 static _eapps: u8;
678 static mut _sappmem: u8;
680 static _eappmem: u8;
682 }
683
684 let app_flash = core::slice::from_raw_parts(
685 core::ptr::addr_of!(_sapps),
686 core::ptr::addr_of!(_eapps) as usize - core::ptr::addr_of!(_sapps) as usize,
687 );
688 let app_memory = core::slice::from_raw_parts_mut(
689 core::ptr::addr_of_mut!(_sappmem),
690 core::ptr::addr_of!(_eappmem) as usize - core::ptr::addr_of!(_sappmem) as usize,
691 );
692
693 let _loader = components::loader::sequential::ProcessLoaderSequentialComponent::new(
695 checker,
696 &mut *addr_of_mut!(PROCESSES),
697 board_kernel,
698 chip,
699 &FAULT_RESPONSE,
700 assigner,
701 storage_permissions_policy,
702 app_flash,
703 app_memory,
704 )
705 .finalize(components::process_loader_sequential_component_static!(
706 nrf52840::chip::NRF52<Nrf52840DefaultPeripherals>,
707 kernel::process::ProcessStandardDebugFull,
708 NUM_PROCS
709 ));
710
711 nrf52_components::NrfClockComponent::new(&base_peripherals.clock).finalize(());
718
719 let scheduler = components::sched::round_robin::RoundRobinComponent::new(&*addr_of!(PROCESSES))
720 .finalize(components::round_robin_component_static!(NUM_PROCS));
721
722 let platform = Platform {
723 ble_radio,
724 ieee802154_radio,
725 console,
726 pconsole,
727 adc: adc_syscall,
728 led,
729 button,
730 gpio,
731 rng,
732 screen,
733 alarm,
734 udp_driver,
735 ipc: kernel::ipc::IPC::new(
736 board_kernel,
737 kernel::ipc::DRIVER_NUM,
738 &memory_allocation_capability,
739 ),
740 scheduler,
741 systick: cortexm4::systick::SysTick::new_with_calibration(64000000),
742 };
743
744 cdc.enable();
746 cdc.attach();
747
748 debug!("Initialization complete. Entering main loop.");
761 let _ = platform.pconsole.start();
762
763 ssd1306.init_screen();
764
765 (board_kernel, platform, chip)
770}
771
772#[no_mangle]
774pub unsafe fn main() {
775 let main_loop_capability = create_capability!(capabilities::MainLoopCapability);
776
777 let (board_kernel, platform, chip) = start();
778 board_kernel.kernel_loop(&platform, chip, Some(&platform.ipc), &main_loop_capability);
779}