Expand description
This capsule provides an interface between a dynamic loading userspace app and the kernel.
This is an initial implementation that gets the app size from the userspace app and sets up the flash region in which the app will be written. Then the app is actually written to flash. Finally, the the userspace app sends a request for the app to be loaded.
Here is a diagram of the expected stack with this capsule: Boxes are components and between the boxes are the traits that are the interfaces between components.
+-----------------------------------------------------------------+
| |
| userspace |
| |
+-----------------------------------------------------------------+
kernel::SyscallDriver
+-----------------------------------------------------------------+
| |
| capsules::app_loader::AppLoader (this) |
| |
+-----------------------------------------------------------------+
kernel::dynamic_binary_storage::DynamicBinaryStore
kernel::dynamic_binary_storage::DynamicProcessLoad
+-----------------------------------------------------------------+
| | |
| Physical Nonvolatile Storage | Kernel |
| | |
+-----------------------------------------------------------------+
hil::nonvolatile_storage::NonvolatileStorage
Example instantiation:
ⓘ
type NonVolatilePages = components::dynamic_binary_storage::NVPages<nrf52840::nvmc::Nvmc>;
type DynamicBinaryStorage<'a> = kernel::dynamic_binary_storage::SequentialDynamicBinaryStorage<
'static,
nrf52840::chip::NRF52<'a, Nrf52840DefaultPeripherals<'a>>,
kernel::process::ProcessStandardDebugFull,
NonVolatilePages,
>;
let dynamic_app_loader = components::app_loader::AppLoaderComponent::new(
board_kernel,
capsules_extra::app_loader::DRIVER_NUM,
dynamic_binary_storage,
dynamic_binary_storage,
).finalize(components::app_loader_component_static!(
DynamicBinaryStorage<'static>,
DynamicBinaryStorage<'static>,
));
NOTE:
1. This capsule is not virtualized, and can only serve one app at a time.
2. This implementation currently only loads new apps. It does not update apps.