Commit Graph

317 Commits

Author SHA1 Message Date
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
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
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 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
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
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