Commit Graph

125 Commits

Author SHA1 Message Date
Marcin Niestroj 9ced459b09 boot: zephyr: fix s/junping/jumping/ typo
Fix typo in Kconfig help text by s/junping/jumping/.

Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
2023-05-22 07:41:43 +01:00
Jeppe Odgaard 1dbe0cf0a5 boot: zephyr: Use mcuboot-led0 in MCUBOOT_INDICATION_LED help section
bootloader-led0 is deprecated. Replace with mcuboot-led0 in
MCUBOOT_INDICATION_LED help.

Signed-off-by: Jeppe Odgaard <jeppe.odgaard@prevas.dk>
2023-05-22 07:41:23 +01:00
Marek Matej 6769344276 boot: zephyr: esp32: zephyr port
Add support for ESP32xx targets to build
as Zephyr application.

Signed-off-by: Marek Matej <marek.matej@espressif.com>
2023-04-27 20:30:35 -03:00
Marek Pieta a95a41b3e1 boot: bootutil: loader: Let image version comparison use build number
Change allows using build number in image version comparison.

Signed-off-by: Marek Pieta <Marek.Pieta@nordicsemi.no>
2023-04-25 12:04:27 +02:00
Dominik Ermel 143485e35b zephyr: Add missing Kconfig dependencies for USB DFU
USB DFU depends on MULTITHREADING and STREAM_FLASH, and these
should be explicitly selected.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2023-03-17 15:30:58 +01:00
Jamie McCrae 9551b6ef03 boot: zephyr: Remove deprecated GPIO Kconfig entries
Removes the old deprecated Kconfig items for configuring GPIO ports
and pins for entering serial recovery/USB DFU mode. These were
deprecated almost a year ago and should not be used as device tree
has long replaced them.

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2023-03-13 13:22:37 +01:00
Jamie McCrae 9e8eddcecb boot: zephyr: Clean up before chainloading by default
This changes the default mcuboot configuration for zephyr
applications to clean up before booting the user application. The
reason for this change is that mcuboot may configure protection (e.g.
MPU stack guard) which is then used by the user application during
its startup code prior to cleaning the configuration up, this can
lead to a unbootable application and potentially irrecoverable
module, therefore cleaning up is now being enabled by default.

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2023-02-27 15:20:50 +01:00
Jamie McCrae 9315654d79 zephyr: Disable and deprecate flash erase
This deprecates the flash erase Kconfig for zephyr, if this action
is required then the board should be flashed using west with the
`--erase` argument supplied instead.

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2023-02-14 10:48:27 +01:00
Thomas Stranger aa217e2313 boot: zephyr: prefer swap move if scratch_partition not enabled
With the exception of nrf targets BOOT_SWAP_USING_SCRATCH mode was
still the default algorithm.

Changing the preferred mode in cases where no scratch_partition is
defined will allow successfully building mcuboot for such boards w/o
the need for any board specific overlays.

Signed-off-by: Thomas Stranger <thomas.stranger@outlook.com>
2022-11-14 14:38:41 +01:00
Jerzy Kasenberg b8801fc0ac zephyr/Kconfig: Add downgrade prevention to swaps
Downgrade prevention for swap upgrades that was added to
mcuboot is now configurable in zephyr.

It may be using software version number from image in slot 0,
or security counter from the image in slot 0 (for limited downgrade
availability).

Hardware base security counter check remains unchanged.

Signed-off-by: Jerzy Kasenberg <jerzy.kasenberg@codecoup.pl>
2022-10-04 08:52:57 -06:00
Andrzej Puzdrowski b25ba4bfa5 zephyr/Kconfig: fixed BOOT_WATCHDOG_FEED default value
This property should be enabled by default only when watchdog
driver is available.
This fixed build with pristine configuration on targets
with CONFIG_WATCHDOG=n.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2022-09-28 15:45:27 -06:00
David Brown 08a30a4158 zephyr: Add a bool Kconfig option for swap move
The Kconfig system used by Zephyr does not allow the defaults for choice
options to be overridden.  To compensate for this, create a new boolean
config option that will determine what the default is for the boot mode.

This allows the kconfig override file for various Zephyr boards to
change the default to swap move.

Signed-off-by: David Brown <david.brown@linaro.org>
2022-09-23 17:19:26 +02:00
Marek Pieta 2fa1190ff3 boot: zephyr: Add default values of boot detect pins
Change introduces default values of CONFIG_BOOT_SERIAL_DETECT_PIN
and CONFIG_BOOT_USB_DFU_DETECT_PIN. This is needed to prevent build
issues caused by uninitialized Kconfig.

Signed-off-by: Marek Pieta <Marek.Pieta@nordicsemi.no>
2022-09-13 16:33:43 +02:00
Bartosz Bilas a1c8c8e632 boot: zephyr: enable watchdog feed by default
Since we have support for nRF and STM32 families,
and non-vendor watchdog implementation let's enable
this functionality by default.
Imply NRFX_WDT && NRFX_WDT0 && NRFX_WDT1 only when
SOC_FAMILY_NRF is being used.

Signed-off-by: Bartosz Bilas <bartosz.bilas@hotmail.com>
2022-09-02 13:08:07 -03:00
Andrzej Puzdrowski 1c150c6092 zephyr: direct inclusion of the hooks file
This patch removes CONFIG_BOOT_IMAGE_ACCESS_HOOKS_FILE option
which was used to point to hooks implementation file.
It is better that the project customization is up to add required
files instead. This gives more flexibility in provisioning these
sources (there may be multiple files).
This also simplifies Kconfig options.

In order to keep possibility for build-test the Hooks feature
hooks_sample.c will be included into the build if commandline
will specify -DTEST_BOOT_IMAGE_ACCESS_HOOKS=Y option.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2022-08-04 11:17:19 +02:00
Andrzej Puzdrowski c5faf43130 zephyr/Kconfig: deprecation of pin configuration
Added note of deprecation of hardware properties of
the gpio-pin used for triggering the recovery DFU modes.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2022-06-08 15:23:38 +02:00
Jamie McCrae 56cb610806 boot: zephyr: Add MCUboot status callback support
Adds an optional callback when the MCUboot status changes which can
allow components to react.

Signed-off-by: Jamie McCrae <jamie.mccrae@lairdconnect.com>
2022-05-31 12:27:48 -06:00
Johan Öhman b588907ab1 zephyr: Wrapped the RAM loading mode in Zephyr configs.
The RAM loading mode wasn't wrapped in Zephyr configs like the other boot modes.
Added a config to enable RAM loading as well as two configs to set
IMAGE_EXECUTABLE_RAM_START and IMAGE_EXECUTABLE_RAM_SIZE, respectively. These
two values default to the values from the chosen node sram in the dts.

Signed-off-by: Johan Öhman <johan.ohman@softube.com>
2022-05-31 10:20:19 -06:00
Andrzej Puzdrowski 35f61d305d zephyr/Kconfig: own Kconfig file for serial recovery
Moved Serial recovery options to own Kconfig
file.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2022-04-05 11:43:28 +02:00
Andrzej Puzdrowski 6c00b5e52e zephyr/Kconfig: fix CONFIG_MCUBOOT_INDICATION_LED usage
This option was reserved for serial recovery mode, while
it should be available for USB DFU as well.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2022-04-05 11:43:28 +02:00
Wouter Cappelle e3ff17535c Add support for the mcumgr echo command in serial boot mode
Signed-off-by: Wouter Cappelle <wouter.cappelle@crodeon.com>
2022-02-22 09:27:57 -07:00
Wouter Cappelle e3822f8180 boot_serial: zephyr: Add optional timeout to enter serial recovery
This PR adds the possibility to only enter the bootloader's
serial recovery mode when a mcumgr command is received within a
given timeout.

Signed-off-by: Wouter Cappelle <wouter.cappelle@crodeon.com>
2022-02-09 16:20:58 -07:00
Wouter Cappelle bb7a39d114 Add config option for caching of validation state of an image in primary slot for single loader
Signed-off-by: Wouter Cappelle <wouter.cappelle@crodeon.com>
2022-02-09 13:31:56 -07:00
Wouter Cappelle 953a76180d Add support for signed images in single loader mode
Signed-off-by: Wouter Cappelle <wouter.cappelle@crodeon.com>
2022-01-13 14:05:30 -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
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
Dominik Ermel d4c2d15c3e zephyr: Remove BOOT_SERIAL_UART dependency from ENABLE_MGMT_PERUSER
The dependency, in Kconfig,  blocked usage of the ENABLE_MGMT_PERUSER
with other BOOT_SERIAL_ device options.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2021-09-03 15:16:52 -06:00
Johann Fischer a6e1e9e339 zephyr: get CDC ACM UART device from devicetree
Adapt to Zephyr OS changes to get CDC ACM UART device.
Remove RECOVERY_UART_DEV_NAME Kconfig option and
use DEVICE_DT_GET() in serial_adapter.c

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2021-08-27 15:21:39 +02:00
Andrzej Puzdrowski 914204db41 boot/zephyr: Kconfig for hooks enabling
Added global property which allows to enable hooks
implementations.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2021-08-26 16:22:04 -06:00
Andrzej Puzdrowski 5cf941013f zephyr/Kconfig: fix deadlock on cryptolib selectors
If user generate project and the will try to switch signature type
then it is very likely that MBETLS will be enabled simultaneously when
tinycrypt has to be force-selected, which causes kconfig warning on
impossible configuration. Such configuration won't be possible to be
fixed using menuconfig etc.

This patch moves dependency check on !MBEDTLS from kconfig to preprocessor
which makes manual fixing using menuconfig possible.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2021-08-26 15:26:16 +02:00
Johann Fischer 25852971db zephyr: remove Kconfig option CONFIG_USB
USB device support configuration is revised,
CONFIG_USB option is deprecated.
Only USB_DEVICE_STACK option should be used to
enable USB device support.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2021-08-19 17:15:50 -06:00
Dominik Ermel 0435d5d9b7 zephyr: Add option for enabling the storage erase command
The commit adds Kconfig option that enables the storage erase mgmt
command.
Addition of the Kconfig option fixes the problem where Zephyr spcyfic
mgmt commands support fails to compile when board does not define
a storage partition.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2021-08-19 11:12:38 +02:00
Andrzej Puzdrowski 420ad9adbd zephyr/boot_serial_extension: kconfig of custom command for get images status
made he command implementation selectable.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2021-07-30 12:26:43 +02:00
Piotr Mienkowski 01c84425b6 zephyr: do not set defaults for LOG_IMMEDIATE Kconfig
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>
2021-07-30 09:39:50 +02:00
Martí Bolívar 994816d04a zephyr: Kconfig: fix board references
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>
2021-07-29 14:53:22 +02:00
Dominik Ermel 2ae1f16516 zephyr: Relocate BOOT_ERASE_PROGRESSIVELY option
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>
2021-07-21 09:33:45 +02:00
Dominik Ermel 6c8932e9d0 zephyr: Add support for direct image upload
The commit enables direct image upload for the Zephyr platform.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2021-07-16 13:24:26 -06:00
Dominik Ermel 97b4c79564 zephyr: Add processing of PERUSER mgmt group for serial recovery
The commit adds Zephyr specific function for processing commands
from PERUSER and above groups; current addition is command
that allows to erase storage partition.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2021-07-13 11:39:35 +02:00
Dominik Ermel 3d51e430a6 boot_serial: Add optional processing of PERUSER group
The commit adds optional processing of MGMT_GROUP_ID_PERUSER,
as defined by mcumgr library, and above; the processing requires
systems to provide own functions as these groups are system
specific.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2021-07-13 11:39:35 +02:00
Håkon Øye Amundsen f04aa54409 kconfig: add BOOT_SERIAL_DETECT pin for nrf52833DK
Add missing config for the nRF52833

Ref: NCSIDB-421

Signed-off-by: Håkon Øye Amundsen <haakon.amundsen@nordicsemi.no>
2021-06-07 11:06:19 +02:00
Øyvind Rønningstad 9f4aefd539 boot_serial: Port encoding to use cddl-gen
Non-generated. Using cbor_encode directly
This removes the dependence on TinyCBOR.

Fixes #978

Signed-off-by: Øyvind Rønningstad <oyvind.ronningstad@nordicsemi.no>
2021-05-25 11:52:38 -03:00
Jamie McCrae 10a8112089 zephyr: add Laird Connectivity BL5340 recovery pin
Signed-off-by: Jamie McCrae <jamie.mccrae@lairdconnect.com>
2021-05-07 12:20:47 -03:00
Josh Gao 837cf88f35 zephyr: add an option to use GPIO to enable USB DFU.
Devices with a physical reset button might prefer to use it to enter USB
DFU mode, instead of always entering it with a timeout. Extract the
existing CONFIG_BOOT_SERIAL_DETECT detection code and use it to enter
DFU mode when CONFIG_BOOT_USB_DFU_GPIO is enabled.

This commit depends on zephyrproject-rtos/zephyr#30015, which changes
wait_for_usb_dfu from a nullary function that waits for a compile-time
fixed amount of time, to one that takes a timeout.

Signed-off-by: Josh Gao <josh@jmgao.dev>
2021-03-16 12:48:41 -06:00
Jared Wolff df8e974ce8 boot: zephyr: adding indication LED and detect pin debounce
Setting LED to initial level before beginning.
Making comment about BOOT_SERIAL_DETECT_DELAY more clear in Kconfig.

Signed-off-by: Jared Wolff <hello@jaredwolff.com>
2021-02-08 19:42:07 +01:00
Jared Wolff 8e4d791839 boot: zephyr: adding indication LED and detect pin debounce
Add LED support and boot delay serial detect pin operation.

Signed-off-by: Jared Wolff <hello@jaredwolff.com>
2021-02-08 19:42:07 +01:00
Andrzej Puzdrowski f573b392ec bootutil: extracted app common library from bootutil_misc
Part of code of boot/bootutil/ is re-implemented in zephyr-rtos
repository.
As some code are defined here and there it becomes problem when
need to include it with outstanding feature in a build.
It is possible to mitigate problem using #fdefry - but this was
rather temporary hack.

This patch introduce new module which is common for MCUBoot build
and application build.
Common code were extracted to bootutil_public.c source file and
bootutil_public.h header

MCUboot also select DISABLE_MCUBOOT_BOOTUTIL_LIB_OWN_LOG Kconfig
option, as it must define log configuration on its own for all its
sourcecode.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2021-01-13 17:49:49 +01:00
Ole Sæther 83ec842609 zephyr/Kconfig: Added default pin for serial recovery mode for nRF5340DK
Added default pin for triggering serial recovery mode for nRF5340DK.

Ref: NCSDK-7085

Signed-off-by: Ole Sæther <ole.saether@nordicsemi.no>
Signed-off-by: Håkon Øye Amundsen <haakon.amundsen@nordicsemi.no>
2020-12-02 09:15:43 +01:00
Andrzej Puzdrowski 32342e7ade zephyr/Kconfig: allow xip-revert only for xip-mode
BOOT_DIRECT_XIP_REVER enable code which shall only be enabled
while BOOT_DIRECT_XIP=y.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2020-11-23 16:00:57 +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
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