How sayooj-aerlync/mcuboot works
Main architectural layers and components
a. Core Bootloader (bootutil)
• Description: Portable, OS-agnostic C library providing image validation, swap, fault-injection hardening, crypto-abstraction.
• Location: boot/bootutil/src & include.
b. Bootloader Extensions
• Serial-upgrade support (boot_serial).
• Description: In-loader image upload over UART.
• Location: boot/boot_serial.
c. Porting Layers (per OS / SoC)
• Zephyr (boot/zephyr)
• Apache Mynewt (boot/mynewt)
• Apache NuttX (boot/nuttx)
• Mbed OS (boot/mbed)
• Espressif SoCs (boot/espressif)
• Cypress/Infineon (boot/cypress)
• For each: hardware-abstraction, OS hooks, board config, linker scripts.
d. External Cryptographic Backends (ext/)
• tinycrypt, mbedTLS-ASN1, fiat-crypto, nRF CC310 glue.
• Used by core and port layers via abstraction.
e. Image-Signing & Management Tools
• imgtool (Python CLI + lib)
• ptest (Rust/C testing harness)
• scripts/imgtool, scripts/tests.
f. Simulation & Testing Harness
• sim (Rust crates + C support via mcuboot-sys)
• simflash (Rust library simulating flash)
• sim/src: test vectors, API.
g. Continuous Integration & Sample Projects
• CI workflows (.github/workflows, ci/)
• samples/ (Zephyr, compression test, runtime-source).
• testplan/ (Mynewt test plans).
Relationships and data flows
• imgtool → Generates signed firmware images → Flashed into device or simulator.
• Device Bootloader (core+port) → Reads Flash → Performs image validation using crypto backends → If valid, swaps/boots new image.
• Boot_serial extension ↔ Host PC via UART for image upload.
• Simulation harness calls Bootloader core APIs to emulate flash operations and verify logic.
• CI pipelines invoke build scripts for each port, run imgtool, sim, ptest, and sample-apps.
Architectural patterns & design principles
• Layered architecture:
• Core functional layer (bootutil) separated from platform specifics.
• Porting‐layer/HAL abstracts RTOS and SoC.
• External libs provide pluggable crypto implementations.
• Modular code organization: monorepo with submodules, each port or extension lives in its own directory.
• Code reuse via pkg.yml/CMakeLists for each target.
• Multi‐language tooling: C for core & ports, Python for CLI, Rust for simulation.
Must-have elements
• Boundary for device runtime vs. host-side tools vs. CI/test environment.