mcuboot/sim
Fabio Utzig 66ed29f64c sim: update ram load to use image size comparison
When building images for testing they are aligned to a flash write size,
which works fine for flash based comparisons, but since RAM is always
reset to 0, if the flash is erased to 0xff, the final bytes of the
alignment will differ even though they are not relevant (not part of the
image itself).

This commit adds a real image size parameter to the ImageData, so it can
be used by the RAM load to compare only the relevant bits of the image
(ignore the padding), and also updates the RAM test routine to use the
correct image size.

Signed-off-by: Fabio Utzig <utzig@apache.org>
2021-10-07 12:40:24 -03:00
..
mcuboot-sys sim: mcuboot-sys: Avoid duplicate C files 2021-09-27 15:22:09 -06:00
simflash sim: Use range `contains` when possible 2021-03-11 07:25:43 -07:00
src sim: update ram load to use image size comparison 2021-10-07 12:40:24 -03:00
tests sim: Basic ram-load test 2021-07-19 11:22:13 -06:00
.gitignore sim: Add simulator code 2017-01-09 12:28:10 -07:00
Cargo.toml sim: Move Cargo package to top level 2021-09-17 10:45:53 -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.