pub trait DynamicBinaryStore {
// Required methods
fn setup(&self, app_length: usize) -> Result<usize, ErrorCode>;
fn write(
&self,
buffer: SubSliceMut<'static, u8>,
offset: usize,
) -> Result<(), ErrorCode>;
fn finalize(&self) -> Result<(), ErrorCode>;
fn abort(&self) -> Result<(), ErrorCode>;
fn set_storage_client(&self, client: &'static dyn DynamicBinaryStoreClient);
}
Expand description
This interface supports flashing binaries at runtime.
Required Methods§
Sourcefn setup(&self, app_length: usize) -> Result<usize, ErrorCode>
fn setup(&self, app_length: usize) -> Result<usize, ErrorCode>
Call to request flashing a new binary.
This informs the kernel we want to load a process, and the size of the entire process binary. The kernel will try to find a suitable location in flash to store said process.
Return value:
Ok(length)
: If there is a place to load the process, the function will returnOk()
with the size of the region to store the process.Err(ErrorCode)
: If there is nowhere to store the process a suitableErrorCode
will be returned.
Sourcefn write(
&self,
buffer: SubSliceMut<'static, u8>,
offset: usize,
) -> Result<(), ErrorCode>
fn write( &self, buffer: SubSliceMut<'static, u8>, offset: usize, ) -> Result<(), ErrorCode>
Instruct the kernel to write data to the flash.
offset
is where to start writing within the region allocated
for the new process binary from the setup()
call.
The caller must write the first 8 bytes of the process with valid header data. Writes must either be after the first 8 bytes or include the entire first 8 bytes.
Returns an error if the write is outside of the permitted region or is writing an invalid header.
Sourcefn finalize(&self) -> Result<(), ErrorCode>
fn finalize(&self) -> Result<(), ErrorCode>
Signal to the kernel that the requesting process is done writing the new binary.
Sourcefn set_storage_client(&self, client: &'static dyn DynamicBinaryStoreClient)
fn set_storage_client(&self, client: &'static dyn DynamicBinaryStoreClient)
Sets a client for the SequentialDynamicBinaryStore Object
When the client operation is done, it calls the setup_done()
,
write_done()
and abort_done()
functions.
Implementors§
impl<'b, C: Chip + 'static, D: ProcessStandardDebug + 'static, F: NonvolatileStorage<'b>> DynamicBinaryStore for SequentialDynamicBinaryStorage<'_, 'b, C, D, F>
Storage interface exposed to the app_loader capsule