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
|
||||
|
||||
@@ -102,7 +102,7 @@ index 000000000..69e95c3c7
|
||||
+ }
|
||||
+}
|
||||
diff --git a/boards/nordic/nrf52840_dongle_opensk/src/main.rs b/boards/nordic/nrf52840_dongle_opensk/src/main.rs
|
||||
index b485a0997..f5d29d025 100644
|
||||
index f9c104251..115e17280 100644
|
||||
--- a/boards/nordic/nrf52840_dongle_opensk/src/main.rs
|
||||
+++ b/boards/nordic/nrf52840_dongle_opensk/src/main.rs
|
||||
@@ -40,6 +40,17 @@ const _SPI_CLK: Pin = Pin::P1_04;
|
||||
@@ -143,8 +143,8 @@ index b485a0997..f5d29d025 100644
|
||||
kernel::ipc::DRIVER_NUM => f(Some(&self.ipc)),
|
||||
_ => f(None),
|
||||
}
|
||||
@@ -286,6 +303,21 @@ pub unsafe fn reset_handler() {
|
||||
)
|
||||
@@ -292,6 +309,21 @@ pub unsafe fn reset_handler() {
|
||||
.expect("no deferred call slot available for nvmc"),
|
||||
);
|
||||
|
||||
+ // Enable power events to be sent to USB controller
|
||||
@@ -165,7 +165,7 @@ index b485a0997..f5d29d025 100644
|
||||
nrf52_components::NrfClockComponent::new().finalize(());
|
||||
|
||||
let platform = Platform {
|
||||
@@ -298,6 +330,7 @@ pub unsafe fn reset_handler() {
|
||||
@@ -304,6 +336,7 @@ pub unsafe fn reset_handler() {
|
||||
alarm,
|
||||
analog_comparator,
|
||||
nvmc,
|
||||
|
||||
@@ -87,7 +87,7 @@ index 917497af4..520408fcb 100644
|
||||
pub mod gpio;
|
||||
pub mod hd44780;
|
||||
diff --git a/boards/nordic/nrf52840_dongle_opensk/src/main.rs b/boards/nordic/nrf52840_dongle_opensk/src/main.rs
|
||||
index f5d29d025..051943867 100644
|
||||
index 115e17280..3e35f7e90 100644
|
||||
--- a/boards/nordic/nrf52840_dongle_opensk/src/main.rs
|
||||
+++ b/boards/nordic/nrf52840_dongle_opensk/src/main.rs
|
||||
@@ -100,6 +100,7 @@ pub struct Platform {
|
||||
@@ -106,7 +106,7 @@ index f5d29d025..051943867 100644
|
||||
kernel::ipc::DRIVER_NUM => f(Some(&self.ipc)),
|
||||
_ => f(None),
|
||||
}
|
||||
@@ -318,6 +320,14 @@ pub unsafe fn reset_handler() {
|
||||
@@ -324,6 +326,14 @@ pub unsafe fn reset_handler() {
|
||||
)
|
||||
.finalize(components::usb_ctap_component_buf!(nrf52840::usbd::Usbd));
|
||||
|
||||
@@ -121,7 +121,7 @@ index f5d29d025..051943867 100644
|
||||
nrf52_components::NrfClockComponent::new().finalize(());
|
||||
|
||||
let platform = Platform {
|
||||
@@ -331,6 +341,7 @@ pub unsafe fn reset_handler() {
|
||||
@@ -337,6 +347,7 @@ pub unsafe fn reset_handler() {
|
||||
analog_comparator,
|
||||
nvmc,
|
||||
usb,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
diff --git a/boards/nordic/nrf52840_dongle_opensk/src/main.rs b/boards/nordic/nrf52840_dongle_opensk/src/main.rs
|
||||
index 051943867..e38898c3b 100644
|
||||
index 3e35f7e90..b624e19a2 100644
|
||||
--- a/boards/nordic/nrf52840_dongle_opensk/src/main.rs
|
||||
+++ b/boards/nordic/nrf52840_dongle_opensk/src/main.rs
|
||||
@@ -64,6 +64,7 @@ static mut PROCESSES: [Option<&'static dyn kernel::procs::ProcessType>; NUM_PROC
|
||||
@@ -11,7 +11,7 @@ index 051943867..e38898c3b 100644
|
||||
|
||||
// Static reference to chip for panic dumps
|
||||
diff --git a/boards/nordic/nrf52840_mdk_dfu/src/main.rs b/boards/nordic/nrf52840_mdk_dfu/src/main.rs
|
||||
index daaeaedc7..c4b0afee9 100644
|
||||
index 25bd61460..84c7cff70 100644
|
||||
--- a/boards/nordic/nrf52840_mdk_dfu/src/main.rs
|
||||
+++ b/boards/nordic/nrf52840_mdk_dfu/src/main.rs
|
||||
@@ -59,6 +59,7 @@ static mut PROCESSES: [Option<&'static dyn kernel::procs::ProcessType>; NUM_PROC
|
||||
|
||||
Reference in New Issue
Block a user