Commit Graph

1366 Commits

Author SHA1 Message Date
Fabio Utzig 0be390e08e ci: update workflows names and add more badges
Fix workflows names on yaml root to be able to use them to refer to the
workflow. Add badges for pypi, workflows and license.

Signed-off-by: Fabio Utzig <fabio.utzig@nordicsemi.no>
2020-11-12 12:39:03 -03:00
Fabio Utzig 395a9f9c5a ci: add wheel dependency to imgtool publishing
Should fix the current fail trying to build a bdist_wheel.

Signed-off-by: Fabio Utzig <fabio.utzig@nordicsemi.no>
2020-11-12 08:52:20 -03:00
Andrzej Puzdrowski e75966105a Preps for 1.7.0-rc2
Update version fields for 1.7.0-rc2 release.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2020-11-12 11:14:28 +01:00
Mate Toth-Pal cbf9d39cbb travis: Add documentation to FIH CI test
Change-Id: Ib0def822e9748d64fd0dd77eefaaeba4ceaf1a83
Signed-off-by: Mate Toth-Pal <mate.toth-pal@arm.com>
2020-11-12 09:27:10 +01:00
Mate Toth-Pal d4f605300e travis: Add Script to summarize FIH test output
Change-Id: I5fbbad8cdaf829dc11543a70e419de45f07002a0
Signed-off-by: Mate Toth-Pal <mate.toth-pal@arm.com>
2020-11-12 09:27:10 +01:00
Mate Toth-Pal b1163985bd travis: Add python script for damaging MCUboot image
Change-Id: Ic975b2fa937baafe57c8c492ef889ffb292f691e
Signed-off-by: Mate Toth-Pal <mate.toth-pal@arm.com>
2020-11-12 09:27:10 +01:00
Mate Toth-Pal 0eead8c263 travis: Add FIH test cases to .travis.yml
Change-Id: I7ce96821e4af645a8d20696d02d8a09d9822b9f7
Signed-off-by: Mate Toth-Pal <mate.toth-pal@arm.com>
2020-11-12 09:27:10 +01:00
Mate Toth-Pal 6298067d02 travis: Add FIH test scripts
Add scripts that can run instruction skip FIH tests on QEMU.

Co-authored-by: Raef Coles <raef.coles@arm.com>
Change-Id: Ia6da00174115e1dabaf84fdfc0e40476dc1b7a10
Signed-off-by: Mate Toth-Pal <mate.toth-pal@arm.com>
2020-11-12 09:27:10 +01:00
Mate Toth-Pal 5495f20355 travis: Build MCUBoot for Armv8-M
Build MCUBoot with TF-M build system for AN521 platform, and run it in
QEMU. The result of the test run is not evaluated yet.

Change-Id: I5fbfef8e6d8dec99a8e3e00d659a07ccfcaf0b5b
Signed-off-by: Mate Toth-Pal <mate.toth-pal@arm.com>
2020-11-12 09:27:10 +01:00
David Brown b681028b60 samples: zephyr: Fix URL in test compilation
This reference to the old Juul URL got missed.  Fix it as well.

Signed-off-by: David Brown <david.brown@linaro.org>
2020-11-10 17:04:20 -07:00
Fabio Utzig de1d72d069 doc: fix github urls to use the new org
Signed-off-by: Fabio Utzig <fabio.utzig@nordicsemi.no>
2020-11-10 14:19:19 -03:00
Fabio Utzig c06694e25c ci: move imgtool publishing to GH workflows
Disable imgtool publishing on Travis; update scripts to work on both
Travis and GH; add GH workflow for publishing.

Signed-off-by: Fabio Utzig <fabio.utzig@nordicsemi.no>
2020-11-10 14:19:05 -03:00
Fabio Utzig 3236d75e70 ci: remove travis.yml
Signed-off-by: Fabio Utzig <fabio.utzig@nordicsemi.no>
2020-11-10 14:19:05 -03:00
Fabio Utzig 6871992b5e boot: zephyr: add nrf52840 QSPI NOR overlays
Add configuration and DTS overlays to run MCUboot + smp_svr on the
nrf52840dk using the secondary slot in the external QSPI NOR flash.

Signed-off-by: Fabio Utzig <fabio.utzig@nordicsemi.no>
2020-11-10 08:52:25 -03:00
George Beckstein e42c6482e5 Temporarily disable use of TinyCrypt with Mbed-OS
TinyCrypt uses a modified version of micro-ecc that is also used by the Mbed Cordio BLE stack. When building mcuboot for a target with BLE enabled, this causes multiple-defined symbol errors during linking. Due to the nature of Mbed's current build system, it is difficult to fix this.

Mbed will soon release a more flexible cmake-based build system that will make it possible to exclude these TinyCrypt files from an application build that may also link Cordio BLE sources.

Until then, this commit temporarily disables the use of TinyCrypt with Mbed-OS and excludes its sources from the build to avoid this build error.

Signed-off-by: George Beckstein <becksteing@embeddedplanet.com>
2020-11-06 09:18:27 -03:00
George Beckstein 1c399bbd86 Update main README with links to Mbed-OS documentation
Signed-off-by: George Beckstein <becksteing@embeddedplanet.com>
2020-11-06 09:18:27 -03:00
George Beckstein 30898fc003 Remove mbed-os library
This commit reverts the addition of an mbed-os.lib file introduced with the Mbed-OS port. Mbed-OS build tools use .lib files to pull in additional dependencies automatically with a single command. The intended usage of mcuboot with mbed-os is to clone mcuboot *next to* mbed-os, rather than mbed-os inside mcuboot.

Signed-off-by: George Beckstein <becksteing@embeddedplanet.com>
2020-11-04 14:22:27 -07:00
George Beckstein d82afbfaa8 Mbed-OS porting layer implementation for mcuboot
This PR provides a porting layer implementation and framework for building an mcuboot-based bootloader with Mbed-OS. Some symbols are not provided by the Mbed-OS port within mcuboot, namely:

- The secondary storage device (see below)
- The signing keys
- The encryption keys, if used

Use of this port is demonstrated by the following projects:
- https://github.com/AGlass0fMilk/mbed-mcuboot-demo (a complete mcuboot/Mbed-OS-based bootloader)
- https://github.com/AGlass0fMilk/mbed-mcuboot-blinky (example showing how to make an Mbed-OS application that is bootable by mcuboot)

Memory porting implementation:

The underlying implemenation uses Mbed's BlockDevice API as the storage backend for mcuboot's memory operations. This provides a very flexible way of configuring the location and layout of the secondary flash storage area. To build an mcuboot-based bootloader with Mbed-OS, the user must implement a hook function, mbed::BlockDevice* get_secondary_bd(), to provide the secondary BlockDevice that mcuboot will use.

The signing and encryption keys must also be provided by the user. They can be generated using the existing imgtool utility in the same manner used by Zephyr. There are no automated build steps currently provided by Mbed-OS to sign/encrypt build artifacts.

Known limitations:

The update candidate encryption features have not yet been fully tested. A truly secure implementation will require integration with Mbed's TRNG API in the future to inhibit side-channel attacks on the decryption process.

The TinyCrypt backend is currently only supported for Mbed-OS builds when building with the GCC toolchain. The new cmake-based Mbed-OS build system will fix the underlying issue (file name uniqueness).

Signed-off-by: George Beckstein <becksteing@embeddedplanet.com>
Signed-off-by: Evelyne Donnaes <evelyne.donnaes@arm.com>
Signed-off-by: Lingkai Dong <lingkai.dong@arm.com>

Co-authored-by: Lingkai Dong <lingkai.dong@arm.com>
Co-authored-by: Fabio Utzig <fabio.utzig@nordicsemi.no>
2020-11-03 19:16:46 -03:00
Andy Gross ea30ef3ca7 boot: Add vendor defined TLV ranges
This patch adds comments to reserve off a portion of the available TLV range
for use by vendors for proprietary TLV types.

Signed-off-by: Andy Gross <andy.gross@juul.com>
2020-11-03 21:57:13 +01:00
David Vincze 505fba252e Boot: Add 'revert' support to direct-xip mode
The 'revert' mechanism in direct-xip is similar to the one in swap mode.
It requires the trailer magic to be added to the signed image. When a
reboot happens without the image being confirmed at runtime (without the
image_ok flag being set), the bootloader considers the image faulty and
erases it. After this it will attempt to boot the previous image
instead. The images can also be made permanent (marked as confirmed in
advance) just like in swap mode.

Change-Id: Ibde9361d4a7302dd8efbb277b691b71eca0ca877
Signed-off-by: David Vincze <david.vincze@linaro.org>
2020-11-03 21:52:11 +01:00
Fabio Utzig f6c692315c Delete CNAME 2020-10-30 14:13:11 -03:00
Andrzej Puzdrowski 69344636be Preps for 1.7.0-rc1
Update version fields for 1.7.0-rc1 release.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2020-10-30 17:56:02 +01:00
David Brown 1151714a68 Create CNAME 2020-10-30 09:13:13 -06:00
Andrzej Puzdrowski dfc7c5f9a4 doc/release: Describe development version designation
After each release version will be changed to
MAJOR.MINOR.PATCH-dev.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2020-10-30 16:12:38 +01:00
Fabio Utzig b94c985a26 Delete CNAME 2020-10-30 12:07:54 -03:00
Fabio Utzig 8084e8beaa Create CNAME 2020-10-30 12:06:39 -03:00
Andrzej Puzdrowski c74c551ed6 zephyr/arm_cleanup: exclude z_arm_clear_arm_mpu_config() when no MPU
This function must be excluded from build when
core doesn't have MPU.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2020-10-29 14:41:22 +01:00
Andrzej Puzdrowski 56c15e7c49 zephyr: added ISB after cortex control was set
After modifying the CONTROL register, ISB function should be
used to ensure the effect of the change applies to
subsequent code.
Due to the simple nature of the Cortex-M3, Cortex-M4, Cortex-M0+,
Cortex-M0, and Cortex-M1 pipeline,
omission of the ISB instruction does not cause any problem.
But might cause problem on a more advanced core.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2020-10-29 13:34:44 +01:00
Fabio Utzig ce115975c0 bootutil: fix upgrade issue in swap-move
A previous fix for allowing padded images in the primary slot, ended up
causing an issue that would fail to upgrade under the right
circumstances. The issue was caused when the following set of steps
happened after an upgrade was detected:

1) trailer is erased on the primary slot
2) status is written to the primary slot
3) trailer is erased on the secondary slot
4) reset
1) trailer is erased on the primary slot
2) status partially written or not written to primary slot (no magic)
3) reset

This would result in images stored in the same slots they were
initially, aka no upgrade, which would fail the simulator test for
upgraded images.

The previous padded images fix was reverted and the status source was
upgraded to also check that the secondary slot has a valid magic in it,
so that there's never a circumstance where there is no trailer in any
of the slots while an upgrade operation is being decided on.

Signed-off-by: Fabio Utzig <fabio.utzig@nordicsemi.no>
2020-10-28 18:16:48 -03:00
Fabio Utzig 7fd42d5ff9 Revert "bootutil: fix swap-move brick with padded image0"
This reverts commit 296949ef6d.

Signed-off-by: Fabio Utzig <fabio.utzig@nordicsemi.no>
2020-10-28 18:16:48 -03:00
Ioannis Glaropoulos 3c1e4fbdda Revert "boot: zephyr: Disable HW stack protection"
This reverts commit 4dc12f4807.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2020-10-28 22:02:15 +01:00
Ioannis Glaropoulos 70af708b85 boot: zephyr: clean ARM core configuration only when selected by user
Clean up the ARM core configuration only when
the CONFIG_MCUBOOT_CLEANUP_ARM_CORE is selected.
This involves cache and stack pointer limit registers.

Add also an MPU cleanup in platforms with the ARM MPU
supported.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2020-10-28 22:02:15 +01:00
Ioannis Glaropoulos 518d93a6b6 zephyr: Kconfig: change default for MCUBOOT_CLEANUP_ARM_CODE
Zephyr has introduced an option to perform the cleanup
of ARM core HW registers during early boot, when the
firmware is chain-loaded by MCUboot. Therefore, MCUboot
does not need to perform the same cleanup before jumping
to the application image. The patch relies on the fact
that building MCUboot with Zephyr implies loading also
a Zephyr-based application firmware. If this is not the
case, the application developer needs to enable the
MCUBOOT_CLEANUP_ARM_CODE Kconfig option manually, in the
project configuration.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2020-10-28 22:02:15 +01:00
TTornblom 6610e880d8 boot: Fix FIH_LABEL/FIH_CALL macros for IAR
The IAR toolchain does not handle the "%=" template. Emulate it with
a combination of __LINE__ and __COUNTER__

Signed-off-by: TTornblom <thomas.tornblom@iar.com>
2020-10-28 12:01:45 -03:00
Sigvart Hovland 59f1d29c0c bootutil: ecdsa: Fix CC310 for nRF devices
This contains fixes for CC310 for nRF devices using the nrfxlib.
Removed some const for compilation warnings and added `NUM_ECC_BYTES`
define.

Signed-off-by: Sigvart Hovland <sigvart.m@gmail.com>
2020-10-28 15:50:46 +01:00
Andrzej Puzdrowski c0dbdd407c boot/zephyr: make flash_area_erased_val() weak
The function was made week so zephyr-rtos implementation
will be used if available.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2020-10-27 18:04:21 +01:00
Fabio Utzig 9bd1a3dda4 bootutil: fix unitialized variable warning
For some configurations, eg CONFIG_BOOT_DIRECT_XIP=y, fih_rc might
never be initialized; initialize and fix warning.

Signed-off-by: Fabio Utzig <fabio.utzig@nordicsemi.no>
2020-10-23 17:09:20 +02:00
Andrzej Puzdrowski f48de7a523 boot/boot_serial: allow nonaligned last chunk
The last data packet might be non aligned to multiple of
the flash write-block-size. This cause that the `image upload`
mcumgr command mighty fail if the device flash driver doesn't
support one-byte write-block-size.

This patch complements the last write operation to aligned chunk
so it meet the requirements.

Added check for ensure than received data chunk doesn't
cross expected image size.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2020-10-23 17:01:00 +02:00
Martí Bolívar a6a0e0e77c doc: clean up multi-image documentation
Some design.md content is causing build errors when they are included
in a .rst based documentation tree in Sphinx.

Adjust the format to make it work in both systems.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2020-10-22 17:46:06 -03:00
Bernt Johan Damslora a2fad12e3b zephyr: enable progressive erase on all nRF boards
Enables BOOT_ERASE_PROGRESSIVELY for Nordic nRF boards.

This fixes issue where mcumgr upload command would result in
device being deleted, but no new image being uploaded
due to timeout while waiting for erase operation.

This avoids a delay of several seconds during firmware upload.

Signed-off-by: Bernt Johan Damslora <bernt.johan.damslora@nordicsemi.no>
Signed-off-by: Emil Obalski <emil.obalski@nordicsemi.no>
Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
Signed-off-by: Håkon Øye Amundsen <haakon.amundsen@nordicsemi.no>
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2020-10-21 13:03:50 +02:00
Håkon Øye Amundsen 25eabb6622 zephyr: update name of nrf5340 dk
This to correctly set the kconfig default value.

Signed-off-by: Håkon Øye Amundsen <haakon.amundsen@nordicsemi.no>
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2020-10-21 13:03:50 +02:00
Andrzej Puzdrowski c625da41e3 zephyr: remove flash_area_read_is_empty()
This function was drooped from MCUBoot's porting API.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2020-10-21 10:53:36 +02:00
Andrzej Puzdrowski 210b31802b boot/zephyr: feed watchdog at the start
Added call to the watchdog feed macro at the
MCUBoot's main() beginning.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2020-10-13 17:22:38 +02:00
Andrzej Puzdrowski d21442a954 zephyr/Kconfig: added option for enabling WDT feed
Added option for enabling feeding the watchdog while
doing the swap operation.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2020-10-13 17:22:38 +02:00
Emil Hammarstrom ab03b91afd boot/zephyr: add nrfx watchdog kick during boot region copy
This fixes soft-bricks that we have seen as a result
of the bootloader being interrupted by the watchdog.

Signed-off-by: Emil Hammarstrom <emil.hammarstrom@assaabloy.com>
Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2020-10-13 17:22:38 +02:00
Fabio Utzig 05722f4a01 doc: PORTING: drop flash_area_read_is_empty()
Update PORTING guide dropping `flash_area_read_is_empty`.

Signed-off-by: Fabio Utzig <fabio.utzig@nordicsemi.no>
2020-10-08 20:47:56 -03:00
Fabio Utzig 4b2e55f362 boot: bootutil: drop flash_area_read_is_empty
Removes the current `flash_area_read_is_empty` which lacked a bit of
clarity in its naming and error handling, as well as requiring an
extra API in the flash map, and switches to using an internal function
`bootutil_buffer_is_erased`.

Code that was previously using `flash_area_read_is_empty` must now be
updated to do a `flash_area_read` followed by a call to
`bootutil_buffer_is_erased` with the read buffer.

The proposal was previously discussed here:

https://github.com/zephyrproject-rtos/zephyr/pull/28519

Signed-off-by: Fabio Utzig <fabio.utzig@nordicsemi.no>
2020-10-08 20:47:56 -03:00
Fabio Utzig 296949ef6d bootutil: fix swap-move brick with padded image0
When the image in the primary slot is padded, the boot source is
considered the primary slot; this results in skipping the typical
initialization of the trailer, which ends up bricking the device. As
it is fine to always initialize the trailer in the primary slot when
starting a new upgrade the extra check was removed.

Signed-off-by: Fabio Utzig <fabio.utzig@nordicsemi.no>
2020-10-07 10:54:34 -03:00
Mate Toth-Pal 2cbe5e2d03 ci: Temporarily disable travis test jobs
Change-Id: Ic3448ac93a196d78303ad1e66988c2d7ed81fdb7
Signed-off-by: Mate Toth-Pal <mate.toth-pal@arm.com>
2020-10-07 10:50:47 -03:00
Dominik Ermel d8db02589f boot/zephyr: Improve badly written comment
The comment on why first parameter to bootutil_img_validate is allowed
to be NULL, in boot_image_validation of single_loader.c, has been
rewritten.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2020-10-07 14:47:34 +02:00