Commit Graph

2160 Commits

Author SHA1 Message Date
dependabot[bot] e00f24baf6 build(deps): bump nokogiri from 1.12.5 to 1.13.8 in /docs
Bumps [nokogiri](https://github.com/sparklemotion/nokogiri) from 1.12.5 to 1.13.8.
- [Release notes](https://github.com/sparklemotion/nokogiri/releases)
- [Changelog](https://github.com/sparklemotion/nokogiri/blob/main/CHANGELOG.md)
- [Commits](https://github.com/sparklemotion/nokogiri/compare/v1.12.5...v1.13.8)

---
updated-dependencies:
- dependency-name: nokogiri
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Signed-off-by: Fabio Utzig <utzig@apache.org>
2022-09-05 17:48:58 -03:00
dependabot[bot] 45811234d8 build(deps): bump tzinfo from 1.2.9 to 1.2.10 in /docs
Bumps [tzinfo](https://github.com/tzinfo/tzinfo) from 1.2.9 to 1.2.10.
- [Release notes](https://github.com/tzinfo/tzinfo/releases)
- [Changelog](https://github.com/tzinfo/tzinfo/blob/master/CHANGES.md)
- [Commits](https://github.com/tzinfo/tzinfo/compare/v1.2.9...v1.2.10)

---
updated-dependencies:
- dependency-name: tzinfo
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Signed-off-by: Fabio Utzig <utzig@apache.org>
2022-09-05 17:48:58 -03:00
Andrés Sánchez Pascual 414ac87cfd boot: nuttx: main: add suport for board late
initialization.

When using nuttx MCUBoot app as a main entry point in
place of nsh_main it is necesary to perform board-specific
driver initialization through boardctl().

Signed-off-by: Andrés Sánchez Pascual <tito97_sp@hotmail.com>

boot: nuttx: main: fix minor errors according

Signed-off-by: Andrés Sánchez Pascual <tito97_sp@hotmail.com>
2022-09-05 15:50:06 -03:00
Mike Szczys a93188e7bb boot: zephyr: Configure mimxrt1060_evkb boards
Configure larger slots on the mimxrt1060_evkb

Signed-off-by: Mike Szczys <mike@golioth.io>
2022-09-03 14:37:27 -03: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
Dominik Ermel 245de8156d bootutil: Add missing flash_area_close
boot_remove_image_from_flash has been missing flash_area_close.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2022-09-02 12:59:00 -03:00
Bartosz Bilas a83715ba54 boot: zephyr: return NULL if stm32 watchdog is not enabled
Return the device pointer if the node identifier
refers to a watchdog node with status “okay”,
otherwise return NULL.

Signed-off-by: Bartosz Bilas <bartosz.bilas@hotmail.com>
2022-09-01 21:38:10 -03:00
Bartosz Bilas 71ae335750 ci: zephyr: update to Zephyr SDK 0.15.0
Updates the CI workflows to use the Zephyr SDK 0.15.0 for
building and testing Zephyr in the CI.

Fixes:
  E: CMake Error at cmake/modules/verify-toolchain.cmake:79 (find_package):
  Could not find a configuration file for package "Zephyr-sdk" that is
  compatible with requested version "0.15".

  The following configuration files were considered but not accepted:

Signed-off-by: Bartosz Bilas <bartosz.bilas@hotmail.com>
2022-08-31 14:32:57 -03:00
Bartosz Bilas be7e2b1a54 ci: zephyr: switch to CI image 0.24.2
Let's bump CI image to be up-to-date with the upstream.

Signed-off-by: Bartosz Bilas <bartosz.bilas@hotmail.com>
2022-08-31 14:32:57 -03:00
heinwessels 66cdd46b44 zephyr: flash: support 32byte block write size
Signed-off-by: heinwessels <heinwessels93@gmail.com>
2022-08-28 19:16:11 -03:00
Andrés Sánchez Pascual 1595488a92 Update for C++ compiler compatibility
Update flash_map_backend.h to be compatible with a C++ compiler

Signed-off-by: Andrés Sánchez Pascual <tito97_sp@hotmail.com>
Signed-off-by: GitHub <noreply@github.com>
2022-08-23 19:10:44 +02:00
Alexander Mihajlovic f4df58f347 imgtool: Fix output of confirmed image in HEX format
The image_ok was written to the wrong offset
when outputting HEX format. This commit fixes that.

Drive-by change: Use actual length of boot magic
instead of assuming it's 16 bytes long.

Signed-off-by: Alexander Mihajlovic <alexander@eub.se>
2022-08-22 10:56:12 +02:00
Kumar Gala 02a3edd24f zephyr: Remove devicetree 'label' property from flash nodes
zephyr is transition away from devicetree label property for nodes
that are associated with devices.  So remove it from flash nodes.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-08-16 16:50:03 +02:00
Piotr Dymacz 067f30ae96 boot_serial: explain disabled idle state in timeout based recovery
This adds short explanation (in form of a comment) why CPU shouldn't
enter idle state in timeout based serial recovery.

Ref: 3942e9bf8f ("boot_serial: fix serial recovery mode with timeout")
Signed-off-by: Piotr Dymacz <pepe2k@gmail.com>
2022-08-13 16:02:53 +02:00
Piotr Dymacz 3942e9bf8f boot_serial: fix serial recovery mode with timeout
If 'BOOT_SERIAL_WAIT_FOR_DFU' is selected, the CPU shouldn't enter idle
state, waiting for interrupt from the console because we expect booting
if no mcumgr command is received within a configured timeout (with the
'CONFIG_BOOT_SERIAL_WAIT_FOR_DFU_TIMEOUT').

Without this fix, when using 'BOOT_SERIAL_WAIT_FOR_DFU' the boot process
hangs forever, waiting for input from console.

Fixes: e3822f8180 ("boot_serial: zephyr: Add optional timeout to enter serial recovery")
Signed-off-by: Piotr Dymacz <pepe2k@gmail.com>
2022-08-12 13:35:51 +02:00
Kumar Gala 5130d1dcca zephyr: Remove devicetree 'label' property
zephyr is transition away from devicetree label property for nodes
that are associated with devices.  So remove it from
"zephyr,cdc-acm-uart" nodes.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-08-12 11:18:24 +02:00
Bartosz Bilas b03c098534 boot: zephyr: get rid of device_get_binding for stm32 watchdog
Replace the `device_get_binding` usage with
a `DEVICE_DT_GET` which is being deprecated in the upstream zephyr.

Signed-off-by: Bartosz Bilas <b.bilas@grinn-global.com>
2022-08-04 17:17:33 +02: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
Stephanos Ioannidis 09e2bd70fd boot_serial: Fix incorrect format specifier for off_t
The `BOOT_LOG_INF` function, which uses the format specifiers defined
by the C standard, was incorrectly printing a variable with the type of
`off_t` using the `%x` format specifier, which is intended to be used
with the `int` type.

The `off_t` type, specified by the POSIX standard, is not guaranteed to
be `int`, and it may be defined as `long` or `long long` depending on
the toolchain and the target architecture.

This commit updates the print routine such that it casts the arguments
of the `off_t` type to `intmax_t` and prints them out using the
corresponding `%jx` format specifier.

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
2022-08-04 09:28:17 +02:00
Bartosz Bilas b4c04d3393 boot: zephyr: add support for generic watchdog alias
Add possibility to pass generic watchdog alias
no matter what vendor is used.

Signed-off-by: Bartosz Bilas <b.bilas@grinn-global.com>
2022-08-03 17:08:22 +02:00
Kumar Gala 8eadf8c2d0 zephyr: remove flash_device_get_binding
remove flash_device_get_binding as we can utilizes DEVICE_DT_GET to
get the flash_dev pointer set at build time.  This removes usage of
device_get_binding and handles the lack of 'label' properties in
the devicetree better.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-07-29 09:05:29 +02:00
Martin Jäger 3175182f81 boot: zephyr: main: fix log_process call after Zephyr change
The legacy logging subsystem was removed in below commit:
https://github.com/zephyrproject-rtos/zephyr/commit/c5f2cde

This commit maintains compatibility with Zephyr upstream before
and after the change by using the now removed CONFIG_LOG1 and
CONFIG_LOG2 defines.

Signed-off-by: Martin Jäger <martin@libre.solar>
2022-07-27 08:02:11 +02:00
Martin Jäger 477ed816ec boot: zephyr: main: fix indentation
No functional changes.

Signed-off-by: Martin Jäger <martin@libre.solar>
2022-07-27 08:02:11 +02:00
Fabio Baltieri 888e261a76 boot_serial: add "zephyr/" prefix to __ZEPHYR__ includes
Add relevant "zephyr/" prefixes to allow building with the Zephyr
option CONFIG_LEGACY_INCLUDE_PATH=n.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2022-07-26 19:20:21 +02:00
Dominik Ermel 864d104e42 boot_serial: zephyr: Fix zcbor encoding in extensions
Extensions missed cddl to zcbor update and were not compiling.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2022-07-26 16:33:19 +02:00
Andrzej Puzdrowski f1fd225bbb zephyr: disable qspi-nor on nrf52840
Sine https://github.com/zephyrproject-rtos/zephyr/pull/47629 was
merged the qspi nod driver is enabled by default. This cause unwanted
flash footprint rise for configurations which are not using the qspi.

This patch disables it back.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2022-07-26 09:52:01 -03:00
Almir Okato e8cbc0d0f1 boot_serial: espressif: ESP32 serial recovery mode interface
Add the serial adapter for ESP32 for boot recovery and MCUMGR
communication.

Signed-off-by: Almir Okato <almir.okato@espressif.com>

espressif: Configure console via bootloader_support functions

Signed-off-by: Gustavo Henrique Nihei <gustavo.nihei@espressif.com>
2022-07-19 11:07:04 -03:00
Gustavo Henrique Nihei 1eb3ecaeda espressif: Fix flash_area_write support for unaligned write accesses
Signed-off-by: Gustavo Henrique Nihei <gustavo.nihei@espressif.com>
Signed-off-by: Almir Okato <almir.okato@espressif.com>
2022-07-19 11:07:04 -03:00
Daniel DeGrasse 78517dbf2e zephyr: boards: add support for RT1160 and RT1170 CM7 cores
add support for RT1170 and RT1160 CM7 cores, which have large flash
sizes and require an increase to the value of BOOT_MAX_IMG_SECTORS

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-07-08 16:40:04 +02:00
David Brown 2221143936 ptest: Update dependencies
Update some of the dependencies to newer versions, and run `cargo
update`.  This will resolve some potential security warnings about
issues found in older versions of dependencies.  I don't believe any of
these affect this code.

Signed-off-by: David Brown <david.brown@linaro.org>
2022-06-28 17:35:01 -06:00
Szymon Janc 1270880d2f boot_serial: Fix compilation due to danling pointer
repos/mcuboot/boot/boot_serial/src/zcbor_decode.c:341:52: error:
     dangling pointer ‘result’ to ‘dummy’ may be used
     [-Werror=dangling-pointer=]
  341 |         state->payload_end = result->value + result->len;
      |                                              ~~~~~~^~~~~
repos/mcuboot/boot/boot_serial/src/zcbor_decode.c:325:37: note: ‘dummy’
     declared here
  325 |                 struct zcbor_string dummy = {};
      |                                     ^~~~~
repos/mcuboot/boot/boot_serial/src/zcbor_decode.c:341:36: error:
     dangling pointer ‘result’ to ‘dummy’ may be used
     [-Werror=dangling-pointer=]
  341 |         state->payload_end = result->value + result->len;
      |                              ~~~~~~^~~~~~~
repos/mcuboot/boot/boot_serial/src/zcbor_decode.c:325:37: note: ‘dummy’
     declared here
  325 |                 struct zcbor_string dummy = {};
      |                                     ^~~~~
cc1: all warnings being treated as errors

Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
2022-06-27 14:28:45 -06:00
Szymon Janc 1cd3196400 boot_serial: Fix Mynewt tests compilation
repos/mcuboot/boot/boot_serial/test/src/testcases/
    boot_serial_upload_bigger_image.c: In function
     ‘TEST_CASE_boot_serial_upload_bigger_image’:
repos/mcuboot/boot/boot_serial/test/src/testcases/
    boot_serial_upload_bigger_image.c:91:42: error:
     ‘Value8Bit’ undeclared (first use in this function)
91 | buf[payload_off + len - 2] = Value8Bit;
| ^~~~~~~~~

Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
2022-06-27 14:26:39 -06:00
Andrzej Puzdrowski f10d13aeaa zephyr: dropped __BOOTSIM__ ifdef-ry from the port
Since #1383 the configuration translation header and
the logging translation header are not used by the simiulator.

Thanks to that __BOOTSIM__ dependence might be removed - what is done
in this patch.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2022-06-23 14:33:33 +02:00
Dominik Ermel 7d2f0bf425 boot_serial: Refactoring writes
The commit reduces write logic.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2022-06-23 09:40:56 +02:00
Dominik Ermel bcc17b4575 boot_serial: Refactoring of erase logic
The progressive erase and non-progressive erase code has been
refactored; some additional comments have been added to logic.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2022-06-23 09:40:56 +02:00
Dominik Ermel 2f2b31cb90 boot_serial: Remove unneeded carriage return at the end of frame
The correct end of SMP frame, over console, is single '\n'.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2022-06-22 14:35:42 +02:00
Dominik Ermel 5bd8744e89 boot_serial: Refactoring variables used in image upload
Types of a few variables have been changed to more align with
what they represent; variables have been renamed to make their
purpose more clear.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2022-06-22 14:25:09 +02:00
Gerard Marull-Paretas 34dd9e707d zephyr: use <zephyr/kernel.h>
<zephyr/zephyr.h> is just a shim to the <zephyr/kernel.h> header, better
use it directly as it is explicit that Kernel APIs are being included.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2022-06-16 21:47:43 +02:00
Gerard Marull-Paretas 3cd2cece69 zephyr: migrate includes to <zephyr/...>
Zephyr has prefixed all of its includes with <zephyr/...>. While the
_old_ mode can still be used (CONFIG_LEGACY_INCLUDE_PATH) and is still
enabled by default, it's better to be prepared for its removal in the
future.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2022-06-16 21:47:43 +02:00
Marcin Niestroj 65e1314058 zephyr: remove MBEDTLS_ECP_MAX_BITS from mbedTLS configs
According to mbedTLS' Changelog "Mbed TLS 3.0.0 branch released
2021-07-07" -> "Removals":

   MBEDTLS_ECP_MAX_BITS is no longer a configuration option because it
   is now determined automatically based on supported curves.

Hence remove MBEDTLS_ECP_MAX_BITS from configuration files to fix build
issues with Zephyr when there is unfortunate order of include
statements, like:

  /__w/zephyr/zephyr/modules/mbedtls/zephyr_init.c
  In file included from /__w/zephyr/modules/crypto/mbedtls/include/mbedtls/ssl.h:30,
                   from /__w/zephyr/modules/crypto/mbedtls/include/mbedtls/debug.h:27,
                   from /__w/zephyr/zephyr/modules/mbedtls/zephyr_init.c:16:
  /__w/zephyr/modules/crypto/mbedtls/include/mbedtls/ecp.h:314: error: "MBEDTLS_ECP_MAX_BITS" redefined [-Werror]
    314 | #define MBEDTLS_ECP_MAX_BITS 1
        |
  In file included from /__w/zephyr/bootloader/mcuboot/boot/zephyr/include/mcuboot-mbedtls-cfg.h:25,
                   from /__w/zephyr/modules/crypto/mbedtls/include/mbedtls/build_info.h:59,
                   from /__w/zephyr/modules/crypto/mbedtls/include/mbedtls/debug.h:25,
                   from /__w/zephyr/zephyr/modules/mbedtls/zephyr_init.c:16:
  /__w/zephyr/bootloader/mcuboot/boot/zephyr/include/config-rsa.h:72: note: this is the location of the previous definition
     72 | #define MBEDTLS_ECP_MAX_BITS             2048
        |
  cc1: all warnings being treated as errors

Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
2022-06-15 14:37:24 -06:00
Andrzej Puzdrowski 453b0dd790 sim: added flash_area_sector_from_off() API implementation
Added implementation of the above API function.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2022-06-14 11:25:02 +02:00
Andrzej Puzdrowski cc547a76da sim/mcuboot-sys: provide sim-own porting files
The sim platform was sharing a few header
files with the zephyr-rtos port. This patch provides
sim own headers.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2022-06-14 11:25:02 +02:00
Andrzej Puzdrowski a914048bee sim/mcuboot-sys: mbedtls configuations
copied configurations form the zephyr port

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2022-06-14 11:25:02 +02:00
Jerzy Kasenberg 0676589873 boot: mynewt: Add boot data sharing config
There is code for sharing data between booloader and application.
So far only zephyr had config flags to enable this.

This adds configuration that allows to turn on data sharing code
in mynewt version.

Signed-off-by: Jerzy Kasenberg <jerzy.kasenberg@codecoup.pl>
2022-06-13 19:57:20 -03:00
Jerzy Kasenberg 17e344f575 mynewt: Allow custom boot to be provided by pkg
BOOT_CUSTOM_START is defined by APP package (here).
This changes default value from 0 to empty
to allow for constructing packege that provides function
boot_custom_start() and automatically sets BOOT_CUSTOM_START to 1
for easy setup.

Signed-off-by: Jerzy Kasenberg <jerzy.kasenberg@codecoup.pl>
2022-06-13 19:57:09 -03:00
Dominik Ermel d49cfc14c3 boot_serial: zephyr: Use snprintf to format version string
Move formatting of version string to use snprintf, which Zephyr
provides, instead defining utility function for that purpose.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2022-06-09 15:43:50 +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
Andrzej Puzdrowski 7ed0e6d049 zephyr/main: configure DFU detection GPIO-pin uisng DTS
Added support for configure GPIO-pin used for triggering the
recovery DFU using DTS. That pin is assigned thanks to
`mcuboot-button0` pin-allias.

DTS configuration takes precedence over the Kconfig pin configurations.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2022-06-08 15:23:38 +02:00
Andrzej Puzdrowski 2ab49874a5 zephyr/main: unified pin detection procedure calls
MCUboot allows one recovery protocol at build-time.
Therefore detection procedure can use the build-time pin
configuration instead of run-time parameters.

This patch prepares detec_value() function for switching to
DTS pin configuration.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2022-06-08 15:23:38 +02:00
Dominik Ermel 88bd567608 boot_serial: Fix echo command code no longer compiling
Fixing missed update from cddl to zcbor.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2022-06-08 12:51:04 +02:00