Commit Graph

1829 Commits

Author SHA1 Message Date
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
Andrzej Puzdrowski dfce0be6a1 imgtool: export data vector to be signed
Extend sign/create command so it allows to export image's byte string
which is the substrate for the image signature. The new option is
'--vector-to-sign'. It might takes 'payload' or 'digest'.
The exported data might be used to calculate the signature externally.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2022-04-18 16:31:15 -06:00
Andrzej Puzdrowski f72e3741d6 imgtool: image signature export
Extend sign/create command so it now allow to export the image
signature to the file pointed by --sig-out option.
The image signature will be encoded as base64 formatted string.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2022-04-18 16:31:15 -06:00
Andrzej Puzdrowski 160303c202 imgtool: Added support for providing the signature by 3rd party
The sign command was extended so it now allow to provide the signature
as base64 formatted RAW file using --fix-sig along with the relevant
public key --fix-sig-pubkey.

This patch is added for support the case where the party which produces
the image dose not have access to the signing image key but must request
third party for the signature.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2022-04-18 16:31:15 -06:00
Jim Tan ee1b7b9d6e zephyr: fix booting address incorrect in ram-load mode
Signed-off-by: Jim Tan <KuoChun.Tan@ite.com.tw>
2022-04-18 16:28:54 -06:00
David Brown 93d02179b3 sim: Trivial dependency updates
Update dependencies that don't require any code changes.  This leaves
'aes' and 'cipher' which will require code changes to support newer
versions.

Signed-off-by: David Brown <david.brown@linaro.org>
2022-04-12 08:11:57 +02:00
David Brown 42a7e545bf sim: Migrate to Rust 2021 edition
Change the edition in the various Cargo.toml to 2021.  There are no
changes to the code needed for this.  This will require Rust 1.56 in
order to build.

Signed-off-by: David Brown <david.brown@linaro.org>
2022-04-12 08:11:57 +02:00
Øyvind Rønningstad a7d34caaa7 boot_serial: Upgrade from cddl-gen 0.1.0 to zcbor 0.4.0
cddl-gen has been renamed to zcbor.
Update regenerate_serial_recovery_cbor.sh and regenerate/recopy all
files.

Remove the submodule in ext/ since it is no longer necessary when
the zcbor package is installed (only needed for regeneration, not
for building).

Signed-off-by: Øyvind Rønningstad <oyvind.ronningstad@nordicsemi.no>
2022-04-06 17:46:15 -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
Marek Pieta f08541a195 boot: zephyr: Disable CONFIG_USB_DEVICE_REMOTE_WAKEUP
Change disables CONFIG_USB_DEVICE_REMOTE_WAKEUP, because it is not
supported by the MCUboot bootloader source code.

Signed-off-by: Marek Pieta <Marek.Pieta@nordicsemi.no>
2022-04-04 09:16:54 +02:00
Gerard Marull-Paretas aa041a282d zephyr: remove deprecated DT_CHOSEN_ZEPHYR_FLASH_CONTROLLER_LABEL
DT_CHOSEN_ZEPHYR_FLASH_CONTROLLER_LABEL is going to be deprecated, so
remove its usages from the Zephyr port. Definition checks have been
replaced with DT_HAS_CHOSEN(zephyr_flash_controller), and the macro
itself has been replaced by
DT_LABEL(DT_CHOSEN(zephyr_flash_controller)). Note that the code could
likely be refactored to make use of compile time device references, ie
use DEVICE_DT_GET, but that task has been left for the maintainers.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2022-03-28 10:47:22 +02:00
Almir Okato a1d641d59e espressif:esp32: Add multi image support
Changes on configuration and flash area organization for supporting
multi image and implementation for booting on different processors
on esp32

Signed-off-by: Almir Okato <almir.okato@espressif.com>
2022-03-16 03:58:01 -03:00