Commit Graph

1770 Commits

Author SHA1 Message Date
Fabio Utzig b3039fd659 sim: Remove unused variables
Fix warning running the simulator due to variables that are not being
used anymore.

Signed-off-by: Fabio Utzig <utzig@apache.org>
2021-12-16 07:34:50 -03:00
David Brown 53e6f5b8a5 samples: zephyr: Use move swap for Zephyr tests
Change the configs for the Zephyr tests to use move swap, as this is the
code intended for future use.

Signed-off-by: David Brown <david.brown@linaro.org>
2021-12-15 17:15:56 -07:00
Andrzej Puzdrowski e9c6b4d7af zephyr/main: always call sys_clock_disable()
Build-time conditional call is not needed anymore since the empty
sys_clock_disable() callback is provided if the platform
doesn't support system clock disable capability.

Reference:
78dc8ce338

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2021-12-15 16:23:51 +01:00
Andrzej Puzdrowski 03ed502ad7 zephyr: removed CONFIG_SYSTEM_CLOCK_DISABLE=y
CONFIG_SYSTEM_CLOCK_DISABLE property was removed from
zephyr codebase. It is not needed anymore since the empty
sys_clock_disable() callback is provided if the platform
doesn't support system clock disable capability.

Reference:
78dc8ce338

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2021-12-15 16:23:51 +01:00
Gustavo Henrique Nihei bc65d2b10a bootutil: Close flash_area after failure to read swap information
Signed-off-by: Gustavo Henrique Nihei <gustavo.nihei@espressif.com>
2021-12-14 09:30:00 -03:00
Fabio Utzig 5577cbd833 sim: define stm32f4 with non-linear sectors slots
Change the flash layout of the stm32f4 simulated device to include
sectors of different sizes inside both slots; both slots have been
updated to still share the same layout. This layout changes allow for
testing and validation that a swap with scratch is possible even if not
all sectors inside a slot are the same size, as long as they all fit in
scratch.

Signed-off-by: Fabio Utzig <utzig@apache.org>
2021-12-13 23:16:20 -03:00
Gustavo Henrique Nihei 3ee626f36e espressif: Fix ESP32-C3 support for booting signed apps
Signed-off-by: Gustavo Henrique Nihei <gustavo.nihei@espressif.com>
2021-12-09 13:15:45 -03:00
Gustavo Henrique Nihei 523ef3fc2f espressif: Add support for hardware Secure Boot
Signed-off-by: Gustavo Henrique Nihei <gustavo.nihei@espressif.com>
2021-12-09 13:15:45 -03:00
Gustavo Henrique Nihei ce3668fd60 espressif: Use "TAG" field from ESP_LOG* macros from IDF libraries
Signed-off-by: Gustavo Henrique Nihei <gustavo.nihei@espressif.com>
2021-12-09 13:15:45 -03:00
Gustavo Henrique Nihei 6a6b8915a8 espressif: Bump IDF version to v4.4
Signed-off-by: Gustavo Henrique Nihei <gustavo.nihei@espressif.com>
2021-12-09 13:15:45 -03:00
Petro Karashchenko bb927ac014 nuttx: extend configuration options
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2021-12-09 13:06:35 -03:00
Martí Bolívar caa1f6bbd9 assemble.py: don't read BOARD.dts.pre.tmp
This file has been removed from upstream Zephyr in commit 2b7c61e306a
("cmake: re-work devicetree preprocessing steps").

Get the board name from .config instead; this is a stable place for it
to be found. Load the EDT itself from the pickle file in the build
directory; this has the advantage of fixing the script when out of
tree devicetree bindings are used.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2021-12-08 14:18:18 -07:00
Francesco Domenico Servidio 50f1101231 doc: Updated index.md and readme.md
Updated index.md and readme.md:
- Removed outdated info
- Added info about newly added ports
- Fixed a few style issues.
- Rephrased a few sections.

Signed-off-by: Francesco Domenico Servidio <francesco.servidio@nordicsemi.no>
2021-12-08 13:50:43 -07:00
Maureen Helm 05143ce236 boot: zephyr: Configure mimxrt685_evk board
The mimxrt685_evk board has large slots so we need to increase
CONFIG_BOOT_MAX_IMG_SECTORS from the default.

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2021-12-07 15:20:52 -07:00
Radoslaw Koppel 7200669330 zephyr: Fix serial recovery skipping on nrf53
The nRF53 mcu has moved RESETREAS register
(from POWER to RESET peripheral).
This fix uses nrfx helper to select the proper register.

Signed-off-by: Radoslaw Koppel <radoslaw.koppel@nordicsemi.no>
2021-12-07 10:57:23 -03:00
Andrzej Puzdrowski dacc7d606e boot: zephyr: Remove CONFIG_USB from Thingy53 configuration
This was ommited before when this config was droped from
otheres configurations.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2021-12-02 14:08:00 +01:00
Andrzej Puzdrowski 6daf9539ee zephyr: Removed old external flash configs for Thingy53.
Removed old external flash configs for Thingy53.

Signed-off-by: Ole Sæther <ole.saether@nordicsemi.no>
Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2021-12-02 14:08:00 +01:00
Andrzej Puzdrowski a1c43cbea9 zephyr: fix typo in CONFIG_ERASE_PROGRESSIVELY conversion
Kconfig macro was converted with typo to not a MCUboot's
internal macro switch. It was MCBOOT_ERASE_PROGRESSIVELY instead
of MCUBOOT_ERASE_PROGRESSIVELY.
Bug was introduced in
42c985cead

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2021-12-01 18:14:35 +01:00
Andrzej Puzdrowski c9ac5cc6ff boot_serial: cleanup max output size calculation
Calculation of BOOT_SERIAL_OUT_MAX was based on MCUBOOT_IMAGE_NUMBER
while in other places BOOT_IMAGE_NUMBER is taken into account as
number of images. Let's align the calculation to use same literal value
as others.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2021-12-01 16:36:51 +01:00
Andrzej Puzdrowski 94dc19d4a6 bootutil: move BOOT_IMAGE_NUMBER definition to bootutil.h
Definition is used (and redefined) by boot_serial.c module as well.
Let's allow to use one definition for all.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2021-12-01 16:36:51 +01:00
Andrzej Puzdrowski 961a6107ad doc/design: fix typo in swap-using-scratch description
`image-trailer-size` should be mentioned instead
of `image-trailer-sectors-size` in the maximal-image-size
evaluation description.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2021-12-01 14:42:29 +01:00
Jerzy Kasenberg cbb5b23070 mynewt: Add call to custom pre-boot function
Custom boot_preboot() function can be used to start
DFU in similar way as is already done in zephyr.

Signed-off-by: Jerzy Kasenberg <jerzy.kasenberg@codecoup.pl>
2021-11-30 18:47:25 -03:00
Gustavo Henrique Nihei 1d7f496e1d sim: Calculate offsets from boot_max_align instead of hardcoding them
This patch prepares the simulator to execute images with a max align
value other than 8 bytes.

Signed-off-by: Gustavo Henrique Nihei <gustavo.nihei@espressif.com>
2021-11-30 13:42:52 -03:00
Mikkel Jakobsen e0a8061af5 boot: zephyr: configure mimxrt1024_evk board
The mimxrt1024_evk board have a large slot so we need
to increase CONFIG_BOOT_MAX_IMG_SECTORS from the default.

Signed-off-by: Mikkel Jakobsen <mikkel.aunsbjerg@prevas.dk>
2021-11-30 17:39:30 +01:00
Andrzej Puzdrowski 9abda329fe doc/design: Add header for swap using scratch algorithm
Added sub-header for point where swap-using-scratch algorithm
is described.
Added note on the maximum image size allowed for this mode.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2021-11-30 14:58:34 +01:00
Andrzej Puzdrowski cd35fef32d doc/design: note on the image trailer size
Image trailer might consume notable amount of image slot size.
This path adds note for emphasize that fact.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2021-11-30 14:58:34 +01:00
Andrzej Puzdrowski 3c1e6d3873 doc/design: Explain swap without using scratch algorithm
Added description for explain how the algorithm works.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2021-11-30 14:58:34 +01:00
Petro Karashchenko 7c890f4b07 nuttx: fix compilation warnings
improved code consistency

Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2021-11-25 13:34:34 -03:00
Andrzej Puzdrowski 5e76264377 zephyr: clean up CONSOLE and CONSOLE_HANDLER project configurations
CONSOLE_HANDLER is not needed for MCUboot configuration for
doing anything. Also not need to disable others CONSOLE's properties
if CONSOLE=n.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2021-11-22 15:03:00 +01:00
Hein Wessels 56d28f0c92 boot: zephyr: stm32: watchdog support
Adds support for STM32 IWDG.

Also now feeds watchdog in serial recovery.

Signed-off-by: Hein Wessels <heinwessels93@gmail.com>
2021-11-20 15:58:12 -03:00
Francesco Servidio 5dad5b79a2 doc: fix submittingpatches.md
Fixed H2 title in 2nd section
Rephrased the 1st section to remove duplicate content.

Signed-off-by: Francesco Servidio <francesco.servidio@nordicsemi.no>
2021-11-18 15:09:13 -07:00
Håkon Øye Amundsen e829e9d9aa loader: add checking of reset address
In a multi image context it is possible for a user to upload an image
to the wrong secondary slot. As the same key is used for both images
MCUboot will overwrite image 0 with a variant of image 1.

If direct overwrite is enabled it is not trivial to recover from this.

To mitigate this issue we introduce a check of the reset address within
the vector table.

If the reset address in the new image is not contained within the
primary slot the image is deemed incorrect and is deleted from the
secondary slot

Signed-off-by: Håkon Øye Amundsen <haakon.amundsen@nordicsemi.no>
2021-11-18 15:07:01 -07:00
Francesco Servidio 4b2f9ce62f doc: Updated security.md
Updated security.md:
- Fixed small formatting issues
- Fixed a pair of sentences.
- Added mention to hackerone page.

Signed-off-by: Francesco Servidio <francesco.servidio@nordicsemi.no>
2021-11-18 14:41:07 -07:00
Andres Sanchez 9eff1e08bd nuttx: solve referenciation error in memset call
Signed-off-by: Andres Sanchez <tito97_sp@hotmail.com>
2021-11-16 10:45:59 -03:00
David Brown b408b43a9f sim: Reduce most false failures due to ECDSA size change
The encoding of ECDSA signatures is variable sized.  Better support this
by allowing the TLV size estimate to be off by as much as 6, but only in
the case of ECDSA signature.

Signed-off-by: David Brown <david.brown@linaro.org>
2021-11-15 10:38:24 -07:00
David Brown c8d62018b9 sim: Update Linaro copyrights
Update to current year for files modified.

Signed-off-by: David Brown <david.brown@linaro.org>
2021-11-15 10:38:24 -07:00
David Brown 7e0d3b427a sim: Remove profile config from mcuboot-sys
Having profile configuration in sub crates generates a warning every
time Cargo is run.  Remove these lines, as the top-level Cargo.toml file
defines these values.

Signed-off-by: David Brown <david.brown@linaro.org>
2021-11-15 10:38:24 -07:00
David Brown 07dd5f0ae1 sim: Test maximally sized images in some cases
When passed `Largest`, as the image size, compute the largest possible
image for the test.

This currently fails when 'swap-move' is enabled or
'overwrite-only,large-write' is enabled.  Allow this by not testing
maximal images in these cases.

Signed-off-by: David Brown <david.brown@linaro.org>
2021-11-15 10:38:24 -07:00
David Brown a62c3eb628 sim: Prepare for largest possible image sizes
Instead of just passing in a numeric value for the image size, create an
enum that can use a given size, or supports a `Largest` size.  Largest
is not implemented yet, but this gets the types in place for this.

Signed-off-by: David Brown <david.brown@linaro.org>
2021-11-15 10:38:24 -07:00
David Brown ef4f074c9b sim: Add size estimate to TLV
In order to generate images that match exact sizes, we need to know the
size of the TLV.  We can estimate this size before the payload is added
(since the payload doesn't directly affect the size).

This patch adds the size estimate, and compares it with the actual TLV
size.

Signed-off-by: David Brown <david.brown@linaro.org>
2021-11-15 10:38:24 -07:00
David Brown ac655bbddb sim: Functionalize the code a bit
Instead of setting a mutable variable and possibly assigning to it, just
set the variable to the result of the conditional.

Signed-off-by: David Brown <david.brown@linaro.org>
2021-11-15 10:38:24 -07:00
David Brown 0bd8c6bf2a sim: Add doc comment to `make_tlv`
Document this function.

Signed-off-by: David Brown <david.brown@linaro.org>
2021-11-15 10:38:24 -07:00
David Brown d8713a5d48 sim: Fix ordering on TlvFlags
This enum ended up with some fields out of order.  Fix the order.  No
impact to the code, as each enum entry has a specific value, this just
makes the whole enum more consistent.

Signed-off-by: David Brown <david.brown@linaro.org>
2021-11-15 10:38:24 -07:00
Andrzej Puzdrowski fa39e3a56e loader: clear calculation in boot_copy_region()
Introduced mediate variable for express data chunk offset
from the beginning of the region.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2021-11-15 13:48:03 +01:00
Andrzej Puzdrowski 5a32592813 zephr: add mbedtls/library to inclusion directories for RSA encryption
Zephyr's MbedTLS module gives its interface header directory to inclusion
directory list. RSA encryption implementations requires internal header file
which resides in mbedtls/library directory.

This path adds missing inclusion directory path exclusively for
encrypted.c in zephyr-rtos port.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2021-11-15 13:48:03 +01:00
Andrzej Puzdrowski 6191b86d88 zephyr: Increase mbedTLS Heap while RSA is used
Since mbetTLS was upgrades to 3.0.0 it requires
slight more memory

fixes #1200

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2021-11-15 13:48:03 +01:00
Andrzej Puzdrowski e38b0afa6a loader: Allow image header bigger than 1 KB for encrypted images
boot_copy_region() was written so it assumes that the image header
must fit int the intermediary buffer of 1 KB size. A bigger header
will cause a overflow in calculation of size of data chunk to be
decrypted.

This patch allow to use header bigger than that buffer size and
mitigate the limitation described above.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2021-11-15 13:48:03 +01:00
Håkon Øye Amundsen 21f0376faa kconfig: add name to choice option
Facilitate extending the kconfig definition by adding names to all
choices.

Signed-off-by: Håkon Øye Amundsen <haakon.amundsen@nordicsemi.no>
2021-11-15 13:14:10 +01:00
Gustavo Henrique Nihei d985d22abe espressif: Use BOOT_LOG_* macros instead of the MCUBOOT_LOG_*
Also refined the include directives, by removing unused headers and
making the usage of brackets and quotes a bit more coherent,

Signed-off-by: Gustavo Henrique Nihei <gustavo.nihei@espressif.com>
2021-11-14 10:26:55 -03:00
David Brown b8c5a6da3c Create CNAME 2021-11-10 16:43:57 -07:00