[][src]Function kernel::procs::load_processes

pub fn load_processes<C: Chip>(
    kernel: &'static Kernel,
    chip: &'static C,
    app_flash: &'static [u8],
    app_memory: &'static mut [u8],
    procs: &'static mut [Option<&'static dyn ProcessType>],
    fault_response: FaultResponse,
    _capability: &dyn ProcessManagementCapability
) -> Result<(), ProcessLoadError>

Helper function to load processes from flash into an array of active processes. This is the default template for loading processes, but a board is able to create its own load_processes() function and use that instead.

Processes are found in flash starting from the given address and iterating through Tock Binary Format (TBF) headers. Processes are given memory out of the app_memory buffer until either the memory is exhausted or the allocated number of processes are created. A reference to each process is stored in the provided procs array. How process faults are handled by the kernel must be provided and is assigned to every created process.

This function is made pub so that board files can use it, but loading processes from slices of flash an memory is fundamentally unsafe. Therefore, we require the ProcessManagementCapability to call this function.

Returns Ok(()) if process discovery went as expected. Returns a ProcessLoadError if something goes wrong during TBF parsing or process creation.