2022-04-19 08:36:20 +00:00
|
|
|
#![no_std]
|
|
|
|
|
2022-04-19 08:53:31 +00:00
|
|
|
//!Moonboot is a framework to build bootloaders for embedded devices, or other kinds of no_std
|
|
|
|
//!Rust environments.
|
|
|
|
//!
|
|
|
|
//!This crate contains implementations, macros and build.rs helpers for:
|
|
|
|
//!* Partitioning of your memory into different sections
|
|
|
|
//!* Exchange of the contents of those partitions via the bootloader
|
|
|
|
//!* Signature-checking of the partitions contents with an algorithm of your choice
|
|
|
|
//!* Automatic Linker Script generation based on a Section/Parition Description in Rust Code
|
|
|
|
|
|
|
|
/// Implementations for use in the bootloader
|
2022-04-19 08:36:20 +00:00
|
|
|
pub mod boot;
|
2022-04-19 08:53:31 +00:00
|
|
|
/// Common hardware abstractions and associated implementations
|
2022-04-19 08:36:20 +00:00
|
|
|
pub mod hardware;
|
2022-04-19 08:53:31 +00:00
|
|
|
/// Implementations for use in the firmware
|
2022-04-19 08:36:20 +00:00
|
|
|
pub mod manager;
|
2022-04-19 08:53:31 +00:00
|
|
|
/// Shared state management between firmware and bootloader
|
2022-04-19 08:36:20 +00:00
|
|
|
pub mod state;
|
|
|
|
|
2022-04-19 08:53:31 +00:00
|
|
|
pub use embedded_storage;
|
2022-04-19 08:36:20 +00:00
|
|
|
|
|
|
|
/// Because most of the time, ...
|
|
|
|
pub use boot as left_boot;
|
|
|
|
/// ... there's two boots involved.
|
|
|
|
pub use manager as right_boot;
|
|
|
|
|
2022-04-19 08:53:31 +00:00
|
|
|
/// Address type in RAM or ROM
|
2022-04-19 08:36:20 +00:00
|
|
|
pub type Address = u32;
|
|
|
|
|
2022-04-19 08:53:31 +00:00
|
|
|
/// Marker macro for a handler fn invoked shortly before jumping to a different image. Use this to
|
|
|
|
/// uninitialize your hardware.
|
2022-04-19 08:36:20 +00:00
|
|
|
pub use moonboot_macros::pre_jump_handler;
|
|
|
|
|
|
|
|
#[cfg(feature = "use-defmt")]
|
|
|
|
pub(crate) use defmt as log;
|
|
|
|
|
|
|
|
#[cfg(feature = "use-log")]
|
|
|
|
pub(crate) use logger_crate as log;
|
|
|
|
|
|
|
|
#[cfg(not(any(feature = "use-log", feature = "use-defmt")))]
|
|
|
|
pub(crate) mod log {
|
|
|
|
macro_rules! info {
|
|
|
|
( $( $x:expr ),* ) => {};
|
|
|
|
}
|
|
|
|
pub(crate) use info;
|
|
|
|
macro_rules! trace {
|
|
|
|
( $( $x:expr ),* ) => {};
|
|
|
|
}
|
|
|
|
pub(crate) use trace;
|
|
|
|
macro_rules! error {
|
|
|
|
( $( $x:expr ),* ) => {};
|
|
|
|
}
|
|
|
|
pub(crate) use error;
|
|
|
|
macro_rules! warner {
|
|
|
|
( $( $x:expr ),* ) => {};
|
|
|
|
}
|
|
|
|
pub(crate) use warner as warn;
|
|
|
|
}
|
|
|
|
|
|
|
|
#[export_name = "__moonboots_default_pre_jump"]
|
|
|
|
fn default_pre_jump() {}
|