Skip to content

Commit

Permalink
Merge branch 'master' into process-binary
Browse files Browse the repository at this point in the history
  • Loading branch information
alevy committed Mar 15, 2024
2 parents eca99b4 + 3f0fae9 commit 9b24761
Show file tree
Hide file tree
Showing 59 changed files with 1,831 additions and 364 deletions.
2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ members = [
"boards/qemu_rv32_virt",
"boards/swervolf",
"boards/weact_f401ccu6/",
"boards/configurations/nrf52840dk/nrf52840dk-test-appid-sha256",
"boards/configurations/nrf52840dk/nrf52840dk-test-kernel",
"capsules/aes_gcm",
"capsules/core",
"capsules/extra",
Expand Down
12 changes: 1 addition & 11 deletions arch/riscv/src/csr/mtvec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// SPDX-License-Identifier: Apache-2.0 OR MIT
// Copyright Tock Contributors 2022.

use kernel::utilities::registers::{register_bitfields, LocalRegisterCopy};
use kernel::utilities::registers::register_bitfields;

// mtvec contains the address(es) of the trap handler
register_bitfields![usize,
Expand All @@ -14,13 +14,3 @@ register_bitfields![usize,
]
]
];

trait MtvecHelpers {
fn get_trap_address(&self) -> usize;
}

impl MtvecHelpers for LocalRegisterCopy<usize, mtvec::Register> {
fn get_trap_address(&self) -> usize {
self.read(mtvec::trap_addr) << 2
}
}
12 changes: 1 addition & 11 deletions arch/riscv/src/csr/stvec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// SPDX-License-Identifier: Apache-2.0 OR MIT
// Copyright Tock Contributors 2022.

use kernel::utilities::registers::{register_bitfields, LocalRegisterCopy};
use kernel::utilities::registers::register_bitfields;

// stvec contains the address(es) of the trap handler
register_bitfields![usize,
Expand All @@ -14,13 +14,3 @@ register_bitfields![usize,
]
]
];

trait StvecHelpers {
fn get_trap_address(&self) -> usize;
}

impl StvecHelpers for LocalRegisterCopy<usize, stvec::Register> {
fn get_trap_address(&self) -> usize {
self.read(stvec::trap_addr) << 2
}
}
12 changes: 1 addition & 11 deletions arch/riscv/src/csr/utvec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// SPDX-License-Identifier: Apache-2.0 OR MIT
// Copyright Tock Contributors 2022.

use kernel::utilities::registers::{register_bitfields, LocalRegisterCopy};
use kernel::utilities::registers::register_bitfields;

// utvec contains the address(es) of the trap handler
register_bitfields![usize,
Expand All @@ -14,13 +14,3 @@ register_bitfields![usize,
]
]
];

trait UtvecHelpers {
fn get_trap_address(&self) -> usize;
}

impl UtvecHelpers for LocalRegisterCopy<usize, utvec::Register> {
fn get_trap_address(&self) -> usize {
self.read(utvec::trap_addr) << 2
}
}
2 changes: 2 additions & 0 deletions boards/components/src/nonvolatile_storage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ macro_rules! nonvolatile_storage_component_static {
};};
}

pub type NonvolatileStorageComponentType = NonvolatileStorage<'static>;

pub struct NonvolatileStorageComponent<
F: 'static + hil::flash::Flash + hil::flash::HasClient<'static, NonvolatileToPages<'static, F>>,
> {
Expand Down
36 changes: 36 additions & 0 deletions boards/configurations/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
Configuration Boards
====================

This folder contains Tock kernel configurations for boards designed for very
specific purposes. These are not expected to be general purpose boards (the root
boards/ directory stores those), but instead these boards are configured to
expose specific functionality, likely for testing.

Many functions in Tock are configurable, and each board is free to select the
preferred configuration based on hardware features or intended use cases. This
often means, however, that there are many kernel configurations that _no_ boards
use, making it difficult to test those configurations.

For example, checking process credentials can use different credential policies.
A configuration board can be configured with a specific credential checker, even
if no root-level board wants to use that configuration.

Directory Structure and Naming
------------------------------

Boards in this `boards/configurations` directory should be organized by the root
board type. The name must be `<board>-test-[configuration]`. For example:

```
boards/configurations/
nrf52840dk/
nrf52840k-test-[configuration1]
nrf52840k-test-[configuration2]
imix/
imix-test-[configuration1]
imix-test-[configuration2]
```

Each specific board configuration for each root board should have a descriptive
name. For example, if a configuration of the nrf52840dk is designed for running
kernel tests, the board might be called `nrf52840dk/nrf52840dk-test-kernel`.
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Licensed under the Apache License, Version 2.0 or the MIT License.
# SPDX-License-Identifier: Apache-2.0 OR MIT
# Copyright Tock Contributors 2024.

[package]
name = "nrf52840dk-test-appid-sha256"
version.workspace = true
authors.workspace = true
build = "../../../build.rs"
edition.workspace = true

[dependencies]
components = { path = "../../../components" }
cortexm4 = { path = "../../../../arch/cortex-m4" }
kernel = { path = "../../../../kernel" }
nrf52840 = { path = "../../../../chips/nrf52840" }
nrf52_components = { path = "../../../nordic/nrf52_components" }

capsules-core = { path = "../../../../capsules/core" }
capsules-extra = { path = "../../../../capsules/extra" }
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Licensed under the Apache License, Version 2.0 or the MIT License.
# SPDX-License-Identifier: Apache-2.0 OR MIT
# Copyright Tock Contributors 2024.

TARGET=thumbv7em-none-eabi
PLATFORM=nrf52840dk-test-appid-sha256

include ../../../Makefile.common
include ../nrf52840dk.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
nRF52840-DK SHA256 AppID Test Board
===================================

This is a minimal kernel for testing with SHA256 credential checking.
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/* Licensed under the Apache License, Version 2.0 or the MIT License. */
/* SPDX-License-Identifier: Apache-2.0 OR MIT */
/* Copyright Tock Contributors 2023. */

INCLUDE ../../../nordic/nrf52840_chip_layout.ld
INCLUDE ../../../kernel_layout.ld
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// Licensed under the Apache License, Version 2.0 or the MIT License.
// SPDX-License-Identifier: Apache-2.0 OR MIT
// Copyright Tock Contributors 2024.

use core::panic::PanicInfo;
use nrf52840::gpio::Pin;

#[cfg(not(test))]
#[no_mangle]
#[panic_handler]
/// Panic handler
pub unsafe fn panic_fmt(_pi: &PanicInfo) -> ! {
// The nRF52840DK LEDs (see back of board)
let led_kernel_pin = &nrf52840::gpio::GPIOPin::new(Pin::P0_13);
let led = &mut kernel::hil::led::LedLow::new(led_kernel_pin);
kernel::debug::panic_blink_forever(&mut [led])
}
Loading

0 comments on commit 9b24761

Please sign in to comment.