mcuboot/sim
Fabio Utzig c659ec5c42 sim: add new device with unequal slots
This device allows testing swap move with a primary slot that is one
sector larger than the secondary slot. No scratch was defined. Overwrite
upgrade could easily be made compatible as well, but for now leave it
as a disabled caps.

Signed-off-by: Fabio Utzig <utzig@apache.org>
2020-07-14 11:11:05 -03:00
..
mcuboot-sys sim: Fixup devicetree.h for changes to mcuboot 2020-05-15 15:11:56 -06:00
simflash sim: Upgrade to 0.7 API version of rand 2020-07-10 11:14:15 -06:00
src sim: add new device with unequal slots 2020-07-14 11:11:05 -03:00
tests Add test for erased secondary with leftover trailer 2020-07-10 06:57:08 -03:00
.gitignore sim: Add simulator code 2017-01-09 12:28:10 -07:00
Cargo.lock sim: Update to aes-ctr 0.4 and fix for API changes 2020-07-10 11:14:15 -06:00
Cargo.toml sim: Update to aes-ctr 0.4 and fix for API changes 2020-07-10 11:14:15 -06:00
README.rst sim: Add `--recursive` to submodule update 2020-05-12 08:38:46 -06:00

README.rst

MCUboot Simulator
#################

This is a small simulator designed to exercise the mcuboot upgrade
code, specifically testing untimely reset scenarios to make sure the
code is robust.

Prerequisites
=============

The simulator is written in Rust_, and you will need to install it to
build it.  The installation_ page describes this process.  The
simulator can be built with the stable release of Rust.

.. _Rust: https://www.rust-lang.org/

.. _installation: https://www.rust-lang.org/en-US/install.html

Dependent code
--------------

The simulator depends on some external modules.  These are stored as
submodules within git.  To fetch these dependencies the first time::

  $ git submodule update --init --recursive

will clone and check out these trees in the appropriate place.

Testing
=======

The tests are written as unit tests in Rust, and can be built and run
automatically::

  $ cargo test

this should download and compile the necessary dependencies, compile
the relevant modules from mcuboot, build the simulator, and run the
tests.

There are several different features you can test. For example,
testing RSA signatures can be done with::

  $ cargo test --features sig-rsa

For a complete list of features, see Cargo.toml.

Debugging
=========

If the simulator indicates a failure, you can turn on additional
logging by setting ``RUST_LOG=warn`` or ``RUST_LOG=error`` in the
environment::

  $ RUST_LOG=warn ./target/release/bootsim run ...

It is also possible to run specific tests, for example::

  $ cargo test -- basic_revert

which will run only the `basic_revert` test.