Commit Graph

1891 Commits

Author SHA1 Message Date
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
David Brown 9feea8c616 boot: Check that hash TLV is sufficiently large
Add a check for the size of the TLV entry for the boot record.
Although, this is in the protected area, and should be protected by a
signature, check that we don't induce an integer underflow if that entry
is somehow too short.

Signed-off-by: David Brown <david.brown@linaro.org>
2022-06-07 14:37:01 +02:00
Jamie McCrae 254714bebd boot: zephyr: Align boot serial check start line
Line was missing a space and was not aligned to the bracket on the
previous line.

Signed-off-by: Jamie McCrae <jamie.mccrae@lairdconnect.com>
2022-05-31 12:27:48 -06: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
Daniel DeGrasse 3f4d57c7ac zephyr: boards: enable progressive erase for RT1050 and RT1060
RT1050 and 1060 have large flash chips, so tools like MCUMgr will time
out if the entire flash bank is erased before writing data. Enable
progressive erase for these boards to prevent timeouts.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-05-31 11:09:39 -06:00
Andrzej Puzdrowski 5f317e4cc8 zephyr: rework LED usage using `struct gpio_dt_spec`
LED usage code were simplified thanks to `struct gpio_dt_spec`
and related methods.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2022-05-31 11:04:19 -06:00
Andrzej Puzdrowski 2f545b8ebb zephyr: prefer DTS mcuboot-led0 alias over bootloader-led0 alias
bootloader-led0 alias will be deprecated and replaced by dedicated
mcuboot-led0 alias.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2022-05-31 11:04:19 -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
iysheng 6093cbb3dd scripts: Fix some sentences to suit print display
Signed-off-by: iysheng <iysheng@163.com>
2022-05-30 08:13:55 +02:00
Alexandr Kolosov 1d6f98e48d zephyr: boards: fix license header for tlsr9518adk80d board
Signed-off-by: Alexandr Kolosov <rikorsev@gmail.com>
2022-05-24 09:37:21 -06:00
Jamie McCrae 0f7db390d3 bootutil: zephyr: Fix not linking with mbedtls when needed
This fixes a build issue when building mcuboot for zephyr with RSA
image encryption support enabled using mbedtls.

Signed-off-by: Jamie McCrae <jamie.mccrae@lairdconnect.com>
2022-05-24 14:15:37 +02:00
Ryan McClelland 179d8fa428 boot: zephyr: add Kconfig for arm cortex-m that implements a cache
The Cache is an optional configuration of both the ARM Cortex-M7 and
Cortex-M55. Previously, it was just checking that it was just an M7
rather than knowing that the CPU actually was built with the cache.

Signed-off-by: Ryan McClelland <ryanmcclelland@fb.com>
2022-05-22 20:51:21 -03:00
Jamie McCrae 7315e424b9 bootutil: zephyr: Fix not including tinycrypt path when needed
This fixes a build issue when building mcuboot for zephyr with image
encryption support enabled using tinycrypt.

Signed-off-by: Jamie McCrae <jamie.mccrae@lairdconnect.com>
2022-05-20 11:28:38 -06:00
Alex Kolosov ced3434719 zephyr: boards: add support for Telink tlsr9518adk80d board
Signed-off-by: Alex Kolosov <rikorsev@gmail.com>
2022-05-19 11:26:22 -06:00
Almir Okato 3eb50263b7 imgtool: Fix imgtool sign command without key
The fix adds a condition that checks if either key or fixed_sig are
`not None` before payload signing and TLV addition.

Signed-off-by: Almir Okato <almir.okato@espressif.com>
2022-05-18 09:51:53 -03:00
David Brown e802cd4846 docs: Fix case of Cypress readme file
Fix the case of the cypress readme to fix dead links in the docs.

Signed-off-by: David Brown <david.brown@linaro.org>
2022-05-17 11:20:13 -06:00
Alexey Arbuzov e4fba687d9 Remove unused functions
Signed-off-by: Alexey Arbuzov <lexx.vir@gmail.com>
2022-05-12 18:39:43 -03:00
Almir Okato c4b305863a espressif:esp32: Move app entry point call back to iram_loader_seg region
Entry point call was moved back from main to esp_loader, so it is
called from iram_loader_seg memory region

Signed-off-by: Almir Okato <almir.okato@espressif.com>
2022-05-11 07:57:27 -03:00
Almir Okato fa173df366 espressif: Add warning for unsupported chip revision
Added checking and warning for ESP32, ESP32-S2, ESP32-C3, ESP32-S3
unsupported chip revisions on their initialization.

Made respectively changes for build system and documentation.

Signed-off-by: Almir Okato <almir.okato@espressif.com>
2022-05-09 15:55:23 -03:00
Almir Okato 1dc71368b2 espressif: grouping common functions for esp chips init functions
Grouped common bootloader init functions among esp32, esp32s2,
esp32c3 and esp32s3 into common files.

Signed-off-by: Almir Okato <almir.okato@espressif.com>
2022-05-09 15:55:23 -03:00