New boards with layouts for dual partition setups (#387)
* upgradable boards * updates the install manual for proper SSL config * storage locations from build script * deploy script improvements * UTC time
This commit is contained in:
@@ -1,4 +1,29 @@
|
||||
use std::env;
|
||||
use std::fs;
|
||||
use std::path::Path;
|
||||
|
||||
fn main() {
|
||||
println!("cargo:rerun-if-changed=layout.ld");
|
||||
println!("cargo:rerun-if-changed=../../kernel_layout.ld");
|
||||
|
||||
let out_dir = env::var_os("OUT_DIR").unwrap();
|
||||
let dest_path = Path::new(&out_dir).join("locations.rs");
|
||||
fs::write(
|
||||
&dest_path,
|
||||
"
|
||||
static mut STORAGE_LOCATIONS: [kernel::StorageLocation; 2] = [
|
||||
// We implement NUM_PAGES = 20 as 16 + 4 to satisfy the MPU.
|
||||
kernel::StorageLocation {
|
||||
address: 0xC0000,
|
||||
size: 0x10000, // 16 pages
|
||||
storage_type: kernel::StorageType::STORE,
|
||||
},
|
||||
kernel::StorageLocation {
|
||||
address: 0xD0000,
|
||||
size: 0x4000, // 4 pages
|
||||
storage_type: kernel::StorageType::STORE,
|
||||
},
|
||||
];
|
||||
"
|
||||
).unwrap();
|
||||
}
|
||||
|
||||
@@ -67,6 +67,7 @@
|
||||
#![feature(const_in_array_repeat_expressions)]
|
||||
#![deny(missing_docs)]
|
||||
|
||||
use core::env;
|
||||
use kernel::common::dynamic_deferred_call::{DynamicDeferredCall, DynamicDeferredCallClientState};
|
||||
use kernel::component::Component;
|
||||
use kernel::hil::led::LedLow;
|
||||
@@ -128,19 +129,7 @@ const NUM_PROCS: usize = 8;
|
||||
static mut PROCESSES: [Option<&'static dyn kernel::procs::ProcessType>; NUM_PROCS] =
|
||||
[None; NUM_PROCS];
|
||||
|
||||
static mut STORAGE_LOCATIONS: [kernel::StorageLocation; 2] = [
|
||||
// We implement NUM_PAGES = 20 as 16 + 4 to satisfy the MPU.
|
||||
kernel::StorageLocation {
|
||||
address: 0xC0000,
|
||||
size: 0x10000, // 16 pages
|
||||
storage_type: kernel::StorageType::STORE,
|
||||
},
|
||||
kernel::StorageLocation {
|
||||
address: 0xD0000,
|
||||
size: 0x4000, // 4 pages
|
||||
storage_type: kernel::StorageType::STORE,
|
||||
},
|
||||
];
|
||||
include!(concat!(env!("OUT_DIR"), "/locations.rs"));
|
||||
|
||||
static mut CHIP: Option<&'static nrf52840::chip::NRF52<Nrf52840DefaultPeripherals>> = None;
|
||||
|
||||
|
||||
18
boards/nordic/nrf52840dk_opensk_a/Cargo.toml
Normal file
18
boards/nordic/nrf52840dk_opensk_a/Cargo.toml
Normal file
@@ -0,0 +1,18 @@
|
||||
[package]
|
||||
name = "nrf52840dk_opensk_a"
|
||||
version = "0.1.0"
|
||||
authors = ["Tock Project Developers <tock-dev@googlegroups.com>"]
|
||||
build = "build.rs"
|
||||
edition = "2018"
|
||||
|
||||
[[bin]]
|
||||
path = "../nrf52840dk_opensk/src/main.rs"
|
||||
name = "nrf52840dk_opensk_a"
|
||||
|
||||
[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_a/Makefile
Normal file
31
boards/nordic/nrf52840dk_opensk_a/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_a
|
||||
|
||||
include ../../Makefile.common
|
||||
|
||||
TOCKLOADER=tockloader
|
||||
|
||||
# Where in the SAM4L flash to load the kernel with `tockloader`
|
||||
KERNEL_ADDRESS=0x20000
|
||||
|
||||
# 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)
|
||||
11
boards/nordic/nrf52840dk_opensk_a/README.md
Normal file
11
boards/nordic/nrf52840dk_opensk_a/README.md
Normal file
@@ -0,0 +1,11 @@
|
||||
Platform-Specific Instructions: nRF52840-DK, partition A
|
||||
===================================
|
||||
|
||||
This is an upgrade partition for the adapted nrf52840dk in `../nrf52840dk_opensk`.
|
||||
|
||||
Compared to our regular board definition for the nrf52840dk, changes are:
|
||||
- a `layout.ld` with 128 kB for kernel and app
|
||||
- the matching kernel address in the `Makefile`
|
||||
- different `StorageLocation`s in `build.rs`
|
||||
|
||||
For everything else, please check the README in `../nrf52840dk_opensk`.
|
||||
45
boards/nordic/nrf52840dk_opensk_a/build.rs
Normal file
45
boards/nordic/nrf52840dk_opensk_a/build.rs
Normal file
@@ -0,0 +1,45 @@
|
||||
use std::env;
|
||||
use std::fs;
|
||||
use std::path::Path;
|
||||
|
||||
fn main() {
|
||||
println!("cargo:rerun-if-changed=layout.ld");
|
||||
println!("cargo:rerun-if-changed=../../kernel_layout.ld");
|
||||
|
||||
let out_dir = env::var_os("OUT_DIR").unwrap();
|
||||
let dest_path = Path::new(&out_dir).join("locations.rs");
|
||||
fs::write(
|
||||
&dest_path,
|
||||
"
|
||||
static mut STORAGE_LOCATIONS: [kernel::StorageLocation; 5] = [
|
||||
// We implement NUM_PAGES = 20 as 16 + 4 to satisfy the MPU.
|
||||
kernel::StorageLocation {
|
||||
address: 0xC0000,
|
||||
size: 0x10000, // 16 pages
|
||||
storage_type: kernel::StorageType::STORE,
|
||||
},
|
||||
kernel::StorageLocation {
|
||||
address: 0xD0000,
|
||||
size: 0x4000, // 4 pages
|
||||
storage_type: kernel::StorageType::STORE,
|
||||
},
|
||||
// Partitions can also be split to maximize MPU happiness.
|
||||
kernel::StorageLocation {
|
||||
address: 0x60000,
|
||||
size: 0x20000,
|
||||
storage_type: kernel::StorageType::PARTITION,
|
||||
},
|
||||
kernel::StorageLocation {
|
||||
address: 0x80000,
|
||||
size: 0x20000,
|
||||
storage_type: kernel::StorageType::PARTITION,
|
||||
},
|
||||
kernel::StorageLocation {
|
||||
address: 0x5000,
|
||||
size: 0x1000,
|
||||
storage_type: kernel::StorageType::METADATA,
|
||||
},
|
||||
];
|
||||
"
|
||||
).unwrap();
|
||||
}
|
||||
13
boards/nordic/nrf52840dk_opensk_a/layout.ld
Normal file
13
boards/nordic/nrf52840dk_opensk_a/layout.ld
Normal file
@@ -0,0 +1,13 @@
|
||||
/* Memory Space Definitions, 1M flash, 256K ram */
|
||||
MEMORY
|
||||
{
|
||||
rom (rx) : ORIGIN = 0x00020000, LENGTH = 128K
|
||||
prog (rx) : ORIGIN = 0x00040000, LENGTH = 128K
|
||||
ram (rwx) : ORIGIN = 0x20000000, LENGTH = 256K
|
||||
}
|
||||
|
||||
MPU_MIN_ALIGN = 8K;
|
||||
PAGE_SIZE = 4K;
|
||||
|
||||
INCLUDE ../../kernel_layout.ld
|
||||
|
||||
18
boards/nordic/nrf52840dk_opensk_b/Cargo.toml
Normal file
18
boards/nordic/nrf52840dk_opensk_b/Cargo.toml
Normal file
@@ -0,0 +1,18 @@
|
||||
[package]
|
||||
name = "nrf52840dk_opensk_b"
|
||||
version = "0.1.0"
|
||||
authors = ["Tock Project Developers <tock-dev@googlegroups.com>"]
|
||||
build = "build.rs"
|
||||
edition = "2018"
|
||||
|
||||
[[bin]]
|
||||
path = "../nrf52840dk_opensk/src/main.rs"
|
||||
name = "nrf52840dk_opensk_b"
|
||||
|
||||
[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_b/Makefile
Normal file
31
boards/nordic/nrf52840dk_opensk_b/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_b
|
||||
|
||||
include ../../Makefile.common
|
||||
|
||||
TOCKLOADER=tockloader
|
||||
|
||||
# Where in the SAM4L flash to load the kernel with `tockloader`
|
||||
KERNEL_ADDRESS=0x60000
|
||||
|
||||
# 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)
|
||||
11
boards/nordic/nrf52840dk_opensk_b/README.md
Normal file
11
boards/nordic/nrf52840dk_opensk_b/README.md
Normal file
@@ -0,0 +1,11 @@
|
||||
Platform-Specific Instructions: nRF52840-DK, partition B
|
||||
===================================
|
||||
|
||||
This is an upgrade partition for the adapted nrf52840dk in `../nrf52840dk_opensk`.
|
||||
|
||||
Compared to our regular board definition for the nrf52840dk, changes are:
|
||||
- a `layout.ld` with 128 kB for kernel and app
|
||||
- the matching kernel address in the `Makefile`
|
||||
- different `StorageLocation`s in `build.rs`
|
||||
|
||||
For everything else, please check the README in `../nrf52840dk_opensk`.
|
||||
45
boards/nordic/nrf52840dk_opensk_b/build.rs
Normal file
45
boards/nordic/nrf52840dk_opensk_b/build.rs
Normal file
@@ -0,0 +1,45 @@
|
||||
use std::env;
|
||||
use std::fs;
|
||||
use std::path::Path;
|
||||
|
||||
fn main() {
|
||||
println!("cargo:rerun-if-changed=layout.ld");
|
||||
println!("cargo:rerun-if-changed=../../kernel_layout.ld");
|
||||
|
||||
let out_dir = env::var_os("OUT_DIR").unwrap();
|
||||
let dest_path = Path::new(&out_dir).join("locations.rs");
|
||||
fs::write(
|
||||
&dest_path,
|
||||
"
|
||||
static mut STORAGE_LOCATIONS: [kernel::StorageLocation; 5] = [
|
||||
// We implement NUM_PAGES = 20 as 16 + 4 to satisfy the MPU.
|
||||
kernel::StorageLocation {
|
||||
address: 0xC0000,
|
||||
size: 0x10000, // 16 pages
|
||||
storage_type: kernel::StorageType::STORE,
|
||||
},
|
||||
kernel::StorageLocation {
|
||||
address: 0xD0000,
|
||||
size: 0x4000, // 4 pages
|
||||
storage_type: kernel::StorageType::STORE,
|
||||
},
|
||||
// Partitions can also be split to maximize MPU happiness.
|
||||
kernel::StorageLocation {
|
||||
address: 0x20000,
|
||||
size: 0x20000,
|
||||
storage_type: kernel::StorageType::PARTITION,
|
||||
},
|
||||
kernel::StorageLocation {
|
||||
address: 0x40000,
|
||||
size: 0x20000,
|
||||
storage_type: kernel::StorageType::PARTITION,
|
||||
},
|
||||
kernel::StorageLocation {
|
||||
address: 0x4000,
|
||||
size: 0x1000,
|
||||
storage_type: kernel::StorageType::METADATA,
|
||||
},
|
||||
];
|
||||
"
|
||||
).unwrap();
|
||||
}
|
||||
13
boards/nordic/nrf52840dk_opensk_b/layout.ld
Normal file
13
boards/nordic/nrf52840dk_opensk_b/layout.ld
Normal file
@@ -0,0 +1,13 @@
|
||||
/* Memory Space Definitions, 1M flash, 256K ram */
|
||||
MEMORY
|
||||
{
|
||||
rom (rx) : ORIGIN = 0x00060000, LENGTH = 128K
|
||||
prog (rx) : ORIGIN = 0x00080000, LENGTH = 128K
|
||||
ram (rwx) : ORIGIN = 0x20000000, LENGTH = 256K
|
||||
}
|
||||
|
||||
MPU_MIN_ALIGN = 8K;
|
||||
PAGE_SIZE = 4K;
|
||||
|
||||
INCLUDE ../../kernel_layout.ld
|
||||
|
||||
Reference in New Issue
Block a user