Commit Graph

306 Commits

Author SHA1 Message Date
Andrzej Puzdrowski 907476d701 boot: remove direct fih delay rng inclusion
Direct inclusion of "bootutil/fault_injection_hardening_delay_rng.h"
might cause linking collision as this header belongs to `FIH_ENABLE_DELAY`
mode.
This header is already included by "bootutil/fault_injection_hardening.h"
appropriately.

fixes #831

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2020-10-07 13:50:16 +02:00
Marcin Niestroj 4dc12f4807 boot: zephyr: Disable HW stack protection
Some Zephyr boards enable HW stack protection by default, which
propagates in mcuboot build. Bootloader works fine with that option, but
the problem arises when we jump to application code. HW stack protection
catches application code during early init, which results in
"unresponsive" application.

Disable HW stack protection, so it doesn't make any harm for application
code.

Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
2020-10-06 14:54:49 +02:00
Ryan Erickson aac99a14c9 boot: zephyr: add support for Pinnacle 100
Add support for the pinnacle_100_dvk board.
The Pinnacle 100 modem slot 1 partition
is located in external QSPI.
Add a board file overlay to enable QSPI flash.

Signed-off-by: Ryan Erickson <ryan.erickson@lairdconnect.com>
2020-10-03 18:51:41 -03:00
Andrzej Puzdrowski f0ef8b6daf zephyr/cmake: add help message for missing nrfxlib case
nrfxlib need to be cloned manullay.
This patch gives a help message to the user in case it
was missing.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2020-10-02 12:45:51 +02:00
Andrzej Puzdrowski 7141b52ab2 zephyr/Kconfig: not use cc310 by default
Usage of cc310 by defaults gives poor user
experience out of the box as it requires manual
cloning of nrfxlib repository.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2020-10-02 12:45:51 +02:00
Tamas Ban ee6615def0 boot/zephyr: Add fault injection mitigation
Add software countermeasures against fault injection attacks.

Change-Id: I82f2d6b529ee2bd8d58ec6d5302c01680b4fd483
Signed-off-by: Tamas Ban <tamas.ban@arm.com>
Signed-off-by: Fabio Utzig <fabio.utzig@nordicsemi.no>
2020-10-02 07:31:11 -03:00
Tamas Ban fce873364e boot/zephyr: Add fault injection hardening profile to Zephyr config
Add fault injection hardening profile configuration to Zephyr config.
Default config is to not have any hardening in SW against hardware level
fault injection like clock or power glitching, EM pulse, laser beam, etc.

Change-Id: I67d22d257ead83e1e288de0ee7621aac32bf50eb
Signed-off-by: Tamas Ban <tamas.ban@arm.com>
Signed-off-by: Fabio Utzig <fabio.utzig@nordicsemi.no>
2020-10-02 07:31:11 -03:00
Håkon Øye Amundsen 6a8dbbadf7 boot: zephyr: reset SPLIM registers before boot
to avoid causing stack overflow in the image being booted.

Signed-off-by: Håkon Øye Amundsen <haakon.amundsen@nordicsemi.no>
2020-10-01 15:01:21 +02:00
Håkon Øye Amundsen ee7282dc42 kconfig: zephyr: use ECDSA with CC310 if CC310 hw is present
This is the preferred signing type with this HW available.
Add 'ECDSA' to the kconfig name to align with the tinycrypt variant.
Remove superfluous checks on select operations.

Signed-off-by: Håkon Øye Amundsen <haakon.amundsen@nordicsemi.no>
2020-09-29 10:27:53 +02:00
Håkon Øye Amundsen 705c6c2b67 kconfig: zephyr: provide logic for setting key file, simplify prj.conf
Automate process of selecting correct .pem key file.

Zephyr users are familiar with using 'menuconfig' and similar tools
for seeing what options are available, so remove =n choices from
prj.conf which were used to show the available options.

Signed-off-by: Håkon Øye Amundsen <haakon.amundsen@nordicsemi.no>
2020-09-29 10:27:53 +02:00
Blaž Hrastnik 8097d86b2f Compile with MBEDTLS_CIPHER_MODE_CTR set.
Signed-off-by: Blaž Hrastnik <blaz@mxxn.io>
2020-09-28 09:08:44 -06:00
Andrzej Puzdrowski 03d96ad1f6 boot/zephyr: Added single-slot Zephyr-RTOS test build
Added configuration for build in Zephyr-RTOS CI MCUBoot
in CONFIG_SINGLE_APPLICATION_SLOT=y mode.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2020-09-16 12:09:43 +02:00
Andrzej Puzdrowski fdff3e1ea0 boot/zephyr: renamed single-image mode to single-application-slot mode
The terms "single-image boot" and the "single image application"
of Zephyr are confused. It might be might be understood as one-pair image
dual-bank mode in comparison to multi-image mode.

This patch replaces CONFIG_SINGLE_IMAGE_DFU by
CONFIG_SINGLE_APPLICATION_SLOT name,
which makes this mode name unambiguous.

fixes #800

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>

fix
2020-09-16 12:09:43 +02:00
Dominik Ermel 1422b4b8c8 zephyr: Fix serial recovery compilation warnings
Missing const on pointers to device structures caused compilation
warnings when compiling bootloader with serial recovery enabled.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2020-09-11 15:40:55 +02:00
Marek Pieta c1cdcae197 boot: zephyr: Fix build issue for multiple conf files
Change fixes build issue that occurs if CONF_FILE contains multiple
file paths instead of single file path.

Signed-off-by: Marek Pieta <Marek.Pieta@nordicsemi.no>
Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2020-09-10 14:02:37 +02:00
Arvid Rosén 9ed399cd6d zephyr: Turn off cache for Cortex M7 before chain-loading. The new image will fail otherwise.
Signed-off-by: Arvid Rosén <arvid@softube.com>
2020-09-09 14:36:33 +02:00
Fabio Utzig 0b6b51f5d1 zephyr: struct device const-ification
Follows up the change added to Zephyr with:

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

Signed-off-by: Fabio Utzig <fabio.utzig@nordicsemi.no>
2020-09-02 14:14:44 -03:00
Anas Nashif 74fc8ed1b5 sample: inclusive language: whitelist -> allow
Change whitelist->allow to be compatible with sanitycheck in zephyr.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-08-26 22:10:17 -03:00
David Vincze 5a6e18148d zephyr: Add direct-xip mode to Zephyr configuration
Add direct-xip mode to Zephyr configuration and make
upgrade mode selection always explicit.

Change-Id: Ia8e788f0b7bc801b6d45fd86f56c17ca6839f9c9
Co-authored-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
Signed-off-by: David Vincze <david.vincze@linaro.org>
2020-08-12 09:39:44 +02:00
Marek Pieta bdcfc859d4 boot: zephyr: Use private key
Change adds using own private key for MCUBoot bootloader.

Signed-off-by: Marek Pieta <Marek.Pieta@nordicsemi.no>
2020-08-05 09:01:41 +02:00
Carles Cufi 1cb076c247 zephyr: serial: Align with new callback signature
Align the code to the new UART callback signature, see:

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

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2020-07-31 12:14:17 -03:00
Rafał Kuźnia 505c6e6ac4 boot/zephyr: set VTOR to relay vector before chain-load
If software IRQ relay is enabled and VTOR is available,
the bootloader will switch from its real vector table
to the relay vector table before chain-loading to the
application.

Signed-off-by: Rafał Kuźnia <rafal.kuznia@nordicsemi.no>
Signed-off-by: Krzysztof Taborowski <krzysztof.taborowski@nordicsemi.no>
Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2020-07-23 10:21:26 +02:00
Jared Wolff a25c94155c boot: zephyr: boards: add Circuit Dojo nRF9160 Feather board
Add Circuit Dojo nRF9160 Feather board configuration
for DFU button operation.

Signed-off-by: Jared Wolff <hello@jaredwolff.com>
2020-07-19 16:32:10 -03:00
Rafał Kuźnia d854bb6659 boot/zephyr: add option to relocate interrupts to application
If CONFIG_BOOT_INTR_VEC_RELOC is set, the mcuboot will
relocate the interrupt vector to the booted application.

Signed-off-by: Rafał Kuźnia <rafal.kuznia@nordicsemi.no>
2020-06-23 15:25:29 -06:00
Torsten Rasmussen 33fbef51c0 cmake: scripts: now using ZEPHYR_BASE as local variable
This commit is a followup to the usage of `find_package(Zephyr ...)`.

The zephyr/hello-world sample has been updated to use find_package.
The assemble.py script now takes ZEPHYR_BASE as an argument, so it may
be used from CMakeLists.txt files when ZEPHYR_BASE is not set in
environment, and thus the Makefile sample has been adjusted accordingly.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2020-06-15 15:27:48 +02:00
Dominik Ermel 9b48d08dfc boot/zephyr: Fix single image compilation with serial recovery
Fixes mistake in CMakeLits.txt that prevented successful compilation
of single image with serial recovery enabled.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2020-06-08 10:18:32 -03:00
Andrzej Puzdrowski 97e966a226 zephyr: fix zephyr testcase extra_tags
dtc overlay should be transfered via DTC_OVERLAY_FILE,
not by DTC_OVERLAY.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2020-06-05 13:30:40 -06:00
Dominik Ermel 4dc3f442d7 boot/zephyr: Kconfig changes supporting single image DFU
Modifications to Kconfig that add option for selection of single image
DFU and disable incompatible options.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2020-06-04 13:50:34 -06:00
Dominik Ermel 8101c0cd4e boot/zephyr: Allow single image applications
The change enables usage of single image applications. This can be used
when user does not need multiple boot images and wants to use more flash
are for main application or other purposes.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2020-06-04 13:50:34 -06:00
Kumar Gala 0813efeac6 zephyr: Convert from Zephyr to C99 types
Use C99 types in favor of the Zephyr defined types.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-06-04 08:28:35 -06:00
Andrzej Puzdrowski 16b6d15a6b zephyr/Kconfig: cleanup mcuboot menuconfig
A few mcuboot option were outside of mcuboot-specific
menu.
This patch moves them into mcuboot menu.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2020-06-01 09:36:28 -06:00
Torsten Rasmussen 43004b8541 cmake: use find_package to locate Zephyr
Using find_package to locate Zephyr.

Old behavior was to use $ENV{ZEPHYR_BASE} for inclusion of boiler plate
code.

Whenever an automatic run of CMake happend by the build system / IDE
then it was required that ZEPHYR_BASE was defined.
Using ZEPHYR_BASE only to locate the Zephyr package allows CMake to
cache the base variable and thus allowing subsequent invocation even
if ZEPHYR_BASE is not set in the environment.

It also removes the risk of strange build results if a user switchs
between different Zephyr based project folders and forgetting to reset
ZEPHYR_BASE before running ninja / make.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2020-06-01 12:45:38 +02:00
Joakim Andersson b0890aeaa4 kconfig: Update to CONFIG_FLOAT to CONFIG_FPU rename in zephyr
Update CONFIG_FLOAT to CONFIG_FPU which has been renamed in zephyr.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2020-05-22 10:10:13 -06:00
Andrzej Puzdrowski 7024340b66 zephyr: Change DT_FLASH_AREA_ macros to FLASH_AREA for multimage
Use the new FLASH_AREA_ macros.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2020-05-15 15:11:56 -06:00
Kumar Gala 6e26e38585 zephyr: Change DT_FLASH_AREA_ macros to FLASH_AREA_
As we replace the legacy DT_FLASH_ support use the new FLASH_AREA_
macros.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2020-05-15 15:11:56 -06:00
Arvin Farahmand fb5ec1877d zephyr: add option to disable cryptographic check of the image
- Add Kconfig option `CONFIG_BOOT_SIGNATURE_TYPE_NONE`. When y,
  The bootloader will not verify the cryptographic signature of the image
  at boot or prior to upgrade. Image integrity check is retained.

  Images would still need to be processed using `imgtool` however no key
  should be provided to skip cryptographic signature generation.

Signed-off-by: Arvin Farahmand <arvinf@ip-logix.com>
2020-05-15 12:07:20 -06:00
Kumar Gala 9a5b95158e zephyr: convert DT_JEDEC_SPI_NOR_0_LABEL to new dt macros
As the DT define DT_JEDEC_SPI_NOR_0_LABEL is intended to be deprecated
move to the new macro style to determine for DT_JEDEC_SPI_NOR_0_LABEL

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-05-04 13:34:11 -06:00
Kumar Gala 32b61f333b zephyr: Replace DT_FLASH_DEV_NAME with DT_CHOSEN_ZEPHYR_FLASH_CONTROLLER_LABEL
As upstream zephyr is phasing out DT_FLASH defines for non-partition
usage replace DT_FLASH_DEV_NAME with
DT_CHOSEN_ZEPHYR_FLASH_CONTROLLER_LABEL.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-05-04 13:34:11 -06:00
Andrzej Puzdrowski f4a9a9d7e9 zephyr/Kconfig: reference missing new Nordic boards keywords
Updated boards reference names.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2020-04-30 13:25:54 +02:00
Gerson Fernando Budke 87f50a5667 zephyr: boards: Add disco_l475_iot1 config file
The STM32L475 needs BOOT_MAX_IMG_SECTORS equal 256 to work properly.
This add a config file to change default value from 128 to 256 once
there isn't a proper way to handle using Device Tree.

fixes zephyrproject-rtos/zephyr/issues/24243

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2020-04-11 11:58:43 -03:00
Fabio Utzig b6f014c4bc boot: zephyr: add ECIES-X25519 support
Signed-off-by: Fabio Utzig <utzig@apache.org>
2020-04-10 17:56:14 -03:00
David Vincze 03368b8bec boot: Add hardware key support
This change enables the public key (used for image authentication) to
be removed from MCUboot and be appended to the image instead. In this
case the key or its hash must be provisioned to the device and MCUboot
must be able to retrieve the key-hash from the hardware to compare it
with the calculated hash of the public key from the image manifest in
order to verify its validity before image authentication.

The source of this change:
https://review.trustedfirmware.org/c/trusted-firmware-m/+/1581

Change-Id: I36fe699732e0e4c113eaed331c22e707c722ed6e
Signed-off-by: David Vincze <david.vincze@linaro.org>
2020-04-07 09:20:13 -06:00
Andrzej Puzdrowski 41c5d50ec7 zephyr:boards nrf52840_pca10059 rename to nrf52840dongle_nrf52840
Board was renamed here:
zephyrproject-rtos/zephyr#24049

Patch aligns the name in MCUBoot.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2020-04-06 11:14:25 +02:00
Piotr Mienkowski a5046693a2 zephyr: arm_cleanup.c: use <.../cortex_m/cmsis.h>
Use <arch/arm/aarch32/cortex_m/cmsis.h> include instead of <zephyr.h> to
get access to Cortex-M CMSIS API. zephyr.h provides kernel API, does not
guarantee access to CPU internals.

Fixes: #699 "Building MCUBoot for Zephyr fails on multiple ARM boards"

Signed-off-by: Piotr Mienkowski <piotr.mienkowski@gmail.com>
2020-04-02 12:51:07 +02:00
Andrzej Puzdrowski fefdea20d2 zephyr:boards nrf52840_pca10056 rename to nrf52840dk_nrf52840
Board was renamed here:
https://github.com/zephyrproject-rtos/zephyr/pull/23524/

Patch aligns the name in MCUBoot and decouples one of nrf52840 dedicated
overlay from exact board name.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2020-03-27 15:35:23 -06:00
David Vincze 1cf11b5feb boot: Define interface for data sharing with runtime
Define interface for sharing boot status (certain attributes of the
authenticated images) and adding arbitrary data in TLV encoded format
to a shared data area between the bootloader and runtime SW.

The boot_record.h file was copied (with minor modifications) from the
Trusted Firmware-M project (https://www.trustedfirmware.org/about/).
Hash of the source commit: 08d5572b4bcee306d8cf709c2200359a22d5b72c.

Change-Id: Ia25bac27e9f1ce7faa5043c5a0455c804a24701e
Signed-off-by: David Vincze <david.vincze@arm.com>
2020-03-26 12:23:36 +01:00
Dominik Ermel 1084100cf4 zephyr: TinyCBOR has been removed from interface libraries
It is no longer needed to add TINYCBOR to list of interface libraries.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2020-03-25 06:13:05 -03:00
Marcin Niestroj c6be76aed2 zephyr: select USE_DT_CODE_PARTITION after kconfig option change
Zephyr commit [1] has changed kconfig option name. Update kconfig
selection to the new one.

[1] 90b9eb3a9e93 ("kconfig: Rename USE_CODE_PARTITION to
  USE_DT_CODE_PARTITION")

Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
2020-03-24 13:18:44 -06:00
Krzysztof Chruscinski 821214e373 zephyr: Wrap sleep value with K_MSEC
Zephyr timeout API is changing and will use opaque value (k_timeout_t)
instead of raw values. K_MSEC is used to convert raw milliseconds value
to k_timeout_t.

This change is backward compatible so can be merged independently.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2020-03-24 13:16:40 -06:00
Øyvind Rønningstad f42a8205e8 serial_recovery: Replace CBOR decoding code with generated code
- Add the cddl_gen repository as a submodule.
 - Add a CDDL description file for the serial recovery packets to be
   decoded.
 - Add generated code files and cddl_gen's CBOR library to CMakeList.txt
   for Zephyr.
 - Convert boot_serial.c to use the new code.
 - Add a bash script to (re)generate code files using cddl_gen.py.

Serial recovery should work exactly as before, but the binary should be
about 1k smaller.

Signed-off-by: Øyvind Rønningstad <oyvind.ronningstad@nordicsemi.no>
2020-03-24 13:10:17 -06:00