Fix all boards and move diff to directory
This commit is contained in:
committed by
Julien Cretin
parent
ad0605c2fa
commit
69f1b672f1
@@ -1,189 +1,3 @@
|
||||
diff --git a/boards/nordic/nrf52840_dongle_opensk/src/main.rs b/boards/nordic/nrf52840_dongle_opensk/src/main.rs
|
||||
index e0e292a7e..b485a0997 100644
|
||||
--- a/boards/nordic/nrf52840_dongle_opensk/src/main.rs
|
||||
+++ b/boards/nordic/nrf52840_dongle_opensk/src/main.rs
|
||||
@@ -50,6 +50,11 @@ 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; 1] = [kernel::StorageLocation {
|
||||
+ address: 0xC0000,
|
||||
+ size: 0x40000,
|
||||
+}];
|
||||
+
|
||||
// Static reference to chip for panic dumps
|
||||
static mut CHIP: Option<&'static nrf52840::chip::Chip> = None;
|
||||
|
||||
@@ -78,6 +83,7 @@ pub struct Platform {
|
||||
'static,
|
||||
capsules::virtual_alarm::VirtualMuxAlarm<'static, nrf52840::rtc::Rtc<'static>>,
|
||||
>,
|
||||
+ nvmc: &'static nrf52840::nvmc::SyscallDriver,
|
||||
}
|
||||
|
||||
impl kernel::Platform for Platform {
|
||||
@@ -93,10 +99,30 @@ impl kernel::Platform for Platform {
|
||||
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)),
|
||||
+ nrf52840::nvmc::DRIVER_NUM => f(Some(self.nvmc)),
|
||||
kernel::ipc::DRIVER_NUM => f(Some(&self.ipc)),
|
||||
_ => f(None),
|
||||
}
|
||||
}
|
||||
+
|
||||
+ fn filter_syscall(
|
||||
+ &self,
|
||||
+ process: &dyn kernel::procs::ProcessType,
|
||||
+ syscall: &kernel::syscall::Syscall,
|
||||
+ ) -> Result<(), kernel::ReturnCode> {
|
||||
+ use kernel::syscall::Syscall;
|
||||
+ match *syscall {
|
||||
+ Syscall::COMMAND {
|
||||
+ driver_number: nrf52840::nvmc::DRIVER_NUM,
|
||||
+ subdriver_number: cmd,
|
||||
+ arg0: ptr,
|
||||
+ arg1: len,
|
||||
+ } if (cmd == 2 || cmd == 3) && !process.fits_in_storage_location(ptr, len) => {
|
||||
+ Err(kernel::ReturnCode::EINVAL)
|
||||
+ }
|
||||
+ _ => Ok(()),
|
||||
+ }
|
||||
+ }
|
||||
}
|
||||
|
||||
/// Entry point in the vector table called on hard reset.
|
||||
@@ -105,7 +131,10 @@ pub unsafe fn reset_handler() {
|
||||
// Loads relocations and clears BSS
|
||||
nrf52840::init();
|
||||
|
||||
- let board_kernel = static_init!(kernel::Kernel, kernel::Kernel::new(&PROCESSES));
|
||||
+ let board_kernel = static_init!(
|
||||
+ kernel::Kernel,
|
||||
+ kernel::Kernel::new_with_storage(&PROCESSES, &STORAGE_LOCATIONS)
|
||||
+ );
|
||||
|
||||
// GPIOs
|
||||
let gpio = components::gpio::GpioComponent::new(
|
||||
@@ -249,6 +278,14 @@ pub unsafe fn reset_handler() {
|
||||
nrf52840::acomp::Comparator
|
||||
));
|
||||
|
||||
+ let nvmc = static_init!(
|
||||
+ nrf52840::nvmc::SyscallDriver,
|
||||
+ nrf52840::nvmc::SyscallDriver::new(
|
||||
+ &nrf52840::nvmc::NVMC,
|
||||
+ board_kernel.create_grant(&memory_allocation_capability),
|
||||
+ )
|
||||
+ );
|
||||
+
|
||||
nrf52_components::NrfClockComponent::new().finalize(());
|
||||
|
||||
let platform = Platform {
|
||||
@@ -260,6 +297,7 @@ pub unsafe fn reset_handler() {
|
||||
rng,
|
||||
alarm,
|
||||
analog_comparator,
|
||||
+ nvmc,
|
||||
ipc: kernel::ipc::IPC::new(board_kernel, &memory_allocation_capability),
|
||||
};
|
||||
|
||||
diff --git a/boards/nordic/nrf52840dk_opensk/src/main.rs b/boards/nordic/nrf52840dk_opensk/src/main.rs
|
||||
index 8e4238018..c80732f8d 100644
|
||||
--- a/boards/nordic/nrf52840dk_opensk/src/main.rs
|
||||
+++ b/boards/nordic/nrf52840dk_opensk/src/main.rs
|
||||
@@ -114,6 +114,11 @@ 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; 1] = [kernel::StorageLocation {
|
||||
+ address: 0xC0000,
|
||||
+ size: 0x40000,
|
||||
+}];
|
||||
+
|
||||
static mut CHIP: Option<&'static nrf52840::chip::Chip> = None;
|
||||
|
||||
/// Dummy buffer that causes the linker to reserve enough space for the stack.
|
||||
@@ -141,6 +146,7 @@ pub struct Platform {
|
||||
'static,
|
||||
capsules::virtual_alarm::VirtualMuxAlarm<'static, nrf52840::rtc::Rtc<'static>>,
|
||||
>,
|
||||
+ nvmc: &'static nrf52840::nvmc::SyscallDriver,
|
||||
}
|
||||
|
||||
impl kernel::Platform for Platform {
|
||||
@@ -156,10 +162,30 @@ impl kernel::Platform for Platform {
|
||||
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)),
|
||||
+ nrf52840::nvmc::DRIVER_NUM => f(Some(self.nvmc)),
|
||||
kernel::ipc::DRIVER_NUM => f(Some(&self.ipc)),
|
||||
_ => f(None),
|
||||
}
|
||||
}
|
||||
+
|
||||
+ fn filter_syscall(
|
||||
+ &self,
|
||||
+ process: &dyn kernel::procs::ProcessType,
|
||||
+ syscall: &kernel::syscall::Syscall,
|
||||
+ ) -> Result<(), kernel::ReturnCode> {
|
||||
+ use kernel::syscall::Syscall;
|
||||
+ match *syscall {
|
||||
+ Syscall::COMMAND {
|
||||
+ driver_number: nrf52840::nvmc::DRIVER_NUM,
|
||||
+ subdriver_number: cmd,
|
||||
+ arg0: ptr,
|
||||
+ arg1: len,
|
||||
+ } if (cmd == 2 || cmd == 3) && !process.fits_in_storage_location(ptr, len) => {
|
||||
+ Err(kernel::ReturnCode::EINVAL)
|
||||
+ }
|
||||
+ _ => Ok(()),
|
||||
+ }
|
||||
+ }
|
||||
}
|
||||
|
||||
/// Entry point in the vector table called on hard reset.
|
||||
@@ -183,7 +209,10 @@ pub unsafe fn reset_handler() {
|
||||
UartChannel::Pins(UartPins::new(UART_RTS, UART_TXD, UART_CTS, UART_RXD))
|
||||
};
|
||||
|
||||
- let board_kernel = static_init!(kernel::Kernel, kernel::Kernel::new(&PROCESSES));
|
||||
+ let board_kernel = static_init!(
|
||||
+ kernel::Kernel,
|
||||
+ kernel::Kernel::new_with_storage(&PROCESSES, &STORAGE_LOCATIONS)
|
||||
+ );
|
||||
|
||||
let gpio = components::gpio::GpioComponent::new(
|
||||
board_kernel,
|
||||
@@ -334,6 +363,20 @@ pub unsafe fn reset_handler() {
|
||||
nrf52840::acomp::Comparator
|
||||
));
|
||||
|
||||
+ let nvmc = static_init!(
|
||||
+ nrf52840::nvmc::SyscallDriver,
|
||||
+ nrf52840::nvmc::SyscallDriver::new(
|
||||
+ &nrf52840::nvmc::NVMC,
|
||||
+ board_kernel.create_grant(&memory_allocation_capability),
|
||||
+ dynamic_deferred_caller,
|
||||
+ )
|
||||
+ );
|
||||
+ nvmc.set_deferred_handle(
|
||||
+ dynamic_deferred_caller
|
||||
+ .register(nvmc)
|
||||
+ .expect("no deferred call slot available for nvmc"),
|
||||
+ );
|
||||
+
|
||||
nrf52_components::NrfClockComponent::new().finalize(());
|
||||
|
||||
let platform = Platform {
|
||||
@@ -345,6 +388,7 @@ pub unsafe fn reset_handler() {
|
||||
rng,
|
||||
alarm,
|
||||
analog_comparator,
|
||||
+ nvmc,
|
||||
ipc: kernel::ipc::IPC::new(board_kernel, &memory_allocation_capability),
|
||||
};
|
||||
|
||||
diff --git a/chips/nrf52/src/nvmc.rs b/chips/nrf52/src/nvmc.rs
|
||||
index b70162cae..9934f3a31 100644
|
||||
--- a/chips/nrf52/src/nvmc.rs
|
||||
|
||||
Reference in New Issue
Block a user