Instead of requiring cargo to be run in the sim directory, create a
top-level "workspace" Cargo file, that references the others. The main
result of this is that cargo can now be run in the top of the workspace,
and the 'target' directory will be placed there, rather than in the sim
directory.
This is primarily of benefit to tools such as RLS, Rust-analyzer and
various IDEs that expect a crate at the top level of the tree.
Signed-off-by: David Brown <david.brown@linaro.org>
The old mbed CLI 1 tool, currently used to compile the MCUboot port for
Mbed™ OS, compiles all files unless otherwise specified in .mbedignore.
The espressif directory in the boot folder was added to the ignore file
to prevent failed builds.
Signed-off-by: Sudarshan Sreeram <sudarshan.sreeram@arm.com>
Signed-off-by: David Brown <david.brown@linaro.org>
`irq_lock()` sets `BASEPRI_MAX` aka. the `BASEPRI` mask to whatever
zephyr has configured it to be by the value of `_EXC_IRQ_DEFAULT_PRIO`.
However by calling arm_cleanup() we also do the call to
`__disable_irq()` setting the PRIMASK to 1. Meaning the only exceptions
we can recive is fault exceptions. Masking out more exceptions does not
really make sense.
Sometimes applications booted by MCUBoot will not expect the `BASEPRI`
to be set to something else than 0(No effect). Meaning if they depend on
using some exception which now is masked out by `BASEPRI` they will
fail.
Signed-off-by: Sigvart Hovland <sigvart.hovland@nordicsemi.no>
When no dynamic memory is used, there is no need for include "os/malloc.h",
and do so will force the user to create an empty "os/malloc.h" file.
Signed-off-by: Carlos Falgueras García <carlos.falgueras@wslw.es>
LOG_IMMEDIATE Kconfig option has been repurposed and is now a Zephyr's
internal, non-visible symbol that should not be used by the end user.
The logging mode used by MCUBoot is defined in prj.conf
Signed-off-by: Piotr Mienkowski <piotr.mienkowski@gmail.com>
The commit modifies mcumgr group processing in boot_serial_input
to allow catching any group that has not been processed by user
provided function.
Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
Upstream Zephyr has renamed the 'nonsecure' variants for boards that
support TF-M. The rename consistently uses '_ns' or '_NS' (with
underscore) as the postfix which distinguishes these variants from
their 'secure' versions.
This affects Kconfig symbols used by MCUboot, so fix them to keep
working with the latest zephyr main branch.
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
The platforms that are listed as integration platforms in
the Zephyr boot sample need to be included in the platform
allow list, otherwise zephyr CI will throw an error. This
commit removes the common list of integration platforms and
adds integration platform entries in each test variant, in
accordance with the allow-list in each of the variants.
Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
This PR updates the path to the devicetree python package lib files according to the Zephyr PR
zephyrproject-rtos#33746 which moved the devicetree lib files.
Old path: ZEPHYR_BASE/scripts/dts/
New path: ZEPHYR_BASE/scripts/dts/python-devicetree/src/devicetree/
Signed-off-by: Carl-Johan Landin <carl-johan.landin@endian.se>
This frees the user from the need of create an empty "mcuboot_logging.h"
when the logging is disabled.
Signed-off-by: Carlos Falgueras García <carlos.falgueras@wslw.es>
The "MCUBOOT_LOG_MODULE_(DECLARE|REGISTER)" macros should have a name
coherent with the rest of the logs macors, ie "BOOT_LOG_*". Also,
"bootutil_log.h" should define them as empty when the logs are disabled and
as "MCUBOOT_LOG_MODULE_*" when they are not.
With this change, the mcuboot user doesn't have to define
MCUBOOT_LOG_MODULE_* macros if the logs don't going to be used.
Signed-off-by: Carlos Falgueras García <carlos.falgueras@wslw.es>
The Kconfig option is applied only when MCUBOOT_SERIAL is enabled
so it has been moved into MUCBOOT_SERIAL dependent section
of Kconfig.
Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
The code switches conditional compilation of progressive erase
code from Zephyr specific CONFIG_ option to more platform
agnostic MCUBOOT_ERASE_PROGRESSIVELY.
Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
The commit adds generalized MCBOOT_ERASE_PROGRESSIVELY options
that can be used to enable progressive erase of flash in
boot_serial DFU code.
The progressive erase is used to erase flash pages as image
update fragments come, instead of erasing the whole needed
image at the beginning.
Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
The commit "boot: Check shared area more carefully before init" adds
the support that the shared area can be used by other boot stages.
Before this commit, MCUboot initialize the shared memory based on a
global variable which indicates whether the shared memory has been
initialized by MCUboot. After this commit, MCUboot also checks the magic
value as well as the sanity check before initialization. So if the data
in shared memory retains after a reset, MCUboot does not initialize the
shared memory thus 'SHARED_MEMORY_OVERWRITE' error happens in
'boot_add_data_to_shared_area'.
So reverted this commit temporarily.
Signed-off-by: Sherry Zhang <sherry.zhang2@arm.com>
Change-Id: I1fc390bc17f90c2624024bc101ba8b4d5a75fe23
Combine all of the pieces to be able to test ram loading with multiple
images. We construct a model `RamData` that indicates where each image
should be loaded into RAM. This has to be made early enough to compute
signatures on the images, and then used later to verify that the images
were loaded properly.
Signed-off-by: David Brown <david.brown@linaro.org>
This RamData is filled in with a mapping between partitions and
information about where the data should be loaded into RAM when booting
in RamLoad mode. This commit creates the data, but does not yet use it.
Signed-off-by: David Brown <david.brown@linaro.org>
Test the basic configuration for ram loading. Instead of a fixed
address for RAM, the values come dynamically from a thread-local
variable (allowing the tests to run in parallel). The size of the ram
along with the address of the buffer in the test address space are
passed in this way.
This tests the single-image configurations of ram loading. Testing
multi-image will take additional work, as the RAM will need to be large
enough for both images, and the second image will need a meaningful
offset address in RAM.
Signed-off-by: David Brown <david.brown@linaro.org>
Perform simplistic test of the DIRECT_XIP configuration (both with
single and multi-images). This verifies that the bootloader indicates
the upgrade image should be booted.
Signed-off-by: David Brown <david.brown@linaro.org>
This change introduced a few warnings that weren't caught until enabling
simulator builds with these features enabled. Add some simple
workarounds to avoid the warnings.
Signed-off-by: David Brown <david.brown@linaro.org>
Although there are no tests for these cases, the configurations now are
built. Enabling them in CI will ensure they continue to build.
Signed-off-by: David Brown <david.brown@linaro.org>
Add simulator support for building the direct-xip configuration.
Although this builds, there are no tests that test any of the
functionality, so all current tests trivially pass.
Signed-off-by: David Brown <david.brown@linaro.org>
Allow the sim to test configurations with MCUBOOT_RAM_LOAD defined.
This does not define any tests for this mode.
This adds definitions for simulated RAM offsets to the simulator. This
will define the offset (from `IMAGE_RAM_BASE`) to where the simulated
RAM will be located. For now, just give these somewhat reasonable
values so that we are able to at least compile the RAM_LOADING code in
the simulator.
Signed-off-by: David Brown <david.brown@linaro.org>
The function `flash_area_id_from_image_slot` is used in the RAM_LOAD and
DIRECT_XIP configurations. Define a version for use in the simulator.
Signed-off-by: David Brown <david.brown@linaro.org>
Some configurations of MCUboot do not modify the flash, but instead
MCUboot operates in a mode where it detects the best image to run.
Detect this, and skip what is currently a majority of the tests that
expect the upgrade to be moving data around in flash.
Signed-off-by: David Brown <david.brown@linaro.org>
Add a macro `IMAGE_RAM_BASE` that will support a simulated device RAM
that can be different per test. This will be zero on targets. Define
an invalid value (3) in the simulator environment. As there are not yet
tests of this configuration, all tests will continue to pass.
Signed-off-by: David Brown <david.brown@linaro.org>
The function `boot_erase_region` is used in some cases when DIRECT_XIP
or RAM_LOAD are defined, however it is specifically not compiled in in
these cases. Correct the ifdefs so this function will be available.
Signed-off-by: David Brown <david.brown@linaro.org>
The MCUBOOT_RAM_LOAD feature supports configurations where code is
loaded from flash into RAM before execution. As such, it is not
necessary for upgrades to move data around in flash.
Signed-off-by: David Brown <david.brown@linaro.org>
In MCUBOOT_RAM_LOAD mode, bootutil_img_hash has some arguments that end
up being unused, which creates warnings. Add these to the list of
variables intentionally unused.
Signed-off-by: David Brown <david.brown@linaro.org>
When the bootloader completes, it fills a response structure with
various information. Move this into the BootGoResult and provide an
accessor for it.
Signed-off-by: David Brown <david.brown@linaro.org>
Now that this result is abstracted, take the special case for a sim stop
and make it its own field. This hides the magic number we use to
indicate this to be entirely within mcuboot-sys.
Signed-off-by: David Brown <david.brown@linaro.org>
Instead of a tuple of values that is matched, return an abstract type
that has methods for querying the information we need. Abstracting this
will allow us to return additional information without having to change
all of the code that matches against these patterns.
Signed-off-by: David Brown <david.brown@linaro.org>
Instead of having this struct at a fairly low level in the simulator,
with the filled-in values effectively discarded after each call, pass
the value from higher up in the simulator. This prepares us for being
able to use the resulting data in upcoming tests.
Signed-off-by: David Brown <david.brown@linaro.org>
commit c304a7f84a
(refs/bisect/good-c304a7f84a7e7e345457e23b179fa302b8732fb9)
Author: Dominik Ermel <dominik.ermel@nordicsemi.no>
Date: Mon Jun 14 16:08:42 2021 +0000
sim: Add flash_area_get_device_id implementation
Adds an implementation for this function in the simulator that just
returns 0. Fix this to return the proper ID so that when tests start
checking for this, it will return the right value.
Signed-off-by: David Brown <david.brown@linaro.org>
Change fixes memory alignment of the RAM buffer that is used to
temporarily store data during swap. Some FLASH drivers require
word-aligned input data buffer. Using unaligned buffer results
in FLASH write error.
Signed-off-by: Marek Pieta <Marek.Pieta@nordicsemi.no>
The commit provides support for "image" parameter in mcumgr image
update frame, that is used to select image number to be updated;
for the purpose, the option MCUBOOT_SERIAL_DIRECT_IMAGE_UPLOAD
that enables the feature.
Platform that enables the feature needs, to provide an implementation
of the flash_area_id_from_direct_image function that will match
the image number to flash area to upload to.
Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>