Kernel minimization (#334)
* adds patch to remove unused kernel components * new boards, rebase patches to match * rename boards for deployment
This commit is contained in:
8
.github/workflows/boards_build.yml
vendored
8
.github/workflows/boards_build.yml
vendored
@@ -29,10 +29,10 @@ jobs:
|
|||||||
- name: Set up OpenSK
|
- name: Set up OpenSK
|
||||||
run: ./setup.sh
|
run: ./setup.sh
|
||||||
|
|
||||||
- name: Building board nrf52840dk
|
- name: Building board nrf52840dk_opensk
|
||||||
run: ./deploy.py --board=nrf52840dk --no-app --programmer=none
|
run: ./deploy.py --board=nrf52840dk_opensk --no-app --programmer=none
|
||||||
- name: Building board nrf52840_dongle
|
- name: Building board nrf52840_dongle_opensk
|
||||||
run: ./deploy.py --board=nrf52840_dongle --no-app --programmer=none
|
run: ./deploy.py --board=nrf52840_dongle_opensk --no-app --programmer=none
|
||||||
- name: Building board nrf52840_dongle_dfu
|
- name: Building board nrf52840_dongle_dfu
|
||||||
run: ./deploy.py --board=nrf52840_dongle_dfu --no-app --programmer=none
|
run: ./deploy.py --board=nrf52840_dongle_dfu --no-app --programmer=none
|
||||||
- name: Building board nrf52840_mdk_dfu
|
- name: Building board nrf52840_mdk_dfu
|
||||||
|
|||||||
@@ -64,9 +64,9 @@ For a more detailed guide, please refer to our
|
|||||||
|
|
||||||
```shell
|
```shell
|
||||||
# Nordic nRF52840-DK board
|
# Nordic nRF52840-DK board
|
||||||
./deploy.py --board=nrf52840dk --opensk
|
./deploy.py --board=nrf52840dk_opensk --opensk
|
||||||
# Nordic nRF52840-Dongle
|
# Nordic nRF52840-Dongle
|
||||||
./deploy.py --board=nrf52840_dongle --opensk
|
./deploy.py --board=nrf52840_dongle_opensk --opensk
|
||||||
```
|
```
|
||||||
|
|
||||||
1. Finally you need to inject the cryptographic material if you enabled
|
1. Finally you need to inject the cryptographic material if you enabled
|
||||||
@@ -131,7 +131,7 @@ driver, before faulting the app, you can use the `--panic-console` flag of the
|
|||||||
|
|
||||||
```shell
|
```shell
|
||||||
# Example on Nordic nRF52840-DK board
|
# Example on Nordic nRF52840-DK board
|
||||||
./deploy.py --board=nrf52840dk --opensk --panic-console
|
./deploy.py --board=nrf52840dk_opensk --opensk --panic-console
|
||||||
```
|
```
|
||||||
|
|
||||||
### Debugging memory allocations
|
### Debugging memory allocations
|
||||||
|
|||||||
14
boards/nordic/nrf52840_dongle_opensk/Cargo.toml
Normal file
14
boards/nordic/nrf52840_dongle_opensk/Cargo.toml
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
[package]
|
||||||
|
name = "nrf52840_dongle_opensk"
|
||||||
|
version = "0.1.0"
|
||||||
|
authors = ["Tock Project Developers <tock-dev@googlegroups.com>"]
|
||||||
|
build = "build.rs"
|
||||||
|
edition = "2018"
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
|
components = { path = "../../components" }
|
||||||
|
cortexm4 = { path = "../../../arch/cortex-m4" }
|
||||||
|
capsules = { path = "../../../capsules" }
|
||||||
|
kernel = { path = "../../../kernel" }
|
||||||
|
nrf52840 = { path = "../../../chips/nrf52840" }
|
||||||
|
nrf52_components = { path = "../nrf52_components" }
|
||||||
28
boards/nordic/nrf52840_dongle_opensk/Makefile
Normal file
28
boards/nordic/nrf52840_dongle_opensk/Makefile
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
# Makefile for building the tock kernel for the nRF development kit
|
||||||
|
|
||||||
|
TARGET=thumbv7em-none-eabi
|
||||||
|
PLATFORM=nrf52840_dongle_opensk
|
||||||
|
|
||||||
|
include ../../Makefile.common
|
||||||
|
|
||||||
|
TOCKLOADER=tockloader
|
||||||
|
|
||||||
|
# Where in the nrf52 flash to load the kernel with `tockloader`
|
||||||
|
KERNEL_ADDRESS=0x00000
|
||||||
|
|
||||||
|
# Upload programs over uart with tockloader
|
||||||
|
ifdef PORT
|
||||||
|
TOCKLOADER_GENERAL_FLAGS += --port $(PORT)
|
||||||
|
endif
|
||||||
|
|
||||||
|
TOCKLOADER_JTAG_FLAGS = --jlink --board nrf52dk
|
||||||
|
|
||||||
|
# Upload the kernel over JTAG
|
||||||
|
.PHONY: flash
|
||||||
|
flash: $(TOCK_ROOT_DIRECTORY)target/$(TARGET)/release/$(PLATFORM).bin
|
||||||
|
$(TOCKLOADER) $(TOCKLOADER_GENERAL_FLAGS) flash --address $(KERNEL_ADDRESS) $(TOCKLOADER_JTAG_FLAGS) $<
|
||||||
|
|
||||||
|
# Upload the kernel over serial/bootloader
|
||||||
|
.PHONY: program
|
||||||
|
program: $(TOCK_ROOT_DIRECTORY)target/$(TARGET)/release/$(PLATFORM).hex
|
||||||
|
$(error Cannot program nRF52840-Dongle over USB. Use \`make flash\` and JTAG)
|
||||||
41
boards/nordic/nrf52840_dongle_opensk/README.md
Normal file
41
boards/nordic/nrf52840_dongle_opensk/README.md
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
Platform-Specific Instructions: nRF52840-Dongle
|
||||||
|
===================================
|
||||||
|
|
||||||
|
This is an adapted nrf52840\_dongle made to work with OpenSK.
|
||||||
|
|
||||||
|
The [nRF52840 Dongle](https://www.nordicsemi.com/Software-and-Tools/Development-Kits/nRF52840-Dongle)
|
||||||
|
is a platform based around the nRF52840, an SoC with an ARM Cortex-M4 and a BLE radio.
|
||||||
|
The kit is uses a USB key form factor and includes 1 button, 1 red LED and 1 RGB LED.
|
||||||
|
|
||||||
|
## Getting Started
|
||||||
|
|
||||||
|
To program the nRF52840 Dongle with Tock, you will need a JLink JTAG device and the
|
||||||
|
appropriate cables. An example setup is:
|
||||||
|
|
||||||
|
- [JLink JTAG Device](https://www.digikey.com/product-detail/en/segger-microcontroller-systems/8.08.90-J-LINK-EDU/899-1008-ND/2263130)
|
||||||
|
- [ARM to TagConnect Adapter](https://www.digikey.com/product-detail/en/tag-connect-llc/TC2050-ARM2010/TC2050-ARM2010-ND/3528170)
|
||||||
|
- [10pin TagConnect Cable](https://www.digikey.com/product-detail/en/tag-connect-llc/TC2050-IDC-NL/TC2050-IDC-NL-ND/2605367)
|
||||||
|
|
||||||
|
Then, follow the [Tock Getting Started guide](../../../doc/Getting_Started.md)
|
||||||
|
|
||||||
|
JTAG is the preferred method to program. The development kit has the JTAG pins exposed either
|
||||||
|
through the half-moons pads or, below the PCB, on a Tag-Connect TC2050 connector footprint.
|
||||||
|
You need to [install JTAG software](../../../doc/Getting_Started.md#optional-requirements).
|
||||||
|
|
||||||
|
## Programming the kernel
|
||||||
|
Once you have all software installed, you should be able to simply run
|
||||||
|
make flash in this directory to install a fresh kernel.
|
||||||
|
|
||||||
|
## Programming user-level applications
|
||||||
|
You can program an application via JTAG using `tockloader`:
|
||||||
|
|
||||||
|
```shell
|
||||||
|
$ cd libtock-c/examples/<app>
|
||||||
|
$ make
|
||||||
|
$ tockloader install --jlink --board nrf52dk
|
||||||
|
```
|
||||||
|
|
||||||
|
## Debugging
|
||||||
|
|
||||||
|
See the [nrf52dk README](../nrf52dk/README.md) for information about debugging
|
||||||
|
the nRF52840 Dongle.
|
||||||
4
boards/nordic/nrf52840_dongle_opensk/build.rs
Normal file
4
boards/nordic/nrf52840_dongle_opensk/build.rs
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
fn main() {
|
||||||
|
println!("cargo:rerun-if-changed=layout.ld");
|
||||||
|
println!("cargo:rerun-if-changed=../../kernel_layout.ld");
|
||||||
|
}
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
#
|
||||||
|
#
|
||||||
|
#
|
||||||
|
# J-LINK GDB SERVER initialization
|
||||||
|
#
|
||||||
|
# This connects to a GDB Server listening
|
||||||
|
# for commands on localhost at tcp port 2331
|
||||||
|
target remote localhost:2331
|
||||||
|
monitor speed 30
|
||||||
|
file ../../../../target/thumbv7em-none-eabi/release/nrf52840_dongle
|
||||||
|
monitor reset
|
||||||
|
#
|
||||||
|
# CPU core initialization (to be done by user)
|
||||||
|
#
|
||||||
|
# Set the processor mode
|
||||||
|
# monitor reg cpsr = 0xd3
|
||||||
|
# Set auto JTAG speed
|
||||||
|
monitor speed auto
|
||||||
|
# Setup GDB FOR FASTER DOWNLOADS
|
||||||
|
set remote memory-write-packet-size 1024
|
||||||
|
set remote memory-write-packet-size fixed
|
||||||
|
# tui enable
|
||||||
|
# layout split
|
||||||
|
# layout service_pending_interrupts
|
||||||
|
b reset_handler
|
||||||
1
boards/nordic/nrf52840_dongle_opensk/jtag/jdbserver_pca10040.sh
Executable file
1
boards/nordic/nrf52840_dongle_opensk/jtag/jdbserver_pca10040.sh
Executable file
@@ -0,0 +1 @@
|
|||||||
|
JLinkGDBServer -device nRF52840_xxAA -speed 1200 -if swd -AutoConnect 1 -port 2331
|
||||||
2
boards/nordic/nrf52840_dongle_opensk/layout.ld
Normal file
2
boards/nordic/nrf52840_dongle_opensk/layout.ld
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
INCLUDE ../nrf52840_chip_layout.ld
|
||||||
|
INCLUDE ../../kernel_layout.ld
|
||||||
65
boards/nordic/nrf52840_dongle_opensk/src/io.rs
Normal file
65
boards/nordic/nrf52840_dongle_opensk/src/io.rs
Normal file
@@ -0,0 +1,65 @@
|
|||||||
|
use core::fmt::Write;
|
||||||
|
use core::panic::PanicInfo;
|
||||||
|
use cortexm4;
|
||||||
|
use kernel::debug;
|
||||||
|
use kernel::debug::IoWrite;
|
||||||
|
use kernel::hil::led;
|
||||||
|
use kernel::hil::uart::{self, Configure};
|
||||||
|
use nrf52840::gpio::Pin;
|
||||||
|
|
||||||
|
use crate::CHIP;
|
||||||
|
use crate::PROCESSES;
|
||||||
|
|
||||||
|
struct Writer {
|
||||||
|
initialized: bool,
|
||||||
|
}
|
||||||
|
|
||||||
|
static mut WRITER: Writer = Writer { initialized: false };
|
||||||
|
|
||||||
|
impl Write for Writer {
|
||||||
|
fn write_str(&mut self, s: &str) -> ::core::fmt::Result {
|
||||||
|
self.write(s.as_bytes());
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl IoWrite for Writer {
|
||||||
|
fn write(&mut self, buf: &[u8]) {
|
||||||
|
let uart = unsafe { &mut nrf52840::uart::UARTE0 };
|
||||||
|
if !self.initialized {
|
||||||
|
self.initialized = true;
|
||||||
|
uart.configure(uart::Parameters {
|
||||||
|
baud_rate: 115200,
|
||||||
|
stop_bits: uart::StopBits::One,
|
||||||
|
parity: uart::Parity::None,
|
||||||
|
hw_flow_control: false,
|
||||||
|
width: uart::Width::Eight,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
for &c in buf {
|
||||||
|
unsafe {
|
||||||
|
uart.send_byte(c);
|
||||||
|
}
|
||||||
|
while !uart.tx_ready() {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(not(test))]
|
||||||
|
#[no_mangle]
|
||||||
|
#[panic_handler]
|
||||||
|
/// Panic handler
|
||||||
|
pub unsafe extern "C" fn panic_fmt(pi: &PanicInfo) -> ! {
|
||||||
|
// The nRF52840 Dongle LEDs (see back of board)
|
||||||
|
const LED1_PIN: Pin = Pin::P0_06;
|
||||||
|
let led = &mut led::LedLow::new(&mut nrf52840::gpio::PORT[LED1_PIN]);
|
||||||
|
let writer = &mut WRITER;
|
||||||
|
debug::panic(
|
||||||
|
&mut [led],
|
||||||
|
writer,
|
||||||
|
pi,
|
||||||
|
&cortexm4::support::nop,
|
||||||
|
&PROCESSES,
|
||||||
|
&CHIP,
|
||||||
|
)
|
||||||
|
}
|
||||||
311
boards/nordic/nrf52840_dongle_opensk/src/main.rs
Normal file
311
boards/nordic/nrf52840_dongle_opensk/src/main.rs
Normal file
@@ -0,0 +1,311 @@
|
|||||||
|
//! Tock kernel for the Nordic Semiconductor nRF52840 dongle.
|
||||||
|
//!
|
||||||
|
//! It is based on nRF52840 SoC (Cortex M4 core with a BLE transceiver) with
|
||||||
|
//! many exported I/O and peripherals.
|
||||||
|
|
||||||
|
#![no_std]
|
||||||
|
// Disable this attribute when documenting, as a workaround for
|
||||||
|
// https://github.com/rust-lang/rust/issues/62184.
|
||||||
|
#![cfg_attr(not(doc), no_main)]
|
||||||
|
#![feature(const_in_array_repeat_expressions)]
|
||||||
|
#![deny(missing_docs)]
|
||||||
|
|
||||||
|
use kernel::common::dynamic_deferred_call::{DynamicDeferredCall, DynamicDeferredCallClientState};
|
||||||
|
use kernel::component::Component;
|
||||||
|
#[allow(unused_imports)]
|
||||||
|
use kernel::{capabilities, create_capability, debug, debug_gpio, debug_verbose, static_init};
|
||||||
|
use nrf52840::gpio::Pin;
|
||||||
|
use nrf52_components::{self, UartChannel, UartPins};
|
||||||
|
|
||||||
|
// The nRF52840 Dongle LEDs
|
||||||
|
const LED1_PIN: Pin = Pin::P0_06;
|
||||||
|
const LED2_R_PIN: Pin = Pin::P0_08;
|
||||||
|
const LED2_G_PIN: Pin = Pin::P1_09;
|
||||||
|
const LED2_B_PIN: Pin = Pin::P0_12;
|
||||||
|
|
||||||
|
// The nRF52840 Dongle button
|
||||||
|
const BUTTON_PIN: Pin = Pin::P1_06;
|
||||||
|
const BUTTON_RST_PIN: Pin = Pin::P0_18;
|
||||||
|
|
||||||
|
const UART_RTS: Option<Pin> = Some(Pin::P0_13);
|
||||||
|
const UART_TXD: Pin = Pin::P0_15;
|
||||||
|
const UART_CTS: Option<Pin> = Some(Pin::P0_17);
|
||||||
|
const UART_RXD: Pin = Pin::P0_20;
|
||||||
|
|
||||||
|
// SPI pins not currently in use, but left here for convenience
|
||||||
|
const _SPI_MOSI: Pin = Pin::P1_01;
|
||||||
|
const _SPI_MISO: Pin = Pin::P1_02;
|
||||||
|
const _SPI_CLK: Pin = Pin::P1_04;
|
||||||
|
|
||||||
|
/// UART Writer
|
||||||
|
pub mod io;
|
||||||
|
|
||||||
|
// State for loading and holding applications.
|
||||||
|
// How should the kernel respond when a process faults.
|
||||||
|
const FAULT_RESPONSE: kernel::procs::FaultResponse = kernel::procs::FaultResponse::Panic;
|
||||||
|
|
||||||
|
// Number of concurrent processes this platform supports.
|
||||||
|
const NUM_PROCS: usize = 8;
|
||||||
|
|
||||||
|
static mut PROCESSES: [Option<&'static dyn kernel::procs::ProcessType>; NUM_PROCS] =
|
||||||
|
[None; NUM_PROCS];
|
||||||
|
|
||||||
|
// Static reference to chip for panic dumps
|
||||||
|
static mut CHIP: Option<&'static nrf52840::chip::Chip> = None;
|
||||||
|
|
||||||
|
/// Dummy buffer that causes the linker to reserve enough space for the stack.
|
||||||
|
#[no_mangle]
|
||||||
|
#[link_section = ".stack_buffer"]
|
||||||
|
pub static mut STACK_MEMORY: [u8; 0x1000] = [0; 0x1000];
|
||||||
|
|
||||||
|
/// Supported drivers by the platform
|
||||||
|
pub struct Platform {
|
||||||
|
button: &'static capsules::button::Button<'static, nrf52840::gpio::GPIOPin<'static>>,
|
||||||
|
pconsole: &'static capsules::process_console::ProcessConsole<
|
||||||
|
'static,
|
||||||
|
components::process_console::Capability,
|
||||||
|
>,
|
||||||
|
console: &'static capsules::console::Console<'static>,
|
||||||
|
gpio: &'static capsules::gpio::GPIO<'static, nrf52840::gpio::GPIOPin<'static>>,
|
||||||
|
led: &'static capsules::led::LED<'static, nrf52840::gpio::GPIOPin<'static>>,
|
||||||
|
rng: &'static capsules::rng::RngDriver<'static>,
|
||||||
|
ipc: kernel::ipc::IPC,
|
||||||
|
analog_comparator: &'static capsules::analog_comparator::AnalogComparator<
|
||||||
|
'static,
|
||||||
|
nrf52840::acomp::Comparator<'static>,
|
||||||
|
>,
|
||||||
|
alarm: &'static capsules::alarm::AlarmDriver<
|
||||||
|
'static,
|
||||||
|
capsules::virtual_alarm::VirtualMuxAlarm<'static, nrf52840::rtc::Rtc<'static>>,
|
||||||
|
>,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl kernel::Platform for Platform {
|
||||||
|
fn with_driver<F, R>(&self, driver_num: usize, f: F) -> R
|
||||||
|
where
|
||||||
|
F: FnOnce(Option<&dyn kernel::Driver>) -> R,
|
||||||
|
{
|
||||||
|
match driver_num {
|
||||||
|
capsules::console::DRIVER_NUM => f(Some(self.console)),
|
||||||
|
capsules::gpio::DRIVER_NUM => f(Some(self.gpio)),
|
||||||
|
capsules::alarm::DRIVER_NUM => f(Some(self.alarm)),
|
||||||
|
capsules::led::DRIVER_NUM => f(Some(self.led)),
|
||||||
|
capsules::button::DRIVER_NUM => f(Some(self.button)),
|
||||||
|
capsules::rng::DRIVER_NUM => f(Some(self.rng)),
|
||||||
|
capsules::analog_comparator::DRIVER_NUM => f(Some(self.analog_comparator)),
|
||||||
|
kernel::ipc::DRIVER_NUM => f(Some(&self.ipc)),
|
||||||
|
_ => f(None),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Entry point in the vector table called on hard reset.
|
||||||
|
#[no_mangle]
|
||||||
|
pub unsafe fn reset_handler() {
|
||||||
|
// Loads relocations and clears BSS
|
||||||
|
nrf52840::init();
|
||||||
|
|
||||||
|
let board_kernel = static_init!(kernel::Kernel, kernel::Kernel::new(&PROCESSES));
|
||||||
|
|
||||||
|
// GPIOs
|
||||||
|
let gpio = components::gpio::GpioComponent::new(
|
||||||
|
board_kernel,
|
||||||
|
components::gpio_component_helper!(
|
||||||
|
nrf52840::gpio::GPIOPin,
|
||||||
|
// left side of the USB plug
|
||||||
|
0 => &nrf52840::gpio::PORT[Pin::P0_13],
|
||||||
|
1 => &nrf52840::gpio::PORT[Pin::P0_15],
|
||||||
|
2 => &nrf52840::gpio::PORT[Pin::P0_17],
|
||||||
|
3 => &nrf52840::gpio::PORT[Pin::P0_20],
|
||||||
|
4 => &nrf52840::gpio::PORT[Pin::P0_22],
|
||||||
|
5 => &nrf52840::gpio::PORT[Pin::P0_24],
|
||||||
|
6 => &nrf52840::gpio::PORT[Pin::P1_00],
|
||||||
|
7 => &nrf52840::gpio::PORT[Pin::P0_09],
|
||||||
|
8 => &nrf52840::gpio::PORT[Pin::P0_10],
|
||||||
|
// right side of the USB plug
|
||||||
|
9 => &nrf52840::gpio::PORT[Pin::P0_31],
|
||||||
|
10 => &nrf52840::gpio::PORT[Pin::P0_29],
|
||||||
|
11 => &nrf52840::gpio::PORT[Pin::P0_02],
|
||||||
|
12 => &nrf52840::gpio::PORT[Pin::P1_15],
|
||||||
|
13 => &nrf52840::gpio::PORT[Pin::P1_13],
|
||||||
|
14 => &nrf52840::gpio::PORT[Pin::P1_10],
|
||||||
|
// Below the PCB
|
||||||
|
15 => &nrf52840::gpio::PORT[Pin::P0_26],
|
||||||
|
16 => &nrf52840::gpio::PORT[Pin::P0_04],
|
||||||
|
17 => &nrf52840::gpio::PORT[Pin::P0_11],
|
||||||
|
18 => &nrf52840::gpio::PORT[Pin::P0_14],
|
||||||
|
19 => &nrf52840::gpio::PORT[Pin::P1_11],
|
||||||
|
20 => &nrf52840::gpio::PORT[Pin::P1_07],
|
||||||
|
21 => &nrf52840::gpio::PORT[Pin::P1_01],
|
||||||
|
22 => &nrf52840::gpio::PORT[Pin::P1_04],
|
||||||
|
23 => &nrf52840::gpio::PORT[Pin::P1_02]
|
||||||
|
),
|
||||||
|
)
|
||||||
|
.finalize(components::gpio_component_buf!(nrf52840::gpio::GPIOPin));
|
||||||
|
|
||||||
|
let button = components::button::ButtonComponent::new(
|
||||||
|
board_kernel,
|
||||||
|
components::button_component_helper!(
|
||||||
|
nrf52840::gpio::GPIOPin,
|
||||||
|
(
|
||||||
|
&nrf52840::gpio::PORT[BUTTON_PIN],
|
||||||
|
kernel::hil::gpio::ActivationMode::ActiveLow,
|
||||||
|
kernel::hil::gpio::FloatingState::PullUp
|
||||||
|
)
|
||||||
|
),
|
||||||
|
)
|
||||||
|
.finalize(components::button_component_buf!(nrf52840::gpio::GPIOPin));
|
||||||
|
|
||||||
|
let led = components::led::LedsComponent::new(components::led_component_helper!(
|
||||||
|
nrf52840::gpio::GPIOPin,
|
||||||
|
(
|
||||||
|
&nrf52840::gpio::PORT[LED1_PIN],
|
||||||
|
kernel::hil::gpio::ActivationMode::ActiveLow
|
||||||
|
),
|
||||||
|
(
|
||||||
|
&nrf52840::gpio::PORT[LED2_R_PIN],
|
||||||
|
kernel::hil::gpio::ActivationMode::ActiveLow
|
||||||
|
),
|
||||||
|
(
|
||||||
|
&nrf52840::gpio::PORT[LED2_G_PIN],
|
||||||
|
kernel::hil::gpio::ActivationMode::ActiveLow
|
||||||
|
),
|
||||||
|
(
|
||||||
|
&nrf52840::gpio::PORT[LED2_B_PIN],
|
||||||
|
kernel::hil::gpio::ActivationMode::ActiveLow
|
||||||
|
)
|
||||||
|
))
|
||||||
|
.finalize(components::led_component_buf!(nrf52840::gpio::GPIOPin));
|
||||||
|
|
||||||
|
let chip = static_init!(nrf52840::chip::Chip, nrf52840::chip::new());
|
||||||
|
CHIP = Some(chip);
|
||||||
|
|
||||||
|
nrf52_components::startup::NrfStartupComponent::new(
|
||||||
|
false,
|
||||||
|
BUTTON_RST_PIN,
|
||||||
|
nrf52840::uicr::Regulator0Output::V3_0,
|
||||||
|
)
|
||||||
|
.finalize(());
|
||||||
|
|
||||||
|
// Create capabilities that the board needs to call certain protected kernel
|
||||||
|
// functions.
|
||||||
|
let process_management_capability =
|
||||||
|
create_capability!(capabilities::ProcessManagementCapability);
|
||||||
|
let main_loop_capability = create_capability!(capabilities::MainLoopCapability);
|
||||||
|
let memory_allocation_capability = create_capability!(capabilities::MemoryAllocationCapability);
|
||||||
|
|
||||||
|
let gpio_port = &nrf52840::gpio::PORT;
|
||||||
|
|
||||||
|
// Configure kernel debug gpios as early as possible
|
||||||
|
kernel::debug::assign_gpios(
|
||||||
|
Some(&gpio_port[LED2_R_PIN]),
|
||||||
|
Some(&gpio_port[LED2_G_PIN]),
|
||||||
|
Some(&gpio_port[LED2_B_PIN]),
|
||||||
|
);
|
||||||
|
|
||||||
|
let rtc = &nrf52840::rtc::RTC;
|
||||||
|
rtc.start();
|
||||||
|
let mux_alarm = components::alarm::AlarmMuxComponent::new(rtc)
|
||||||
|
.finalize(components::alarm_mux_component_helper!(nrf52840::rtc::Rtc));
|
||||||
|
let alarm = components::alarm::AlarmDriverComponent::new(board_kernel, mux_alarm)
|
||||||
|
.finalize(components::alarm_component_helper!(nrf52840::rtc::Rtc));
|
||||||
|
let uart_channel = UartChannel::Pins(UartPins::new(UART_RTS, UART_TXD, UART_CTS, UART_RXD));
|
||||||
|
let channel = nrf52_components::UartChannelComponent::new(uart_channel, mux_alarm).finalize(());
|
||||||
|
|
||||||
|
let dynamic_deferred_call_clients =
|
||||||
|
static_init!([DynamicDeferredCallClientState; 2], Default::default());
|
||||||
|
let dynamic_deferred_caller = static_init!(
|
||||||
|
DynamicDeferredCall,
|
||||||
|
DynamicDeferredCall::new(dynamic_deferred_call_clients)
|
||||||
|
);
|
||||||
|
DynamicDeferredCall::set_global_instance(dynamic_deferred_caller);
|
||||||
|
|
||||||
|
// Create a shared UART channel for the console and for kernel debug.
|
||||||
|
let uart_mux =
|
||||||
|
components::console::UartMuxComponent::new(channel, 115200, dynamic_deferred_caller)
|
||||||
|
.finalize(());
|
||||||
|
|
||||||
|
let pconsole =
|
||||||
|
components::process_console::ProcessConsoleComponent::new(board_kernel, uart_mux)
|
||||||
|
.finalize(());
|
||||||
|
|
||||||
|
// Setup the console.
|
||||||
|
let console = components::console::ConsoleComponent::new(board_kernel, uart_mux).finalize(());
|
||||||
|
// Create the debugger object that handles calls to `debug!()`.
|
||||||
|
components::debug_writer::DebugWriterComponent::new(uart_mux).finalize(());
|
||||||
|
|
||||||
|
let rng = components::rng::RngComponent::new(board_kernel, &nrf52840::trng::TRNG).finalize(());
|
||||||
|
|
||||||
|
// Initialize AC using AIN5 (P0.29) as VIN+ and VIN- as AIN0 (P0.02)
|
||||||
|
// These are hardcoded pin assignments specified in the driver
|
||||||
|
let analog_comparator = components::analog_comparator::AcComponent::new(
|
||||||
|
&nrf52840::acomp::ACOMP,
|
||||||
|
components::acomp_component_helper!(
|
||||||
|
nrf52840::acomp::Channel,
|
||||||
|
&nrf52840::acomp::CHANNEL_AC0
|
||||||
|
),
|
||||||
|
)
|
||||||
|
.finalize(components::acomp_component_buf!(
|
||||||
|
nrf52840::acomp::Comparator
|
||||||
|
));
|
||||||
|
|
||||||
|
nrf52_components::NrfClockComponent::new().finalize(());
|
||||||
|
|
||||||
|
let platform = Platform {
|
||||||
|
button,
|
||||||
|
pconsole,
|
||||||
|
console,
|
||||||
|
led,
|
||||||
|
gpio,
|
||||||
|
rng,
|
||||||
|
alarm,
|
||||||
|
analog_comparator,
|
||||||
|
ipc: kernel::ipc::IPC::new(board_kernel, &memory_allocation_capability),
|
||||||
|
};
|
||||||
|
|
||||||
|
platform.pconsole.start();
|
||||||
|
debug!("Initialization complete. Entering main loop\r");
|
||||||
|
debug!("{}", &nrf52840::ficr::FICR_INSTANCE);
|
||||||
|
|
||||||
|
/// These symbols are defined in the linker script.
|
||||||
|
extern "C" {
|
||||||
|
/// Beginning of the ROM region containing app images.
|
||||||
|
static _sapps: u8;
|
||||||
|
/// End of the ROM region containing app images.
|
||||||
|
static _eapps: u8;
|
||||||
|
/// Beginning of the RAM region for app memory.
|
||||||
|
static mut _sappmem: u8;
|
||||||
|
/// End of the RAM region for app memory.
|
||||||
|
static _eappmem: u8;
|
||||||
|
}
|
||||||
|
|
||||||
|
kernel::procs::load_processes(
|
||||||
|
board_kernel,
|
||||||
|
chip,
|
||||||
|
core::slice::from_raw_parts(
|
||||||
|
&_sapps as *const u8,
|
||||||
|
&_eapps as *const u8 as usize - &_sapps as *const u8 as usize,
|
||||||
|
),
|
||||||
|
core::slice::from_raw_parts_mut(
|
||||||
|
&mut _sappmem as *mut u8,
|
||||||
|
&_eappmem as *const u8 as usize - &_sappmem as *const u8 as usize,
|
||||||
|
),
|
||||||
|
&mut PROCESSES,
|
||||||
|
FAULT_RESPONSE,
|
||||||
|
&process_management_capability,
|
||||||
|
)
|
||||||
|
.unwrap_or_else(|err| {
|
||||||
|
debug!("Error loading processes!");
|
||||||
|
debug!("{:?}", err);
|
||||||
|
});
|
||||||
|
|
||||||
|
let scheduler = components::sched::round_robin::RoundRobinComponent::new(&PROCESSES)
|
||||||
|
.finalize(components::rr_component_helper!(NUM_PROCS));
|
||||||
|
board_kernel.kernel_loop(
|
||||||
|
&platform,
|
||||||
|
chip,
|
||||||
|
Some(&platform.ipc),
|
||||||
|
scheduler,
|
||||||
|
&main_loop_capability,
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -10,7 +10,6 @@
|
|||||||
#![feature(const_in_array_repeat_expressions)]
|
#![feature(const_in_array_repeat_expressions)]
|
||||||
#![deny(missing_docs)]
|
#![deny(missing_docs)]
|
||||||
|
|
||||||
use capsules::virtual_alarm::VirtualMuxAlarm;
|
|
||||||
use kernel::common::dynamic_deferred_call::{DynamicDeferredCall, DynamicDeferredCallClientState};
|
use kernel::common::dynamic_deferred_call::{DynamicDeferredCall, DynamicDeferredCallClientState};
|
||||||
use kernel::component::Component;
|
use kernel::component::Component;
|
||||||
#[allow(unused_imports)]
|
#[allow(unused_imports)]
|
||||||
@@ -33,10 +32,6 @@ const UART_TXD: Pin = Pin::P0_20;
|
|||||||
const UART_CTS: Option<Pin> = Some(Pin::P0_03);
|
const UART_CTS: Option<Pin> = Some(Pin::P0_03);
|
||||||
const UART_RXD: Pin = Pin::P0_19;
|
const UART_RXD: Pin = Pin::P0_19;
|
||||||
|
|
||||||
// Constants related to the configuration of the 15.4 network stack
|
|
||||||
const SRC_MAC: u16 = 0xf00f;
|
|
||||||
const PAN_ID: u16 = 0xABCD;
|
|
||||||
|
|
||||||
/// UART Writer
|
/// UART Writer
|
||||||
pub mod io;
|
pub mod io;
|
||||||
|
|
||||||
@@ -76,12 +71,6 @@ pub static mut STACK_MEMORY: [u8; 0x1000] = [0; 0x1000];
|
|||||||
|
|
||||||
/// Supported drivers by the platform
|
/// Supported drivers by the platform
|
||||||
pub struct Platform {
|
pub struct Platform {
|
||||||
ble_radio: &'static capsules::ble_advertising_driver::BLE<
|
|
||||||
'static,
|
|
||||||
nrf52840::ble_radio::Radio<'static>,
|
|
||||||
VirtualMuxAlarm<'static, nrf52840::rtc::Rtc<'static>>,
|
|
||||||
>,
|
|
||||||
ieee802154_radio: &'static capsules::ieee802154::RadioDriver<'static>,
|
|
||||||
button: &'static capsules::button::Button<'static, nrf52840::gpio::GPIOPin<'static>>,
|
button: &'static capsules::button::Button<'static, nrf52840::gpio::GPIOPin<'static>>,
|
||||||
pconsole: &'static capsules::process_console::ProcessConsole<
|
pconsole: &'static capsules::process_console::ProcessConsole<
|
||||||
'static,
|
'static,
|
||||||
@@ -91,7 +80,6 @@ pub struct Platform {
|
|||||||
gpio: &'static capsules::gpio::GPIO<'static, nrf52840::gpio::GPIOPin<'static>>,
|
gpio: &'static capsules::gpio::GPIO<'static, nrf52840::gpio::GPIOPin<'static>>,
|
||||||
led: &'static capsules::led::LED<'static, nrf52840::gpio::GPIOPin<'static>>,
|
led: &'static capsules::led::LED<'static, nrf52840::gpio::GPIOPin<'static>>,
|
||||||
rng: &'static capsules::rng::RngDriver<'static>,
|
rng: &'static capsules::rng::RngDriver<'static>,
|
||||||
temp: &'static capsules::temperature::TemperatureSensor<'static>,
|
|
||||||
ipc: kernel::ipc::IPC,
|
ipc: kernel::ipc::IPC,
|
||||||
analog_comparator: &'static capsules::analog_comparator::AnalogComparator<
|
analog_comparator: &'static capsules::analog_comparator::AnalogComparator<
|
||||||
'static,
|
'static,
|
||||||
@@ -121,9 +109,6 @@ impl kernel::Platform for Platform {
|
|||||||
capsules::led::DRIVER_NUM => f(Some(self.led)),
|
capsules::led::DRIVER_NUM => f(Some(self.led)),
|
||||||
capsules::button::DRIVER_NUM => f(Some(self.button)),
|
capsules::button::DRIVER_NUM => f(Some(self.button)),
|
||||||
capsules::rng::DRIVER_NUM => f(Some(self.rng)),
|
capsules::rng::DRIVER_NUM => f(Some(self.rng)),
|
||||||
capsules::ble_advertising_driver::DRIVER_NUM => f(Some(self.ble_radio)),
|
|
||||||
capsules::ieee802154::DRIVER_NUM => f(Some(self.ieee802154_radio)),
|
|
||||||
capsules::temperature::DRIVER_NUM => f(Some(self.temp)),
|
|
||||||
capsules::analog_comparator::DRIVER_NUM => f(Some(self.analog_comparator)),
|
capsules::analog_comparator::DRIVER_NUM => f(Some(self.analog_comparator)),
|
||||||
nrf52840::nvmc::DRIVER_NUM => f(Some(self.nvmc)),
|
nrf52840::nvmc::DRIVER_NUM => f(Some(self.nvmc)),
|
||||||
capsules::usb::usb_ctap::DRIVER_NUM => f(Some(self.usb)),
|
capsules::usb::usb_ctap::DRIVER_NUM => f(Some(self.usb)),
|
||||||
@@ -263,28 +248,6 @@ pub unsafe fn reset_handler() {
|
|||||||
// Create the debugger object that handles calls to `debug!()`.
|
// Create the debugger object that handles calls to `debug!()`.
|
||||||
components::debug_writer::DebugWriterComponent::new(uart_mux).finalize(());
|
components::debug_writer::DebugWriterComponent::new(uart_mux).finalize(());
|
||||||
|
|
||||||
let ble_radio =
|
|
||||||
nrf52_components::BLEComponent::new(board_kernel, &nrf52840::ble_radio::RADIO, mux_alarm)
|
|
||||||
.finalize(());
|
|
||||||
|
|
||||||
let (ieee802154_radio, _mux_mac) = components::ieee802154::Ieee802154Component::new(
|
|
||||||
board_kernel,
|
|
||||||
&nrf52840::ieee802154_radio::RADIO,
|
|
||||||
&nrf52840::aes::AESECB,
|
|
||||||
PAN_ID,
|
|
||||||
SRC_MAC,
|
|
||||||
)
|
|
||||||
.finalize(components::ieee802154_component_helper!(
|
|
||||||
nrf52840::ieee802154_radio::Radio,
|
|
||||||
nrf52840::aes::AesECB<'static>
|
|
||||||
));
|
|
||||||
|
|
||||||
let temp = components::temperature::TemperatureComponent::new(
|
|
||||||
board_kernel,
|
|
||||||
&nrf52840::temperature::TEMP,
|
|
||||||
)
|
|
||||||
.finalize(());
|
|
||||||
|
|
||||||
let rng = components::rng::RngComponent::new(board_kernel, &nrf52840::trng::TRNG).finalize(());
|
let rng = components::rng::RngComponent::new(board_kernel, &nrf52840::trng::TRNG).finalize(());
|
||||||
|
|
||||||
// Initialize AC using AIN5 (P0.29) as VIN+ and VIN- as AIN0 (P0.02)
|
// Initialize AC using AIN5 (P0.29) as VIN+ and VIN- as AIN0 (P0.02)
|
||||||
@@ -355,14 +318,11 @@ pub unsafe fn reset_handler() {
|
|||||||
|
|
||||||
let platform = Platform {
|
let platform = Platform {
|
||||||
button,
|
button,
|
||||||
ble_radio,
|
|
||||||
ieee802154_radio,
|
|
||||||
pconsole,
|
pconsole,
|
||||||
console,
|
console,
|
||||||
led,
|
led,
|
||||||
gpio,
|
gpio,
|
||||||
rng,
|
rng,
|
||||||
temp,
|
|
||||||
alarm,
|
alarm,
|
||||||
analog_comparator,
|
analog_comparator,
|
||||||
nvmc,
|
nvmc,
|
||||||
|
|||||||
14
boards/nordic/nrf52840dk_opensk/Cargo.toml
Normal file
14
boards/nordic/nrf52840dk_opensk/Cargo.toml
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
[package]
|
||||||
|
name = "nrf52840dk_opensk"
|
||||||
|
version = "0.1.0"
|
||||||
|
authors = ["Tock Project Developers <tock-dev@googlegroups.com>"]
|
||||||
|
build = "build.rs"
|
||||||
|
edition = "2018"
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
|
components = { path = "../../components" }
|
||||||
|
cortexm4 = { path = "../../../arch/cortex-m4" }
|
||||||
|
capsules = { path = "../../../capsules" }
|
||||||
|
kernel = { path = "../../../kernel" }
|
||||||
|
nrf52840 = { path = "../../../chips/nrf52840" }
|
||||||
|
nrf52_components = { path = "../nrf52_components" }
|
||||||
31
boards/nordic/nrf52840dk_opensk/Makefile
Normal file
31
boards/nordic/nrf52840dk_opensk/Makefile
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
# Makefile for building the tock kernel for the nRF development kit
|
||||||
|
|
||||||
|
TARGET=thumbv7em-none-eabi
|
||||||
|
PLATFORM=nrf52840dk_opensk
|
||||||
|
|
||||||
|
include ../../Makefile.common
|
||||||
|
|
||||||
|
TOCKLOADER=tockloader
|
||||||
|
|
||||||
|
# Where in the SAM4L flash to load the kernel with `tockloader`
|
||||||
|
KERNEL_ADDRESS=0x00000
|
||||||
|
|
||||||
|
# Upload programs over uart with tockloader
|
||||||
|
ifdef PORT
|
||||||
|
TOCKLOADER_GENERAL_FLAGS += --port $(PORT)
|
||||||
|
endif
|
||||||
|
|
||||||
|
# Upload the kernel over JTAG
|
||||||
|
.PHONY: flash
|
||||||
|
flash: $(TOCK_ROOT_DIRECTORY)target/$(TARGET)/release/$(PLATFORM).bin
|
||||||
|
$(TOCKLOADER) $(TOCKLOADER_GENERAL_FLAGS) flash --address $(KERNEL_ADDRESS) --board nrf52dk --jlink $<
|
||||||
|
|
||||||
|
# Upload the kernel over JTAG using OpenOCD
|
||||||
|
.PHONY: flash-openocd
|
||||||
|
flash-openocd: $(TOCK_ROOT_DIRECTORY)target/$(TARGET)/release/$(PLATFORM).bin
|
||||||
|
$(TOCKLOADER) $(TOCKLOADER_GENERAL_FLAGS) flash --address $(KERNEL_ADDRESS) --board nrf52dk --openocd $<
|
||||||
|
|
||||||
|
# Upload the kernel over serial/bootloader
|
||||||
|
.PHONY: program
|
||||||
|
program: $(TOCK_ROOT_DIRECTORY)target/$(TARGET)/release/$(PLATFORM).hex
|
||||||
|
$(error Cannot program nRF52840DK over USB. Use \`make flash\` and JTAG)
|
||||||
65
boards/nordic/nrf52840dk_opensk/README.md
Normal file
65
boards/nordic/nrf52840dk_opensk/README.md
Normal file
@@ -0,0 +1,65 @@
|
|||||||
|
Platform-Specific Instructions: nRF52840-DK
|
||||||
|
===================================
|
||||||
|
|
||||||
|
This is an adapted nrf52840dk made to work with OpenSK.
|
||||||
|
|
||||||
|
The [nRF52840 Development
|
||||||
|
Kit](https://www.nordicsemi.com/Software-and-Tools/Development-Kits/nRF52840-DK) is a platform
|
||||||
|
based around the nRF52840, an SoC with an ARM Cortex-M4 and a BLE
|
||||||
|
radio. The kit is Arduino shield compatible and includes several
|
||||||
|
buttons.
|
||||||
|
|
||||||
|
## Getting Started
|
||||||
|
|
||||||
|
First, follow the [Tock Getting Started guide](../../../doc/Getting_Started.md)
|
||||||
|
|
||||||
|
JTAG is the preferred method to program. The development kit has an
|
||||||
|
integrated JTAG debugger, you simply need to [install JTAG
|
||||||
|
software](../../../doc/Getting_Started.md#loading-the-kernel-onto-a-board).
|
||||||
|
|
||||||
|
## Programming the kernel
|
||||||
|
Once you have all software installed, you should be able to simply run
|
||||||
|
make flash in this directory to install a fresh kernel.
|
||||||
|
|
||||||
|
## Programming user-level applications
|
||||||
|
You can program an application over USB using the integrated JTAG and `tockloader`:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ cd libtock-c/examples/<app>
|
||||||
|
$ make
|
||||||
|
$ tockloader install --jlink --board nrf52dk
|
||||||
|
```
|
||||||
|
|
||||||
|
The same options (`--jlink --board nrf52dk`) must be passed for other tockloader commands
|
||||||
|
such as `erase-apps` or `list`.
|
||||||
|
|
||||||
|
Viewing console output on the nrf52840dk is slightly different from other boards. You must use
|
||||||
|
```bash
|
||||||
|
$ tockloader listen
|
||||||
|
```
|
||||||
|
**followed by a press of the reset button** in order to view console output starting from the boot
|
||||||
|
sequence. Notably, you should not
|
||||||
|
pass the `--jlink` option to `tockloader listen`.
|
||||||
|
|
||||||
|
## Console output
|
||||||
|
|
||||||
|
This board supports two methods for writing messages to a console interface
|
||||||
|
(console driver for applications as well as debug statements in the kernel).
|
||||||
|
|
||||||
|
By default, messages are written to a UART interface over the GPIO pins `P0.05`
|
||||||
|
to `P0.08` (see the [main.rs](src/main.rs) file).
|
||||||
|
|
||||||
|
If you don't have any UART cables or want to use a different interface, there is
|
||||||
|
also a console over the Segger RTT protocol. This only requires a micro-USB
|
||||||
|
cable on the USB debugging port (the same used to flash Tock on the board), and
|
||||||
|
is enabled by setting the `USB_DEBUGGING` constant to `true` in the
|
||||||
|
[main.rs](src/main.rs) file.
|
||||||
|
This disables the UART interface.
|
||||||
|
|
||||||
|
For instructions about how to receive RTT messages on the host, see the
|
||||||
|
[corresponding capsule](../../../capsules/src/segger_rtt.rs).
|
||||||
|
|
||||||
|
## Debugging
|
||||||
|
|
||||||
|
See the [nrf52dk README](../nrf52dk/README.md) for information about debugging
|
||||||
|
the nRF52840dk.
|
||||||
4
boards/nordic/nrf52840dk_opensk/build.rs
Normal file
4
boards/nordic/nrf52840dk_opensk/build.rs
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
fn main() {
|
||||||
|
println!("cargo:rerun-if-changed=layout.ld");
|
||||||
|
println!("cargo:rerun-if-changed=../../kernel_layout.ld");
|
||||||
|
}
|
||||||
25
boards/nordic/nrf52840dk_opensk/jtag/gdbinit_pca10040.jlink
Normal file
25
boards/nordic/nrf52840dk_opensk/jtag/gdbinit_pca10040.jlink
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
#
|
||||||
|
#
|
||||||
|
#
|
||||||
|
# J-LINK GDB SERVER initialization
|
||||||
|
#
|
||||||
|
# This connects to a GDB Server listening
|
||||||
|
# for commands on localhost at tcp port 2331
|
||||||
|
target remote localhost:2331
|
||||||
|
monitor speed 30
|
||||||
|
file ../../../../target/thumbv7em-none-eabi/release/nrf52dk
|
||||||
|
monitor reset
|
||||||
|
#
|
||||||
|
# CPU core initialization (to be done by user)
|
||||||
|
#
|
||||||
|
# Set the processor mode
|
||||||
|
# monitor reg cpsr = 0xd3
|
||||||
|
# Set auto JTAG speed
|
||||||
|
monitor speed auto
|
||||||
|
# Setup GDB FOR FASTER DOWNLOADS
|
||||||
|
set remote memory-write-packet-size 1024
|
||||||
|
set remote memory-write-packet-size fixed
|
||||||
|
# tui enable
|
||||||
|
# layout split
|
||||||
|
# layout service_pending_interrupts
|
||||||
|
b reset_handler
|
||||||
1
boards/nordic/nrf52840dk_opensk/jtag/jdbserver_pca10040.sh
Executable file
1
boards/nordic/nrf52840dk_opensk/jtag/jdbserver_pca10040.sh
Executable file
@@ -0,0 +1 @@
|
|||||||
|
JLinkGDBServer -device nrf52 -speed 1200 -if swd -AutoConnect 1 -port 2331
|
||||||
2
boards/nordic/nrf52840dk_opensk/layout.ld
Normal file
2
boards/nordic/nrf52840dk_opensk/layout.ld
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
INCLUDE ../nrf52840_chip_layout.ld
|
||||||
|
INCLUDE ../../kernel_layout.ld
|
||||||
102
boards/nordic/nrf52840dk_opensk/src/io.rs
Normal file
102
boards/nordic/nrf52840dk_opensk/src/io.rs
Normal file
@@ -0,0 +1,102 @@
|
|||||||
|
use core::fmt::Write;
|
||||||
|
use core::panic::PanicInfo;
|
||||||
|
use cortexm4;
|
||||||
|
use kernel::debug;
|
||||||
|
use kernel::debug::IoWrite;
|
||||||
|
use kernel::hil::led;
|
||||||
|
use kernel::hil::uart::{self, Configure};
|
||||||
|
use nrf52840::gpio::Pin;
|
||||||
|
|
||||||
|
use crate::CHIP;
|
||||||
|
use crate::PROCESSES;
|
||||||
|
|
||||||
|
enum Writer {
|
||||||
|
WriterUart(/* initialized */ bool),
|
||||||
|
WriterRtt(&'static capsules::segger_rtt::SeggerRttMemory<'static>),
|
||||||
|
}
|
||||||
|
|
||||||
|
static mut WRITER: Writer = Writer::WriterUart(false);
|
||||||
|
|
||||||
|
fn wait() {
|
||||||
|
for _ in 0..100 {
|
||||||
|
cortexm4::support::nop();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Set the RTT memory buffer used to output panic messages.
|
||||||
|
pub unsafe fn set_rtt_memory(
|
||||||
|
rtt_memory: &'static mut capsules::segger_rtt::SeggerRttMemory<'static>,
|
||||||
|
) {
|
||||||
|
WRITER = Writer::WriterRtt(rtt_memory);
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Write for Writer {
|
||||||
|
fn write_str(&mut self, s: &str) -> ::core::fmt::Result {
|
||||||
|
self.write(s.as_bytes());
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl IoWrite for Writer {
|
||||||
|
fn write(&mut self, buf: &[u8]) {
|
||||||
|
match self {
|
||||||
|
Writer::WriterUart(ref mut initialized) => {
|
||||||
|
let uart = unsafe { &mut nrf52840::uart::UARTE0 };
|
||||||
|
if !*initialized {
|
||||||
|
*initialized = true;
|
||||||
|
uart.configure(uart::Parameters {
|
||||||
|
baud_rate: 115200,
|
||||||
|
stop_bits: uart::StopBits::One,
|
||||||
|
parity: uart::Parity::None,
|
||||||
|
hw_flow_control: false,
|
||||||
|
width: uart::Width::Eight,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
for &c in buf {
|
||||||
|
unsafe {
|
||||||
|
uart.send_byte(c);
|
||||||
|
}
|
||||||
|
while !uart.tx_ready() {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Writer::WriterRtt(rtt_memory) => {
|
||||||
|
let up_buffer = unsafe { &*rtt_memory.get_up_buffer_ptr() };
|
||||||
|
let buffer_len = up_buffer.length.get();
|
||||||
|
let buffer = unsafe {
|
||||||
|
core::slice::from_raw_parts_mut(
|
||||||
|
up_buffer.buffer.get() as *mut u8,
|
||||||
|
buffer_len as usize,
|
||||||
|
)
|
||||||
|
};
|
||||||
|
|
||||||
|
let mut write_position = up_buffer.write_position.get();
|
||||||
|
|
||||||
|
for &c in buf {
|
||||||
|
buffer[write_position as usize] = c;
|
||||||
|
write_position = (write_position + 1) % buffer_len;
|
||||||
|
up_buffer.write_position.set(write_position);
|
||||||
|
wait();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(not(test))]
|
||||||
|
#[no_mangle]
|
||||||
|
#[panic_handler]
|
||||||
|
/// Panic handler
|
||||||
|
pub unsafe extern "C" fn panic_fmt(pi: &PanicInfo) -> ! {
|
||||||
|
// The nRF52840DK LEDs (see back of board)
|
||||||
|
const LED1_PIN: Pin = Pin::P0_13;
|
||||||
|
let led = &mut led::LedLow::new(&mut nrf52840::gpio::PORT[LED1_PIN]);
|
||||||
|
let writer = &mut WRITER;
|
||||||
|
debug::panic(
|
||||||
|
&mut [led],
|
||||||
|
writer,
|
||||||
|
pi,
|
||||||
|
&cortexm4::support::nop,
|
||||||
|
&PROCESSES,
|
||||||
|
&CHIP,
|
||||||
|
)
|
||||||
|
}
|
||||||
396
boards/nordic/nrf52840dk_opensk/src/main.rs
Normal file
396
boards/nordic/nrf52840dk_opensk/src/main.rs
Normal file
@@ -0,0 +1,396 @@
|
|||||||
|
//! Tock kernel for the Nordic Semiconductor nRF52840 development kit (DK).
|
||||||
|
//!
|
||||||
|
//! It is based on nRF52840 SoC (Cortex M4 core with a BLE transceiver) with
|
||||||
|
//! many exported I/O and peripherals.
|
||||||
|
//!
|
||||||
|
//! Pin Configuration
|
||||||
|
//! -------------------
|
||||||
|
//!
|
||||||
|
//! ### `GPIO`
|
||||||
|
//!
|
||||||
|
//! | # | Pin | Ix | Header | Arduino |
|
||||||
|
//! |----|-------|----|--------|---------|
|
||||||
|
//! | 0 | P1.01 | 33 | P3 1 | D0 |
|
||||||
|
//! | 1 | P1.02 | 34 | P3 2 | D1 |
|
||||||
|
//! | 2 | P1.03 | 35 | P3 3 | D2 |
|
||||||
|
//! | 3 | P1.04 | 36 | P3 4 | D3 |
|
||||||
|
//! | 4 | P1.05 | 37 | P3 5 | D4 |
|
||||||
|
//! | 5 | P1.06 | 38 | P3 6 | D5 |
|
||||||
|
//! | 6 | P1.07 | 39 | P3 7 | D6 |
|
||||||
|
//! | 7 | P1.08 | 40 | P3 8 | D7 |
|
||||||
|
//! | 8 | P1.10 | 42 | P4 1 | D8 |
|
||||||
|
//! | 9 | P1.11 | 43 | P4 2 | D9 |
|
||||||
|
//! | 10 | P1.12 | 44 | P4 3 | D10 |
|
||||||
|
//! | 11 | P1.13 | 45 | P4 4 | D11 |
|
||||||
|
//! | 12 | P1.14 | 46 | P4 5 | D12 |
|
||||||
|
//! | 13 | P1.15 | 47 | P4 6 | D13 |
|
||||||
|
//! | 14 | P0.26 | 26 | P4 9 | D14 |
|
||||||
|
//! | 15 | P0.27 | 27 | P4 10 | D15 |
|
||||||
|
//!
|
||||||
|
//! ### `GPIO` / Analog Inputs
|
||||||
|
//!
|
||||||
|
//! | # | Pin | Header | Arduino |
|
||||||
|
//! |----|------------|--------|---------|
|
||||||
|
//! | 16 | P0.03 AIN1 | P2 1 | A0 |
|
||||||
|
//! | 17 | P0.04 AIN2 | P2 2 | A1 |
|
||||||
|
//! | 18 | P0.28 AIN4 | P2 3 | A2 |
|
||||||
|
//! | 19 | P0.29 AIN5 | P2 4 | A3 |
|
||||||
|
//! | 20 | P0.30 AIN6 | P2 5 | A4 |
|
||||||
|
//! | 21 | P0.31 AIN7 | P2 6 | A5 |
|
||||||
|
//! | 22 | P0.02 AIN0 | P4 8 | AVDD |
|
||||||
|
//!
|
||||||
|
//! ### Onboard Functions
|
||||||
|
//!
|
||||||
|
//! | Pin | Header | Function |
|
||||||
|
//! |-------|--------|----------|
|
||||||
|
//! | P0.05 | P6 3 | UART RTS |
|
||||||
|
//! | P0.06 | P6 4 | UART TXD |
|
||||||
|
//! | P0.07 | P6 5 | UART CTS |
|
||||||
|
//! | P0.08 | P6 6 | UART RXT |
|
||||||
|
//! | P0.11 | P24 1 | Button 1 |
|
||||||
|
//! | P0.12 | P24 2 | Button 2 |
|
||||||
|
//! | P0.13 | P24 3 | LED 1 |
|
||||||
|
//! | P0.14 | P24 4 | LED 2 |
|
||||||
|
//! | P0.15 | P24 5 | LED 3 |
|
||||||
|
//! | P0.16 | P24 6 | LED 4 |
|
||||||
|
//! | P0.18 | P24 8 | Reset |
|
||||||
|
//! | P0.19 | P24 9 | SPI CLK |
|
||||||
|
//! | P0.20 | P24 10 | SPI MOSI |
|
||||||
|
//! | P0.21 | P24 11 | SPI MISO |
|
||||||
|
//! | P0.24 | P24 14 | Button 3 |
|
||||||
|
//! | P0.25 | P24 15 | Button 4 |
|
||||||
|
|
||||||
|
#![no_std]
|
||||||
|
// Disable this attribute when documenting, as a workaround for
|
||||||
|
// https://github.com/rust-lang/rust/issues/62184.
|
||||||
|
#![cfg_attr(not(doc), no_main)]
|
||||||
|
#![feature(const_in_array_repeat_expressions)]
|
||||||
|
#![deny(missing_docs)]
|
||||||
|
|
||||||
|
use kernel::common::dynamic_deferred_call::{DynamicDeferredCall, DynamicDeferredCallClientState};
|
||||||
|
use kernel::component::Component;
|
||||||
|
#[allow(unused_imports)]
|
||||||
|
use kernel::{capabilities, create_capability, debug, debug_gpio, debug_verbose, static_init};
|
||||||
|
use nrf52840::gpio::Pin;
|
||||||
|
use nrf52_components::{self, UartChannel, UartPins};
|
||||||
|
|
||||||
|
// The nRF52840DK LEDs (see back of board)
|
||||||
|
const LED1_PIN: Pin = Pin::P0_13;
|
||||||
|
const LED2_PIN: Pin = Pin::P0_14;
|
||||||
|
const LED3_PIN: Pin = Pin::P0_15;
|
||||||
|
const LED4_PIN: Pin = Pin::P0_16;
|
||||||
|
|
||||||
|
// The nRF52840DK buttons (see back of board)
|
||||||
|
const BUTTON1_PIN: Pin = Pin::P0_11;
|
||||||
|
const BUTTON2_PIN: Pin = Pin::P0_12;
|
||||||
|
const BUTTON3_PIN: Pin = Pin::P0_24;
|
||||||
|
const BUTTON4_PIN: Pin = Pin::P0_25;
|
||||||
|
const BUTTON_RST_PIN: Pin = Pin::P0_18;
|
||||||
|
|
||||||
|
const UART_RTS: Option<Pin> = Some(Pin::P0_05);
|
||||||
|
const UART_TXD: Pin = Pin::P0_06;
|
||||||
|
const UART_CTS: Option<Pin> = Some(Pin::P0_07);
|
||||||
|
const UART_RXD: Pin = Pin::P0_08;
|
||||||
|
|
||||||
|
const SPI_MOSI: Pin = Pin::P0_20;
|
||||||
|
const SPI_MISO: Pin = Pin::P0_21;
|
||||||
|
const SPI_CLK: Pin = Pin::P0_19;
|
||||||
|
|
||||||
|
/// Debug Writer
|
||||||
|
pub mod io;
|
||||||
|
|
||||||
|
// Whether to use UART debugging or Segger RTT (USB) debugging.
|
||||||
|
// - Set to false to use UART.
|
||||||
|
// - Set to true to use Segger RTT over USB.
|
||||||
|
const USB_DEBUGGING: bool = true;
|
||||||
|
|
||||||
|
// State for loading and holding applications.
|
||||||
|
// How should the kernel respond when a process faults.
|
||||||
|
const FAULT_RESPONSE: kernel::procs::FaultResponse = kernel::procs::FaultResponse::Panic;
|
||||||
|
|
||||||
|
// Number of concurrent processes this platform supports.
|
||||||
|
const NUM_PROCS: usize = 8;
|
||||||
|
|
||||||
|
static mut PROCESSES: [Option<&'static dyn kernel::procs::ProcessType>; NUM_PROCS] =
|
||||||
|
[None; NUM_PROCS];
|
||||||
|
|
||||||
|
static mut CHIP: Option<&'static nrf52840::chip::Chip> = None;
|
||||||
|
|
||||||
|
/// Dummy buffer that causes the linker to reserve enough space for the stack.
|
||||||
|
#[no_mangle]
|
||||||
|
#[link_section = ".stack_buffer"]
|
||||||
|
pub static mut STACK_MEMORY: [u8; 0x1000] = [0; 0x1000];
|
||||||
|
|
||||||
|
/// Supported drivers by the platform
|
||||||
|
pub struct Platform {
|
||||||
|
button: &'static capsules::button::Button<'static, nrf52840::gpio::GPIOPin<'static>>,
|
||||||
|
pconsole: &'static capsules::process_console::ProcessConsole<
|
||||||
|
'static,
|
||||||
|
components::process_console::Capability,
|
||||||
|
>,
|
||||||
|
console: &'static capsules::console::Console<'static>,
|
||||||
|
gpio: &'static capsules::gpio::GPIO<'static, nrf52840::gpio::GPIOPin<'static>>,
|
||||||
|
led: &'static capsules::led::LED<'static, nrf52840::gpio::GPIOPin<'static>>,
|
||||||
|
rng: &'static capsules::rng::RngDriver<'static>,
|
||||||
|
ipc: kernel::ipc::IPC,
|
||||||
|
analog_comparator: &'static capsules::analog_comparator::AnalogComparator<
|
||||||
|
'static,
|
||||||
|
nrf52840::acomp::Comparator<'static>,
|
||||||
|
>,
|
||||||
|
alarm: &'static capsules::alarm::AlarmDriver<
|
||||||
|
'static,
|
||||||
|
capsules::virtual_alarm::VirtualMuxAlarm<'static, nrf52840::rtc::Rtc<'static>>,
|
||||||
|
>,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl kernel::Platform for Platform {
|
||||||
|
fn with_driver<F, R>(&self, driver_num: usize, f: F) -> R
|
||||||
|
where
|
||||||
|
F: FnOnce(Option<&dyn kernel::Driver>) -> R,
|
||||||
|
{
|
||||||
|
match driver_num {
|
||||||
|
capsules::console::DRIVER_NUM => f(Some(self.console)),
|
||||||
|
capsules::gpio::DRIVER_NUM => f(Some(self.gpio)),
|
||||||
|
capsules::alarm::DRIVER_NUM => f(Some(self.alarm)),
|
||||||
|
capsules::led::DRIVER_NUM => f(Some(self.led)),
|
||||||
|
capsules::button::DRIVER_NUM => f(Some(self.button)),
|
||||||
|
capsules::rng::DRIVER_NUM => f(Some(self.rng)),
|
||||||
|
capsules::analog_comparator::DRIVER_NUM => f(Some(self.analog_comparator)),
|
||||||
|
kernel::ipc::DRIVER_NUM => f(Some(&self.ipc)),
|
||||||
|
_ => f(None),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Entry point in the vector table called on hard reset.
|
||||||
|
#[no_mangle]
|
||||||
|
pub unsafe fn reset_handler() {
|
||||||
|
// Loads relocations and clears BSS
|
||||||
|
nrf52840::init();
|
||||||
|
|
||||||
|
let uart_channel = if USB_DEBUGGING {
|
||||||
|
// Initialize early so any panic beyond this point can use the RTT memory object.
|
||||||
|
let mut rtt_memory_refs =
|
||||||
|
components::segger_rtt::SeggerRttMemoryComponent::new().finalize(());
|
||||||
|
|
||||||
|
// XXX: This is inherently unsafe as it aliases the mutable reference to rtt_memory. This
|
||||||
|
// aliases reference is only used inside a panic handler, which should be OK, but maybe we
|
||||||
|
// should use a const reference to rtt_memory and leverage interior mutability instead.
|
||||||
|
self::io::set_rtt_memory(&mut *rtt_memory_refs.get_rtt_memory_ptr());
|
||||||
|
|
||||||
|
UartChannel::Rtt(rtt_memory_refs)
|
||||||
|
} else {
|
||||||
|
UartChannel::Pins(UartPins::new(UART_RTS, UART_TXD, UART_CTS, UART_RXD))
|
||||||
|
};
|
||||||
|
|
||||||
|
let board_kernel = static_init!(kernel::Kernel, kernel::Kernel::new(&PROCESSES));
|
||||||
|
|
||||||
|
let gpio = components::gpio::GpioComponent::new(
|
||||||
|
board_kernel,
|
||||||
|
components::gpio_component_helper!(
|
||||||
|
nrf52840::gpio::GPIOPin,
|
||||||
|
0 => &nrf52840::gpio::PORT[Pin::P1_01],
|
||||||
|
1 => &nrf52840::gpio::PORT[Pin::P1_02],
|
||||||
|
2 => &nrf52840::gpio::PORT[Pin::P1_03],
|
||||||
|
3 => &nrf52840::gpio::PORT[Pin::P1_04],
|
||||||
|
4 => &nrf52840::gpio::PORT[Pin::P1_05],
|
||||||
|
5 => &nrf52840::gpio::PORT[Pin::P1_06],
|
||||||
|
6 => &nrf52840::gpio::PORT[Pin::P1_07],
|
||||||
|
7 => &nrf52840::gpio::PORT[Pin::P1_08],
|
||||||
|
8 => &nrf52840::gpio::PORT[Pin::P1_10],
|
||||||
|
9 => &nrf52840::gpio::PORT[Pin::P1_11],
|
||||||
|
10 => &nrf52840::gpio::PORT[Pin::P1_12],
|
||||||
|
11 => &nrf52840::gpio::PORT[Pin::P1_13],
|
||||||
|
12 => &nrf52840::gpio::PORT[Pin::P1_14],
|
||||||
|
13 => &nrf52840::gpio::PORT[Pin::P1_15],
|
||||||
|
14 => &nrf52840::gpio::PORT[Pin::P0_26],
|
||||||
|
15 => &nrf52840::gpio::PORT[Pin::P0_27]
|
||||||
|
),
|
||||||
|
)
|
||||||
|
.finalize(components::gpio_component_buf!(nrf52840::gpio::GPIOPin));
|
||||||
|
|
||||||
|
let button = components::button::ButtonComponent::new(
|
||||||
|
board_kernel,
|
||||||
|
components::button_component_helper!(
|
||||||
|
nrf52840::gpio::GPIOPin,
|
||||||
|
(
|
||||||
|
&nrf52840::gpio::PORT[BUTTON1_PIN],
|
||||||
|
kernel::hil::gpio::ActivationMode::ActiveLow,
|
||||||
|
kernel::hil::gpio::FloatingState::PullUp
|
||||||
|
), //13
|
||||||
|
(
|
||||||
|
&nrf52840::gpio::PORT[BUTTON2_PIN],
|
||||||
|
kernel::hil::gpio::ActivationMode::ActiveLow,
|
||||||
|
kernel::hil::gpio::FloatingState::PullUp
|
||||||
|
), //14
|
||||||
|
(
|
||||||
|
&nrf52840::gpio::PORT[BUTTON3_PIN],
|
||||||
|
kernel::hil::gpio::ActivationMode::ActiveLow,
|
||||||
|
kernel::hil::gpio::FloatingState::PullUp
|
||||||
|
), //15
|
||||||
|
(
|
||||||
|
&nrf52840::gpio::PORT[BUTTON4_PIN],
|
||||||
|
kernel::hil::gpio::ActivationMode::ActiveLow,
|
||||||
|
kernel::hil::gpio::FloatingState::PullUp
|
||||||
|
) //16
|
||||||
|
),
|
||||||
|
)
|
||||||
|
.finalize(components::button_component_buf!(nrf52840::gpio::GPIOPin));
|
||||||
|
|
||||||
|
let led = components::led::LedsComponent::new(components::led_component_helper!(
|
||||||
|
nrf52840::gpio::GPIOPin,
|
||||||
|
(
|
||||||
|
&nrf52840::gpio::PORT[LED1_PIN],
|
||||||
|
kernel::hil::gpio::ActivationMode::ActiveLow
|
||||||
|
),
|
||||||
|
(
|
||||||
|
&nrf52840::gpio::PORT[LED2_PIN],
|
||||||
|
kernel::hil::gpio::ActivationMode::ActiveLow
|
||||||
|
),
|
||||||
|
(
|
||||||
|
&nrf52840::gpio::PORT[LED3_PIN],
|
||||||
|
kernel::hil::gpio::ActivationMode::ActiveLow
|
||||||
|
),
|
||||||
|
(
|
||||||
|
&nrf52840::gpio::PORT[LED4_PIN],
|
||||||
|
kernel::hil::gpio::ActivationMode::ActiveLow
|
||||||
|
)
|
||||||
|
))
|
||||||
|
.finalize(components::led_component_buf!(nrf52840::gpio::GPIOPin));
|
||||||
|
|
||||||
|
let chip = static_init!(nrf52840::chip::Chip, nrf52840::chip::new());
|
||||||
|
CHIP = Some(chip);
|
||||||
|
|
||||||
|
nrf52_components::startup::NrfStartupComponent::new(
|
||||||
|
false,
|
||||||
|
BUTTON_RST_PIN,
|
||||||
|
nrf52840::uicr::Regulator0Output::DEFAULT,
|
||||||
|
)
|
||||||
|
.finalize(());
|
||||||
|
|
||||||
|
// Create capabilities that the board needs to call certain protected kernel
|
||||||
|
// functions.
|
||||||
|
let process_management_capability =
|
||||||
|
create_capability!(capabilities::ProcessManagementCapability);
|
||||||
|
let main_loop_capability = create_capability!(capabilities::MainLoopCapability);
|
||||||
|
let memory_allocation_capability = create_capability!(capabilities::MemoryAllocationCapability);
|
||||||
|
let gpio_port = &nrf52840::gpio::PORT;
|
||||||
|
// Configure kernel debug gpios as early as possible
|
||||||
|
kernel::debug::assign_gpios(
|
||||||
|
Some(&gpio_port[LED1_PIN]),
|
||||||
|
Some(&gpio_port[LED2_PIN]),
|
||||||
|
Some(&gpio_port[LED3_PIN]),
|
||||||
|
);
|
||||||
|
|
||||||
|
let rtc = &nrf52840::rtc::RTC;
|
||||||
|
rtc.start();
|
||||||
|
let mux_alarm = components::alarm::AlarmMuxComponent::new(rtc)
|
||||||
|
.finalize(components::alarm_mux_component_helper!(nrf52840::rtc::Rtc));
|
||||||
|
let alarm = components::alarm::AlarmDriverComponent::new(board_kernel, mux_alarm)
|
||||||
|
.finalize(components::alarm_component_helper!(nrf52840::rtc::Rtc));
|
||||||
|
|
||||||
|
let channel = nrf52_components::UartChannelComponent::new(uart_channel, mux_alarm).finalize(());
|
||||||
|
|
||||||
|
let dynamic_deferred_call_clients =
|
||||||
|
static_init!([DynamicDeferredCallClientState; 2], Default::default());
|
||||||
|
let dynamic_deferred_caller = static_init!(
|
||||||
|
DynamicDeferredCall,
|
||||||
|
DynamicDeferredCall::new(dynamic_deferred_call_clients)
|
||||||
|
);
|
||||||
|
DynamicDeferredCall::set_global_instance(dynamic_deferred_caller);
|
||||||
|
|
||||||
|
// Create a shared UART channel for the console and for kernel debug.
|
||||||
|
let uart_mux =
|
||||||
|
components::console::UartMuxComponent::new(channel, 115200, dynamic_deferred_caller)
|
||||||
|
.finalize(());
|
||||||
|
|
||||||
|
let pconsole =
|
||||||
|
components::process_console::ProcessConsoleComponent::new(board_kernel, uart_mux)
|
||||||
|
.finalize(());
|
||||||
|
|
||||||
|
// Setup the console.
|
||||||
|
let console = components::console::ConsoleComponent::new(board_kernel, uart_mux).finalize(());
|
||||||
|
// Create the debugger object that handles calls to `debug!()`.
|
||||||
|
components::debug_writer::DebugWriterComponent::new(uart_mux).finalize(());
|
||||||
|
|
||||||
|
let rng = components::rng::RngComponent::new(board_kernel, &nrf52840::trng::TRNG).finalize(());
|
||||||
|
|
||||||
|
nrf52840::spi::SPIM0.configure(
|
||||||
|
nrf52840::pinmux::Pinmux::new(SPI_MOSI as u32),
|
||||||
|
nrf52840::pinmux::Pinmux::new(SPI_MISO as u32),
|
||||||
|
nrf52840::pinmux::Pinmux::new(SPI_CLK as u32),
|
||||||
|
);
|
||||||
|
|
||||||
|
// Initialize AC using AIN5 (P0.29) as VIN+ and VIN- as AIN0 (P0.02)
|
||||||
|
// These are hardcoded pin assignments specified in the driver
|
||||||
|
let analog_comparator = components::analog_comparator::AcComponent::new(
|
||||||
|
&nrf52840::acomp::ACOMP,
|
||||||
|
components::acomp_component_helper!(
|
||||||
|
nrf52840::acomp::Channel,
|
||||||
|
&nrf52840::acomp::CHANNEL_AC0
|
||||||
|
),
|
||||||
|
)
|
||||||
|
.finalize(components::acomp_component_buf!(
|
||||||
|
nrf52840::acomp::Comparator
|
||||||
|
));
|
||||||
|
|
||||||
|
nrf52_components::NrfClockComponent::new().finalize(());
|
||||||
|
|
||||||
|
let platform = Platform {
|
||||||
|
button,
|
||||||
|
pconsole,
|
||||||
|
console,
|
||||||
|
led,
|
||||||
|
gpio,
|
||||||
|
rng,
|
||||||
|
alarm,
|
||||||
|
analog_comparator,
|
||||||
|
ipc: kernel::ipc::IPC::new(board_kernel, &memory_allocation_capability),
|
||||||
|
};
|
||||||
|
|
||||||
|
platform.pconsole.start();
|
||||||
|
debug!("Initialization complete. Entering main loop\r");
|
||||||
|
debug!("{}", &nrf52840::ficr::FICR_INSTANCE);
|
||||||
|
|
||||||
|
/// These symbols are defined in the linker script.
|
||||||
|
extern "C" {
|
||||||
|
/// Beginning of the ROM region containing app images.
|
||||||
|
static _sapps: u8;
|
||||||
|
/// End of the ROM region containing app images.
|
||||||
|
static _eapps: u8;
|
||||||
|
/// Beginning of the RAM region for app memory.
|
||||||
|
static mut _sappmem: u8;
|
||||||
|
/// End of the RAM region for app memory.
|
||||||
|
static _eappmem: u8;
|
||||||
|
}
|
||||||
|
|
||||||
|
kernel::procs::load_processes(
|
||||||
|
board_kernel,
|
||||||
|
chip,
|
||||||
|
core::slice::from_raw_parts(
|
||||||
|
&_sapps as *const u8,
|
||||||
|
&_eapps as *const u8 as usize - &_sapps as *const u8 as usize,
|
||||||
|
),
|
||||||
|
core::slice::from_raw_parts_mut(
|
||||||
|
&mut _sappmem as *mut u8,
|
||||||
|
&_eappmem as *const u8 as usize - &_sappmem as *const u8 as usize,
|
||||||
|
),
|
||||||
|
&mut PROCESSES,
|
||||||
|
FAULT_RESPONSE,
|
||||||
|
&process_management_capability,
|
||||||
|
)
|
||||||
|
.unwrap_or_else(|err| {
|
||||||
|
debug!("Error loading processes!");
|
||||||
|
debug!("{:?}", err);
|
||||||
|
});
|
||||||
|
|
||||||
|
let scheduler = components::sched::round_robin::RoundRobinComponent::new(&PROCESSES)
|
||||||
|
.finalize(components::rr_component_helper!(NUM_PROCS));
|
||||||
|
board_kernel.kernel_loop(
|
||||||
|
&platform,
|
||||||
|
chip,
|
||||||
|
Some(&platform.ipc),
|
||||||
|
scheduler,
|
||||||
|
&main_loop_capability,
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -84,9 +84,9 @@ OpenSKBoard = collections.namedtuple(
|
|||||||
])
|
])
|
||||||
|
|
||||||
SUPPORTED_BOARDS = {
|
SUPPORTED_BOARDS = {
|
||||||
"nrf52840dk":
|
"nrf52840dk_opensk":
|
||||||
OpenSKBoard(
|
OpenSKBoard(
|
||||||
path="third_party/tock/boards/nordic/nrf52840dk",
|
path="third_party/tock/boards/nordic/nrf52840dk_opensk",
|
||||||
arch="thumbv7em-none-eabi",
|
arch="thumbv7em-none-eabi",
|
||||||
page_size=4096,
|
page_size=4096,
|
||||||
kernel_address=0,
|
kernel_address=0,
|
||||||
@@ -103,9 +103,9 @@ SUPPORTED_BOARDS = {
|
|||||||
jlink_device="nrf52840_xxaa",
|
jlink_device="nrf52840_xxaa",
|
||||||
nordic_dfu=False,
|
nordic_dfu=False,
|
||||||
),
|
),
|
||||||
"nrf52840_dongle":
|
"nrf52840_dongle_opensk":
|
||||||
OpenSKBoard(
|
OpenSKBoard(
|
||||||
path="third_party/tock/boards/nordic/nrf52840_dongle",
|
path="third_party/tock/boards/nordic/nrf52840_dongle_opensk",
|
||||||
arch="thumbv7em-none-eabi",
|
arch="thumbv7em-none-eabi",
|
||||||
page_size=4096,
|
page_size=4096,
|
||||||
kernel_address=0,
|
kernel_address=0,
|
||||||
|
|||||||
@@ -156,18 +156,18 @@ an OpenSK device with the correct certificate and private key.
|
|||||||
(_output may differ_):
|
(_output may differ_):
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
$ ./deploy.py --board=nrf52840dk --opensk
|
$ ./deploy.py --board=nrf52840dk_opensk --opensk
|
||||||
info: Updating rust toolchain to nightly-2020-02-03
|
info: Updating rust toolchain to nightly-2020-02-03
|
||||||
info: syncing channel updates for 'nightly-2020-02-03-x86_64-unknown-linux-gnu'
|
info: syncing channel updates for 'nightly-2020-02-03-x86_64-unknown-linux-gnu'
|
||||||
info: checking for self-updates
|
info: checking for self-updates
|
||||||
info: component 'rust-std' for target 'thumbv7em-none-eabi' is up to date
|
info: component 'rust-std' for target 'thumbv7em-none-eabi' is up to date
|
||||||
info: Rust toolchain up-to-date
|
info: Rust toolchain up-to-date
|
||||||
info: Building Tock OS for board nrf52840dk
|
info: Building Tock OS for board nrf52840dk_opensk
|
||||||
Compiling tock-registers v0.5.0 (./third_party/tock/libraries/tock-register-interface)
|
Compiling tock-registers v0.5.0 (./third_party/tock/libraries/tock-register-interface)
|
||||||
Compiling tock-cells v0.1.0 (./third_party/tock/libraries/tock-cells)
|
Compiling tock-cells v0.1.0 (./third_party/tock/libraries/tock-cells)
|
||||||
Compiling enum_primitive v0.1.0 (./third_party/tock/libraries/enum_primitive)
|
Compiling enum_primitive v0.1.0 (./third_party/tock/libraries/enum_primitive)
|
||||||
Compiling tock_rt0 v0.1.0 (./third_party/tock/libraries/tock-rt0)
|
Compiling tock_rt0 v0.1.0 (./third_party/tock/libraries/tock-rt0)
|
||||||
Compiling nrf52840dk v0.1.0 (./third_party/tock/boards/nordic/nrf52840dk)
|
Compiling nrf52840dk_opensk v0.1.0 (./third_party/tock/boards/nordic/nrf52840dk_opensk)
|
||||||
Compiling kernel v0.1.0 (./third_party/tock/kernel)
|
Compiling kernel v0.1.0 (./third_party/tock/kernel)
|
||||||
Compiling cortexm v0.1.0 (./third_party/tock/arch/cortex-m)
|
Compiling cortexm v0.1.0 (./third_party/tock/arch/cortex-m)
|
||||||
Compiling nrf5x v0.1.0 (./third_party/tock/chips/nrf5x)
|
Compiling nrf5x v0.1.0 (./third_party/tock/chips/nrf5x)
|
||||||
@@ -184,7 +184,7 @@ an OpenSK device with the correct certificate and private key.
|
|||||||
info: Generating Tock TAB file for application/example ctap2
|
info: Generating Tock TAB file for application/example ctap2
|
||||||
info: Erasing all installed applications
|
info: Erasing all installed applications
|
||||||
All apps have been erased.
|
All apps have been erased.
|
||||||
info: Flashing file third_party/tock/boards/nordic/nrf52840dk/target/thumbv7em-none-eabi/release/nrf52840dk.bin.
|
info: Flashing file third_party/tock/boards/nordic/nrf52840dk_opensk/target/thumbv7em-none-eabi/release/nrf52840dk_opensk.bin.
|
||||||
info: Flashing padding application
|
info: Flashing padding application
|
||||||
info: Installing Tock application ctap2
|
info: Installing Tock application ctap2
|
||||||
info: You're all set!
|
info: You're all set!
|
||||||
@@ -270,7 +270,7 @@ our tool, `deploy.py` also supports other methods:
|
|||||||
left to the user.
|
left to the user.
|
||||||
|
|
||||||
If your board is already flashed with Tock OS, you may skip installing it:
|
If your board is already flashed with Tock OS, you may skip installing it:
|
||||||
`./deploy.py --board=nrf52840dk --opensk --no-tockos`
|
`./deploy.py --board=nrf52840dk_opensk --opensk --no-tockos`
|
||||||
|
|
||||||
For more options, we invite you to read the help of our `deploy.py` script by
|
For more options, we invite you to read the help of our `deploy.py` script by
|
||||||
running `./deploy.py --help`.
|
running `./deploy.py --help`.
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
diff --git a/boards/nordic/nrf52840_dongle/src/main.rs b/boards/nordic/nrf52840_dongle/src/main.rs
|
diff --git a/boards/nordic/nrf52840_dongle_opensk/src/main.rs b/boards/nordic/nrf52840_dongle_opensk/src/main.rs
|
||||||
index fc53f59c8..d72d20482 100644
|
index e0e292a7e..b485a0997 100644
|
||||||
--- a/boards/nordic/nrf52840_dongle/src/main.rs
|
--- a/boards/nordic/nrf52840_dongle_opensk/src/main.rs
|
||||||
+++ b/boards/nordic/nrf52840_dongle/src/main.rs
|
+++ b/boards/nordic/nrf52840_dongle_opensk/src/main.rs
|
||||||
@@ -55,6 +55,11 @@ const NUM_PROCS: usize = 8;
|
@@ -50,6 +50,11 @@ const NUM_PROCS: usize = 8;
|
||||||
static mut PROCESSES: [Option<&'static dyn kernel::procs::ProcessType>; NUM_PROCS] =
|
static mut PROCESSES: [Option<&'static dyn kernel::procs::ProcessType>; NUM_PROCS] =
|
||||||
[None; NUM_PROCS];
|
[None; NUM_PROCS];
|
||||||
|
|
||||||
@@ -14,7 +14,7 @@ index fc53f59c8..d72d20482 100644
|
|||||||
// Static reference to chip for panic dumps
|
// Static reference to chip for panic dumps
|
||||||
static mut CHIP: Option<&'static nrf52840::chip::Chip> = None;
|
static mut CHIP: Option<&'static nrf52840::chip::Chip> = None;
|
||||||
|
|
||||||
@@ -90,6 +95,7 @@ pub struct Platform {
|
@@ -78,6 +83,7 @@ pub struct Platform {
|
||||||
'static,
|
'static,
|
||||||
capsules::virtual_alarm::VirtualMuxAlarm<'static, nrf52840::rtc::Rtc<'static>>,
|
capsules::virtual_alarm::VirtualMuxAlarm<'static, nrf52840::rtc::Rtc<'static>>,
|
||||||
>,
|
>,
|
||||||
@@ -22,9 +22,9 @@ index fc53f59c8..d72d20482 100644
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl kernel::Platform for Platform {
|
impl kernel::Platform for Platform {
|
||||||
@@ -108,10 +114,30 @@ impl kernel::Platform for Platform {
|
@@ -93,10 +99,30 @@ impl kernel::Platform for Platform {
|
||||||
capsules::ieee802154::DRIVER_NUM => f(Some(self.ieee802154_radio)),
|
capsules::button::DRIVER_NUM => f(Some(self.button)),
|
||||||
capsules::temperature::DRIVER_NUM => f(Some(self.temp)),
|
capsules::rng::DRIVER_NUM => f(Some(self.rng)),
|
||||||
capsules::analog_comparator::DRIVER_NUM => f(Some(self.analog_comparator)),
|
capsules::analog_comparator::DRIVER_NUM => f(Some(self.analog_comparator)),
|
||||||
+ nrf52840::nvmc::DRIVER_NUM => f(Some(self.nvmc)),
|
+ nrf52840::nvmc::DRIVER_NUM => f(Some(self.nvmc)),
|
||||||
kernel::ipc::DRIVER_NUM => f(Some(&self.ipc)),
|
kernel::ipc::DRIVER_NUM => f(Some(&self.ipc)),
|
||||||
@@ -53,7 +53,7 @@ index fc53f59c8..d72d20482 100644
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Entry point in the vector table called on hard reset.
|
/// Entry point in the vector table called on hard reset.
|
||||||
@@ -120,7 +146,10 @@ pub unsafe fn reset_handler() {
|
@@ -105,7 +131,10 @@ pub unsafe fn reset_handler() {
|
||||||
// Loads relocations and clears BSS
|
// Loads relocations and clears BSS
|
||||||
nrf52840::init();
|
nrf52840::init();
|
||||||
|
|
||||||
@@ -65,7 +65,7 @@ index fc53f59c8..d72d20482 100644
|
|||||||
|
|
||||||
// GPIOs
|
// GPIOs
|
||||||
let gpio = components::gpio::GpioComponent::new(
|
let gpio = components::gpio::GpioComponent::new(
|
||||||
@@ -286,6 +315,14 @@ pub unsafe fn reset_handler() {
|
@@ -249,6 +278,14 @@ pub unsafe fn reset_handler() {
|
||||||
nrf52840::acomp::Comparator
|
nrf52840::acomp::Comparator
|
||||||
));
|
));
|
||||||
|
|
||||||
@@ -80,19 +80,19 @@ index fc53f59c8..d72d20482 100644
|
|||||||
nrf52_components::NrfClockComponent::new().finalize(());
|
nrf52_components::NrfClockComponent::new().finalize(());
|
||||||
|
|
||||||
let platform = Platform {
|
let platform = Platform {
|
||||||
@@ -300,6 +337,7 @@ pub unsafe fn reset_handler() {
|
@@ -260,6 +297,7 @@ pub unsafe fn reset_handler() {
|
||||||
temp,
|
rng,
|
||||||
alarm,
|
alarm,
|
||||||
analog_comparator,
|
analog_comparator,
|
||||||
+ nvmc,
|
+ nvmc,
|
||||||
ipc: kernel::ipc::IPC::new(board_kernel, &memory_allocation_capability),
|
ipc: kernel::ipc::IPC::new(board_kernel, &memory_allocation_capability),
|
||||||
};
|
};
|
||||||
|
|
||||||
diff --git a/boards/nordic/nrf52840dk/src/main.rs b/boards/nordic/nrf52840dk/src/main.rs
|
diff --git a/boards/nordic/nrf52840dk_opensk/src/main.rs b/boards/nordic/nrf52840dk_opensk/src/main.rs
|
||||||
index 169f3d393..2ebb384d8 100644
|
index 8e4238018..ebee8704b 100644
|
||||||
--- a/boards/nordic/nrf52840dk/src/main.rs
|
--- a/boards/nordic/nrf52840dk_opensk/src/main.rs
|
||||||
+++ b/boards/nordic/nrf52840dk/src/main.rs
|
+++ b/boards/nordic/nrf52840dk_opensk/src/main.rs
|
||||||
@@ -123,6 +123,11 @@ const NUM_PROCS: usize = 8;
|
@@ -114,6 +114,11 @@ const NUM_PROCS: usize = 8;
|
||||||
static mut PROCESSES: [Option<&'static dyn kernel::procs::ProcessType>; NUM_PROCS] =
|
static mut PROCESSES: [Option<&'static dyn kernel::procs::ProcessType>; NUM_PROCS] =
|
||||||
[None; NUM_PROCS];
|
[None; NUM_PROCS];
|
||||||
|
|
||||||
@@ -104,18 +104,18 @@ index 169f3d393..2ebb384d8 100644
|
|||||||
static mut CHIP: Option<&'static nrf52840::chip::Chip> = None;
|
static mut CHIP: Option<&'static nrf52840::chip::Chip> = None;
|
||||||
|
|
||||||
/// Dummy buffer that causes the linker to reserve enough space for the stack.
|
/// Dummy buffer that causes the linker to reserve enough space for the stack.
|
||||||
@@ -158,6 +163,7 @@ pub struct Platform {
|
@@ -141,6 +146,7 @@ pub struct Platform {
|
||||||
|
'static,
|
||||||
capsules::virtual_alarm::VirtualMuxAlarm<'static, nrf52840::rtc::Rtc<'static>>,
|
capsules::virtual_alarm::VirtualMuxAlarm<'static, nrf52840::rtc::Rtc<'static>>,
|
||||||
>,
|
>,
|
||||||
nonvolatile_storage: &'static capsules::nonvolatile_storage_driver::NonvolatileStorage<'static>,
|
|
||||||
+ nvmc: &'static nrf52840::nvmc::SyscallDriver,
|
+ nvmc: &'static nrf52840::nvmc::SyscallDriver,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl kernel::Platform for Platform {
|
impl kernel::Platform for Platform {
|
||||||
@@ -177,10 +183,30 @@ impl kernel::Platform for Platform {
|
@@ -156,10 +162,30 @@ impl kernel::Platform for Platform {
|
||||||
capsules::temperature::DRIVER_NUM => f(Some(self.temp)),
|
capsules::button::DRIVER_NUM => f(Some(self.button)),
|
||||||
|
capsules::rng::DRIVER_NUM => f(Some(self.rng)),
|
||||||
capsules::analog_comparator::DRIVER_NUM => f(Some(self.analog_comparator)),
|
capsules::analog_comparator::DRIVER_NUM => f(Some(self.analog_comparator)),
|
||||||
capsules::nonvolatile_storage_driver::DRIVER_NUM => f(Some(self.nonvolatile_storage)),
|
|
||||||
+ nrf52840::nvmc::DRIVER_NUM => f(Some(self.nvmc)),
|
+ nrf52840::nvmc::DRIVER_NUM => f(Some(self.nvmc)),
|
||||||
kernel::ipc::DRIVER_NUM => f(Some(&self.ipc)),
|
kernel::ipc::DRIVER_NUM => f(Some(&self.ipc)),
|
||||||
_ => f(None),
|
_ => f(None),
|
||||||
@@ -143,7 +143,7 @@ index 169f3d393..2ebb384d8 100644
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Entry point in the vector table called on hard reset.
|
/// Entry point in the vector table called on hard reset.
|
||||||
@@ -204,7 +230,10 @@ pub unsafe fn reset_handler() {
|
@@ -183,7 +209,10 @@ pub unsafe fn reset_handler() {
|
||||||
UartChannel::Pins(UartPins::new(UART_RTS, UART_TXD, UART_CTS, UART_RXD))
|
UartChannel::Pins(UartPins::new(UART_RTS, UART_TXD, UART_CTS, UART_RXD))
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -155,7 +155,7 @@ index 169f3d393..2ebb384d8 100644
|
|||||||
|
|
||||||
let gpio = components::gpio::GpioComponent::new(
|
let gpio = components::gpio::GpioComponent::new(
|
||||||
board_kernel,
|
board_kernel,
|
||||||
@@ -411,6 +440,14 @@ pub unsafe fn reset_handler() {
|
@@ -334,6 +363,14 @@ pub unsafe fn reset_handler() {
|
||||||
nrf52840::acomp::Comparator
|
nrf52840::acomp::Comparator
|
||||||
));
|
));
|
||||||
|
|
||||||
@@ -170,10 +170,10 @@ index 169f3d393..2ebb384d8 100644
|
|||||||
nrf52_components::NrfClockComponent::new().finalize(());
|
nrf52_components::NrfClockComponent::new().finalize(());
|
||||||
|
|
||||||
let platform = Platform {
|
let platform = Platform {
|
||||||
@@ -426,6 +463,7 @@ pub unsafe fn reset_handler() {
|
@@ -345,6 +382,7 @@ pub unsafe fn reset_handler() {
|
||||||
|
rng,
|
||||||
alarm,
|
alarm,
|
||||||
analog_comparator,
|
analog_comparator,
|
||||||
nonvolatile_storage,
|
|
||||||
+ nvmc,
|
+ nvmc,
|
||||||
ipc: kernel::ipc::IPC::new(board_kernel, &memory_allocation_capability),
|
ipc: kernel::ipc::IPC::new(board_kernel, &memory_allocation_capability),
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -101,11 +101,11 @@ index 000000000..69e95c3c7
|
|||||||
+ usb_driver
|
+ usb_driver
|
||||||
+ }
|
+ }
|
||||||
+}
|
+}
|
||||||
diff --git a/boards/nordic/nrf52840_dongle/src/main.rs b/boards/nordic/nrf52840_dongle/src/main.rs
|
diff --git a/boards/nordic/nrf52840_dongle_opensk/src/main.rs b/boards/nordic/nrf52840_dongle_opensk/src/main.rs
|
||||||
index d72d20482..118ea6d68 100644
|
index b485a0997..f5d29d025 100644
|
||||||
--- a/boards/nordic/nrf52840_dongle/src/main.rs
|
--- a/boards/nordic/nrf52840_dongle_opensk/src/main.rs
|
||||||
+++ b/boards/nordic/nrf52840_dongle/src/main.rs
|
+++ b/boards/nordic/nrf52840_dongle_opensk/src/main.rs
|
||||||
@@ -45,6 +45,17 @@ const PAN_ID: u16 = 0xABCD;
|
@@ -40,6 +40,17 @@ const _SPI_CLK: Pin = Pin::P1_04;
|
||||||
/// UART Writer
|
/// UART Writer
|
||||||
pub mod io;
|
pub mod io;
|
||||||
|
|
||||||
@@ -123,7 +123,7 @@ index d72d20482..118ea6d68 100644
|
|||||||
// State for loading and holding applications.
|
// State for loading and holding applications.
|
||||||
// How should the kernel respond when a process faults.
|
// How should the kernel respond when a process faults.
|
||||||
const FAULT_RESPONSE: kernel::procs::FaultResponse = kernel::procs::FaultResponse::Panic;
|
const FAULT_RESPONSE: kernel::procs::FaultResponse = kernel::procs::FaultResponse::Panic;
|
||||||
@@ -96,6 +107,11 @@ pub struct Platform {
|
@@ -84,6 +95,11 @@ pub struct Platform {
|
||||||
capsules::virtual_alarm::VirtualMuxAlarm<'static, nrf52840::rtc::Rtc<'static>>,
|
capsules::virtual_alarm::VirtualMuxAlarm<'static, nrf52840::rtc::Rtc<'static>>,
|
||||||
>,
|
>,
|
||||||
nvmc: &'static nrf52840::nvmc::SyscallDriver,
|
nvmc: &'static nrf52840::nvmc::SyscallDriver,
|
||||||
@@ -135,15 +135,15 @@ index d72d20482..118ea6d68 100644
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl kernel::Platform for Platform {
|
impl kernel::Platform for Platform {
|
||||||
@@ -115,6 +131,7 @@ impl kernel::Platform for Platform {
|
@@ -100,6 +116,7 @@ impl kernel::Platform for Platform {
|
||||||
capsules::temperature::DRIVER_NUM => f(Some(self.temp)),
|
capsules::rng::DRIVER_NUM => f(Some(self.rng)),
|
||||||
capsules::analog_comparator::DRIVER_NUM => f(Some(self.analog_comparator)),
|
capsules::analog_comparator::DRIVER_NUM => f(Some(self.analog_comparator)),
|
||||||
nrf52840::nvmc::DRIVER_NUM => f(Some(self.nvmc)),
|
nrf52840::nvmc::DRIVER_NUM => f(Some(self.nvmc)),
|
||||||
+ capsules::usb::usb_ctap::DRIVER_NUM => f(Some(self.usb)),
|
+ capsules::usb::usb_ctap::DRIVER_NUM => f(Some(self.usb)),
|
||||||
kernel::ipc::DRIVER_NUM => f(Some(&self.ipc)),
|
kernel::ipc::DRIVER_NUM => f(Some(&self.ipc)),
|
||||||
_ => f(None),
|
_ => f(None),
|
||||||
}
|
}
|
||||||
@@ -323,6 +340,21 @@ pub unsafe fn reset_handler() {
|
@@ -286,6 +303,21 @@ pub unsafe fn reset_handler() {
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -165,7 +165,7 @@ index d72d20482..118ea6d68 100644
|
|||||||
nrf52_components::NrfClockComponent::new().finalize(());
|
nrf52_components::NrfClockComponent::new().finalize(());
|
||||||
|
|
||||||
let platform = Platform {
|
let platform = Platform {
|
||||||
@@ -338,6 +370,7 @@ pub unsafe fn reset_handler() {
|
@@ -298,6 +330,7 @@ pub unsafe fn reset_handler() {
|
||||||
alarm,
|
alarm,
|
||||||
analog_comparator,
|
analog_comparator,
|
||||||
nvmc,
|
nvmc,
|
||||||
@@ -173,13 +173,13 @@ index d72d20482..118ea6d68 100644
|
|||||||
ipc: kernel::ipc::IPC::new(board_kernel, &memory_allocation_capability),
|
ipc: kernel::ipc::IPC::new(board_kernel, &memory_allocation_capability),
|
||||||
};
|
};
|
||||||
|
|
||||||
diff --git a/boards/nordic/nrf52840dk/src/main.rs b/boards/nordic/nrf52840dk/src/main.rs
|
diff --git a/boards/nordic/nrf52840dk_opensk/src/main.rs b/boards/nordic/nrf52840dk_opensk/src/main.rs
|
||||||
index 2ebb384d8..4a7bfffdd 100644
|
index ebee8704b..6a2f8715b 100644
|
||||||
--- a/boards/nordic/nrf52840dk/src/main.rs
|
--- a/boards/nordic/nrf52840dk_opensk/src/main.rs
|
||||||
+++ b/boards/nordic/nrf52840dk/src/main.rs
|
+++ b/boards/nordic/nrf52840dk_opensk/src/main.rs
|
||||||
@@ -113,6 +113,17 @@ pub mod io;
|
@@ -104,6 +104,17 @@ pub mod io;
|
||||||
// - Set to true to use Segger RTT over USB.
|
// - Set to true to use Segger RTT over USB.
|
||||||
const USB_DEBUGGING: bool = false;
|
const USB_DEBUGGING: bool = true;
|
||||||
|
|
||||||
+const VENDOR_ID: u16 = 0x1915; // Nordic Semiconductor
|
+const VENDOR_ID: u16 = 0x1915; // Nordic Semiconductor
|
||||||
+const PRODUCT_ID: u16 = 0x521f; // nRF52840 Dongle (PCA10059)
|
+const PRODUCT_ID: u16 = 0x521f; // nRF52840 Dongle (PCA10059)
|
||||||
@@ -195,9 +195,9 @@ index 2ebb384d8..4a7bfffdd 100644
|
|||||||
// State for loading and holding applications.
|
// State for loading and holding applications.
|
||||||
// How should the kernel respond when a process faults.
|
// How should the kernel respond when a process faults.
|
||||||
const FAULT_RESPONSE: kernel::procs::FaultResponse = kernel::procs::FaultResponse::Panic;
|
const FAULT_RESPONSE: kernel::procs::FaultResponse = kernel::procs::FaultResponse::Panic;
|
||||||
@@ -164,6 +175,11 @@ pub struct Platform {
|
@@ -147,6 +158,11 @@ pub struct Platform {
|
||||||
|
capsules::virtual_alarm::VirtualMuxAlarm<'static, nrf52840::rtc::Rtc<'static>>,
|
||||||
>,
|
>,
|
||||||
nonvolatile_storage: &'static capsules::nonvolatile_storage_driver::NonvolatileStorage<'static>,
|
|
||||||
nvmc: &'static nrf52840::nvmc::SyscallDriver,
|
nvmc: &'static nrf52840::nvmc::SyscallDriver,
|
||||||
+ usb: &'static capsules::usb::usb_ctap::CtapUsbSyscallDriver<
|
+ usb: &'static capsules::usb::usb_ctap::CtapUsbSyscallDriver<
|
||||||
+ 'static,
|
+ 'static,
|
||||||
@@ -207,15 +207,15 @@ index 2ebb384d8..4a7bfffdd 100644
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl kernel::Platform for Platform {
|
impl kernel::Platform for Platform {
|
||||||
@@ -184,6 +200,7 @@ impl kernel::Platform for Platform {
|
@@ -163,6 +179,7 @@ impl kernel::Platform for Platform {
|
||||||
|
capsules::rng::DRIVER_NUM => f(Some(self.rng)),
|
||||||
capsules::analog_comparator::DRIVER_NUM => f(Some(self.analog_comparator)),
|
capsules::analog_comparator::DRIVER_NUM => f(Some(self.analog_comparator)),
|
||||||
capsules::nonvolatile_storage_driver::DRIVER_NUM => f(Some(self.nonvolatile_storage)),
|
|
||||||
nrf52840::nvmc::DRIVER_NUM => f(Some(self.nvmc)),
|
nrf52840::nvmc::DRIVER_NUM => f(Some(self.nvmc)),
|
||||||
+ capsules::usb::usb_ctap::DRIVER_NUM => f(Some(self.usb)),
|
+ capsules::usb::usb_ctap::DRIVER_NUM => f(Some(self.usb)),
|
||||||
kernel::ipc::DRIVER_NUM => f(Some(&self.ipc)),
|
kernel::ipc::DRIVER_NUM => f(Some(&self.ipc)),
|
||||||
_ => f(None),
|
_ => f(None),
|
||||||
}
|
}
|
||||||
@@ -448,6 +465,21 @@ pub unsafe fn reset_handler() {
|
@@ -371,6 +388,21 @@ pub unsafe fn reset_handler() {
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -237,9 +237,9 @@ index 2ebb384d8..4a7bfffdd 100644
|
|||||||
nrf52_components::NrfClockComponent::new().finalize(());
|
nrf52_components::NrfClockComponent::new().finalize(());
|
||||||
|
|
||||||
let platform = Platform {
|
let platform = Platform {
|
||||||
@@ -464,6 +496,7 @@ pub unsafe fn reset_handler() {
|
@@ -383,6 +415,7 @@ pub unsafe fn reset_handler() {
|
||||||
|
alarm,
|
||||||
analog_comparator,
|
analog_comparator,
|
||||||
nonvolatile_storage,
|
|
||||||
nvmc,
|
nvmc,
|
||||||
+ usb,
|
+ usb,
|
||||||
ipc: kernel::ipc::IPC::new(board_kernel, &memory_allocation_capability),
|
ipc: kernel::ipc::IPC::new(board_kernel, &memory_allocation_capability),
|
||||||
|
|||||||
@@ -1,11 +1,14 @@
|
|||||||
diff --git a/Cargo.toml b/Cargo.toml
|
diff --git a/Cargo.toml b/Cargo.toml
|
||||||
index 83c4855..cfd63b1 100644
|
index 83c48558e..75b1abacc 100644
|
||||||
--- a/Cargo.toml
|
--- a/Cargo.toml
|
||||||
+++ b/Cargo.toml
|
+++ b/Cargo.toml
|
||||||
@@ -13,6 +13,8 @@ members = [
|
@@ -12,7 +12,11 @@ members = [
|
||||||
|
"boards/imix",
|
||||||
"boards/msp_exp432p401r",
|
"boards/msp_exp432p401r",
|
||||||
"boards/nordic/nrf52840dk",
|
"boards/nordic/nrf52840dk",
|
||||||
|
+ "boards/nordic/nrf52840dk_opensk",
|
||||||
"boards/nordic/nrf52840_dongle",
|
"boards/nordic/nrf52840_dongle",
|
||||||
|
+ "boards/nordic/nrf52840_dongle_opensk",
|
||||||
+ "boards/nordic/nrf52840_dongle_dfu",
|
+ "boards/nordic/nrf52840_dongle_dfu",
|
||||||
+ "boards/nordic/nrf52840_mdk_dfu",
|
+ "boards/nordic/nrf52840_mdk_dfu",
|
||||||
"boards/nordic/nrf52dk",
|
"boards/nordic/nrf52dk",
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
diff --git a/boards/nordic/nrf52840dk/src/main.rs b/boards/nordic/nrf52840dk/src/main.rs
|
|
||||||
index 303a451..18fd331 100644
|
|
||||||
--- a/boards/nordic/nrf52840dk/src/main.rs
|
|
||||||
+++ b/boards/nordic/nrf52840dk/src/main.rs
|
|
||||||
@@ -112,7 +112,7 @@ pub mod io;
|
|
||||||
// Whether to use UART debugging or Segger RTT (USB) debugging.
|
|
||||||
// - Set to false to use UART.
|
|
||||||
// - Set to true to use Segger RTT over USB.
|
|
||||||
-const USB_DEBUGGING: bool = false;
|
|
||||||
+const USB_DEBUGGING: bool = true;
|
|
||||||
|
|
||||||
const VENDOR_ID: u16 = 0x1915; // Nordic Semiconductor
|
|
||||||
const PRODUCT_ID: u16 = 0x521f; // nRF52840 Dongle (PCA10059)
|
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
diff --git a/chips/nrf52/src/uicr.rs b/chips/nrf52/src/uicr.rs
|
diff --git a/chips/nrf52/src/uicr.rs b/chips/nrf52/src/uicr.rs
|
||||||
index 6bb6c86..3bb8b5a 100644
|
index 6bb6c86b7..3bb8b5a7d 100644
|
||||||
--- a/chips/nrf52/src/uicr.rs
|
--- a/chips/nrf52/src/uicr.rs
|
||||||
+++ b/chips/nrf52/src/uicr.rs
|
+++ b/chips/nrf52/src/uicr.rs
|
||||||
@@ -1,38 +1,45 @@
|
@@ -1,38 +1,45 @@
|
||||||
@@ -97,4 +97,3 @@ index 6bb6c86..3bb8b5a 100644
|
|||||||
/// Setting of pins dedicated to NFC functionality: NFC antenna or GPIO
|
/// Setting of pins dedicated to NFC functionality: NFC antenna or GPIO
|
||||||
NfcPins [
|
NfcPins [
|
||||||
/// Setting pins dedicated to NFC functionality
|
/// Setting pins dedicated to NFC functionality
|
||||||
|
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
diff --git a/boards/components/src/firmware_protection.rs b/boards/components/src/firmware_protection.rs
|
diff --git a/boards/components/src/firmware_protection.rs b/boards/components/src/firmware_protection.rs
|
||||||
new file mode 100644
|
new file mode 100644
|
||||||
index 0000000..58695af
|
index 000000000..58695af81
|
||||||
--- /dev/null
|
--- /dev/null
|
||||||
+++ b/boards/components/src/firmware_protection.rs
|
+++ b/boards/components/src/firmware_protection.rs
|
||||||
@@ -0,0 +1,70 @@
|
@@ -0,0 +1,70 @@
|
||||||
@@ -75,7 +75,7 @@ index 0000000..58695af
|
|||||||
+ }
|
+ }
|
||||||
+}
|
+}
|
||||||
diff --git a/boards/components/src/lib.rs b/boards/components/src/lib.rs
|
diff --git a/boards/components/src/lib.rs b/boards/components/src/lib.rs
|
||||||
index 917497a..520408f 100644
|
index 917497af4..520408fcb 100644
|
||||||
--- a/boards/components/src/lib.rs
|
--- a/boards/components/src/lib.rs
|
||||||
+++ b/boards/components/src/lib.rs
|
+++ b/boards/components/src/lib.rs
|
||||||
@@ -9,6 +9,7 @@ pub mod console;
|
@@ -9,6 +9,7 @@ pub mod console;
|
||||||
@@ -86,11 +86,11 @@ index 917497a..520408f 100644
|
|||||||
pub mod ft6x06;
|
pub mod ft6x06;
|
||||||
pub mod gpio;
|
pub mod gpio;
|
||||||
pub mod hd44780;
|
pub mod hd44780;
|
||||||
diff --git a/boards/nordic/nrf52840_dongle/src/main.rs b/boards/nordic/nrf52840_dongle/src/main.rs
|
diff --git a/boards/nordic/nrf52840_dongle_opensk/src/main.rs b/boards/nordic/nrf52840_dongle_opensk/src/main.rs
|
||||||
index 118ea6d..76436f3 100644
|
index f5d29d025..051943867 100644
|
||||||
--- a/boards/nordic/nrf52840_dongle/src/main.rs
|
--- a/boards/nordic/nrf52840_dongle_opensk/src/main.rs
|
||||||
+++ b/boards/nordic/nrf52840_dongle/src/main.rs
|
+++ b/boards/nordic/nrf52840_dongle_opensk/src/main.rs
|
||||||
@@ -112,6 +112,7 @@ pub struct Platform {
|
@@ -100,6 +100,7 @@ pub struct Platform {
|
||||||
'static,
|
'static,
|
||||||
nrf52840::usbd::Usbd<'static>,
|
nrf52840::usbd::Usbd<'static>,
|
||||||
>,
|
>,
|
||||||
@@ -98,7 +98,7 @@ index 118ea6d..76436f3 100644
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl kernel::Platform for Platform {
|
impl kernel::Platform for Platform {
|
||||||
@@ -132,6 +133,7 @@ impl kernel::Platform for Platform {
|
@@ -117,6 +118,7 @@ impl kernel::Platform for Platform {
|
||||||
capsules::analog_comparator::DRIVER_NUM => f(Some(self.analog_comparator)),
|
capsules::analog_comparator::DRIVER_NUM => f(Some(self.analog_comparator)),
|
||||||
nrf52840::nvmc::DRIVER_NUM => f(Some(self.nvmc)),
|
nrf52840::nvmc::DRIVER_NUM => f(Some(self.nvmc)),
|
||||||
capsules::usb::usb_ctap::DRIVER_NUM => f(Some(self.usb)),
|
capsules::usb::usb_ctap::DRIVER_NUM => f(Some(self.usb)),
|
||||||
@@ -106,7 +106,7 @@ index 118ea6d..76436f3 100644
|
|||||||
kernel::ipc::DRIVER_NUM => f(Some(&self.ipc)),
|
kernel::ipc::DRIVER_NUM => f(Some(&self.ipc)),
|
||||||
_ => f(None),
|
_ => f(None),
|
||||||
}
|
}
|
||||||
@@ -355,6 +357,14 @@ pub unsafe fn reset_handler() {
|
@@ -318,6 +320,14 @@ pub unsafe fn reset_handler() {
|
||||||
)
|
)
|
||||||
.finalize(components::usb_ctap_component_buf!(nrf52840::usbd::Usbd));
|
.finalize(components::usb_ctap_component_buf!(nrf52840::usbd::Usbd));
|
||||||
|
|
||||||
@@ -121,7 +121,7 @@ index 118ea6d..76436f3 100644
|
|||||||
nrf52_components::NrfClockComponent::new().finalize(());
|
nrf52_components::NrfClockComponent::new().finalize(());
|
||||||
|
|
||||||
let platform = Platform {
|
let platform = Platform {
|
||||||
@@ -371,6 +381,7 @@ pub unsafe fn reset_handler() {
|
@@ -331,6 +341,7 @@ pub unsafe fn reset_handler() {
|
||||||
analog_comparator,
|
analog_comparator,
|
||||||
nvmc,
|
nvmc,
|
||||||
usb,
|
usb,
|
||||||
@@ -129,11 +129,11 @@ index 118ea6d..76436f3 100644
|
|||||||
ipc: kernel::ipc::IPC::new(board_kernel, &memory_allocation_capability),
|
ipc: kernel::ipc::IPC::new(board_kernel, &memory_allocation_capability),
|
||||||
};
|
};
|
||||||
|
|
||||||
diff --git a/boards/nordic/nrf52840dk/src/main.rs b/boards/nordic/nrf52840dk/src/main.rs
|
diff --git a/boards/nordic/nrf52840dk_opensk/src/main.rs b/boards/nordic/nrf52840dk_opensk/src/main.rs
|
||||||
index b1d0d3c..3cfb38d 100644
|
index 6a2f8715b..7898562dd 100644
|
||||||
--- a/boards/nordic/nrf52840dk/src/main.rs
|
--- a/boards/nordic/nrf52840dk_opensk/src/main.rs
|
||||||
+++ b/boards/nordic/nrf52840dk/src/main.rs
|
+++ b/boards/nordic/nrf52840dk_opensk/src/main.rs
|
||||||
@@ -180,6 +180,7 @@ pub struct Platform {
|
@@ -163,6 +163,7 @@ pub struct Platform {
|
||||||
'static,
|
'static,
|
||||||
nrf52840::usbd::Usbd<'static>,
|
nrf52840::usbd::Usbd<'static>,
|
||||||
>,
|
>,
|
||||||
@@ -141,15 +141,15 @@ index b1d0d3c..3cfb38d 100644
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl kernel::Platform for Platform {
|
impl kernel::Platform for Platform {
|
||||||
@@ -201,6 +202,7 @@ impl kernel::Platform for Platform {
|
@@ -180,6 +181,7 @@ impl kernel::Platform for Platform {
|
||||||
capsules::nonvolatile_storage_driver::DRIVER_NUM => f(Some(self.nonvolatile_storage)),
|
capsules::analog_comparator::DRIVER_NUM => f(Some(self.analog_comparator)),
|
||||||
nrf52840::nvmc::DRIVER_NUM => f(Some(self.nvmc)),
|
nrf52840::nvmc::DRIVER_NUM => f(Some(self.nvmc)),
|
||||||
capsules::usb::usb_ctap::DRIVER_NUM => f(Some(self.usb)),
|
capsules::usb::usb_ctap::DRIVER_NUM => f(Some(self.usb)),
|
||||||
+ capsules::firmware_protection::DRIVER_NUM => f(Some(self.crp)),
|
+ capsules::firmware_protection::DRIVER_NUM => f(Some(self.crp)),
|
||||||
kernel::ipc::DRIVER_NUM => f(Some(&self.ipc)),
|
kernel::ipc::DRIVER_NUM => f(Some(&self.ipc)),
|
||||||
_ => f(None),
|
_ => f(None),
|
||||||
}
|
}
|
||||||
@@ -480,6 +482,14 @@ pub unsafe fn reset_handler() {
|
@@ -403,6 +405,14 @@ pub unsafe fn reset_handler() {
|
||||||
)
|
)
|
||||||
.finalize(components::usb_ctap_component_buf!(nrf52840::usbd::Usbd));
|
.finalize(components::usb_ctap_component_buf!(nrf52840::usbd::Usbd));
|
||||||
|
|
||||||
@@ -164,8 +164,8 @@ index b1d0d3c..3cfb38d 100644
|
|||||||
nrf52_components::NrfClockComponent::new().finalize(());
|
nrf52_components::NrfClockComponent::new().finalize(());
|
||||||
|
|
||||||
let platform = Platform {
|
let platform = Platform {
|
||||||
@@ -497,6 +507,7 @@ pub unsafe fn reset_handler() {
|
@@ -416,6 +426,7 @@ pub unsafe fn reset_handler() {
|
||||||
nonvolatile_storage,
|
analog_comparator,
|
||||||
nvmc,
|
nvmc,
|
||||||
usb,
|
usb,
|
||||||
+ crp,
|
+ crp,
|
||||||
@@ -173,7 +173,7 @@ index b1d0d3c..3cfb38d 100644
|
|||||||
};
|
};
|
||||||
|
|
||||||
diff --git a/capsules/src/driver.rs b/capsules/src/driver.rs
|
diff --git a/capsules/src/driver.rs b/capsules/src/driver.rs
|
||||||
index ae458b3..f536dad 100644
|
index ae458b309..f536dad32 100644
|
||||||
--- a/capsules/src/driver.rs
|
--- a/capsules/src/driver.rs
|
||||||
+++ b/capsules/src/driver.rs
|
+++ b/capsules/src/driver.rs
|
||||||
@@ -16,6 +16,7 @@ pub enum NUM {
|
@@ -16,6 +16,7 @@ pub enum NUM {
|
||||||
@@ -186,7 +186,7 @@ index ae458b3..f536dad 100644
|
|||||||
Ipc = 0x10000,
|
Ipc = 0x10000,
|
||||||
diff --git a/capsules/src/firmware_protection.rs b/capsules/src/firmware_protection.rs
|
diff --git a/capsules/src/firmware_protection.rs b/capsules/src/firmware_protection.rs
|
||||||
new file mode 100644
|
new file mode 100644
|
||||||
index 0000000..8cf63d6
|
index 000000000..8cf63d6a4
|
||||||
--- /dev/null
|
--- /dev/null
|
||||||
+++ b/capsules/src/firmware_protection.rs
|
+++ b/capsules/src/firmware_protection.rs
|
||||||
@@ -0,0 +1,85 @@
|
@@ -0,0 +1,85 @@
|
||||||
@@ -276,7 +276,7 @@ index 0000000..8cf63d6
|
|||||||
+ }
|
+ }
|
||||||
+}
|
+}
|
||||||
diff --git a/capsules/src/lib.rs b/capsules/src/lib.rs
|
diff --git a/capsules/src/lib.rs b/capsules/src/lib.rs
|
||||||
index e4423fe..7538aad 100644
|
index e4423fe05..7538aad18 100644
|
||||||
--- a/capsules/src/lib.rs
|
--- a/capsules/src/lib.rs
|
||||||
+++ b/capsules/src/lib.rs
|
+++ b/capsules/src/lib.rs
|
||||||
@@ -22,6 +22,7 @@ pub mod crc;
|
@@ -22,6 +22,7 @@ pub mod crc;
|
||||||
@@ -288,7 +288,7 @@ index e4423fe..7538aad 100644
|
|||||||
pub mod ft6x06;
|
pub mod ft6x06;
|
||||||
pub mod fxos8700cq;
|
pub mod fxos8700cq;
|
||||||
diff --git a/chips/nrf52/src/uicr.rs b/chips/nrf52/src/uicr.rs
|
diff --git a/chips/nrf52/src/uicr.rs b/chips/nrf52/src/uicr.rs
|
||||||
index 3bb8b5a..ea96cb2 100644
|
index 3bb8b5a7d..ea96cb2ae 100644
|
||||||
--- a/chips/nrf52/src/uicr.rs
|
--- a/chips/nrf52/src/uicr.rs
|
||||||
+++ b/chips/nrf52/src/uicr.rs
|
+++ b/chips/nrf52/src/uicr.rs
|
||||||
@@ -1,13 +1,14 @@
|
@@ -1,13 +1,14 @@
|
||||||
@@ -359,7 +359,7 @@ index 3bb8b5a..ea96cb2 100644
|
|||||||
+}
|
+}
|
||||||
diff --git a/kernel/src/hil/firmware_protection.rs b/kernel/src/hil/firmware_protection.rs
|
diff --git a/kernel/src/hil/firmware_protection.rs b/kernel/src/hil/firmware_protection.rs
|
||||||
new file mode 100644
|
new file mode 100644
|
||||||
index 0000000..de08246
|
index 000000000..de0824646
|
||||||
--- /dev/null
|
--- /dev/null
|
||||||
+++ b/kernel/src/hil/firmware_protection.rs
|
+++ b/kernel/src/hil/firmware_protection.rs
|
||||||
@@ -0,0 +1,48 @@
|
@@ -0,0 +1,48 @@
|
||||||
@@ -412,7 +412,7 @@ index 0000000..de08246
|
|||||||
+ fn set_protection(&self, level: ProtectionLevel) -> ReturnCode;
|
+ fn set_protection(&self, level: ProtectionLevel) -> ReturnCode;
|
||||||
+}
|
+}
|
||||||
diff --git a/kernel/src/hil/mod.rs b/kernel/src/hil/mod.rs
|
diff --git a/kernel/src/hil/mod.rs b/kernel/src/hil/mod.rs
|
||||||
index 4f42afa..83e7702 100644
|
index 4f42afa02..83e7702ab 100644
|
||||||
--- a/kernel/src/hil/mod.rs
|
--- a/kernel/src/hil/mod.rs
|
||||||
+++ b/kernel/src/hil/mod.rs
|
+++ b/kernel/src/hil/mod.rs
|
||||||
@@ -8,6 +8,7 @@ pub mod dac;
|
@@ -8,6 +8,7 @@ pub mod dac;
|
||||||
@@ -423,4 +423,3 @@ index 4f42afa..83e7702 100644
|
|||||||
pub mod flash;
|
pub mod flash;
|
||||||
pub mod gpio;
|
pub mod gpio;
|
||||||
pub mod gpio_async;
|
pub mod gpio_async;
|
||||||
|
|
||||||
@@ -27,7 +27,7 @@ echo "Building sha256sum tool..."
|
|||||||
cargo build --manifest-path third_party/tock/tools/sha256sum/Cargo.toml
|
cargo build --manifest-path third_party/tock/tools/sha256sum/Cargo.toml
|
||||||
|
|
||||||
echo "Computing SHA-256 sums of the boards..."
|
echo "Computing SHA-256 sums of the boards..."
|
||||||
for board in nrf52840dk nrf52840_dongle nrf52840_dongle_dfu nrf52840_mdk_dfu
|
for board in nrf52840dk_opensk nrf52840_dongle_opensk nrf52840_dongle_dfu nrf52840_mdk_dfu
|
||||||
do
|
do
|
||||||
BOARD=$board ./reproduce_board.sh
|
BOARD=$board ./reproduce_board.sh
|
||||||
done
|
done
|
||||||
|
|||||||
@@ -69,16 +69,16 @@ cargo build --release --target=thumbv7em-none-eabi --features with_ctap1
|
|||||||
./third_party/tock/tools/sha256sum/target/debug/sha256sum target/thumbv7em-none-eabi/release/ctap2
|
./third_party/tock/tools/sha256sum/target/debug/sha256sum target/thumbv7em-none-eabi/release/ctap2
|
||||||
|
|
||||||
echo "Checking that supported boards build properly..."
|
echo "Checking that supported boards build properly..."
|
||||||
make -C third_party/tock/boards/nordic/nrf52840dk
|
make -C third_party/tock/boards/nordic/nrf52840dk_opensk
|
||||||
make -C third_party/tock/boards/nordic/nrf52840_dongle
|
make -C third_party/tock/boards/nordic/nrf52840_dongle_opensk
|
||||||
|
|
||||||
echo "Checking that other boards build properly..."
|
echo "Checking that other boards build properly..."
|
||||||
make -C third_party/tock/boards/nordic/nrf52840_dongle_dfu
|
make -C third_party/tock/boards/nordic/nrf52840_dongle_dfu
|
||||||
make -C third_party/tock/boards/nordic/nrf52840_mdk_dfu
|
make -C third_party/tock/boards/nordic/nrf52840_mdk_dfu
|
||||||
|
|
||||||
echo "Checking deployment of supported boards..."
|
echo "Checking deployment of supported boards..."
|
||||||
./deploy.py --board=nrf52840dk --no-app --programmer=none
|
./deploy.py --board=nrf52840dk_opensk --no-app --programmer=none
|
||||||
./deploy.py --board=nrf52840_dongle --no-app --programmer=none
|
./deploy.py --board=nrf52840_dongle_opensk --no-app --programmer=none
|
||||||
|
|
||||||
echo "Checking deployment of other boards..."
|
echo "Checking deployment of other boards..."
|
||||||
./deploy.py --board=nrf52840_dongle_dfu --no-app --programmer=none
|
./deploy.py --board=nrf52840_dongle_dfu --no-app --programmer=none
|
||||||
|
|||||||
Reference in New Issue
Block a user