Commit Graph

2079 Commits

Author SHA1 Message Date
Piotr Dymacz f5e7753b9e boot_serial: support fragmentation for outgoing SMP packets
The mcumgr packet sent over serial should be fragmented into frames of
up to 127 bytes, including 2-bytes frame start header and 1-byte for
terminating newline [1], resulting in up to 124 bytes for the base64
encoded payload.

Current implementation doesn't fulfill above requirement and transmits
single frames, without considering their length. This change introduces
support for fragmenting as defined in 'SMP over console' specification.

[1] github.com/apache/mynewt-mcumgr/blob/master/transport/smp-console.md

Signed-off-by: Piotr Dymacz <pepe2k@gmail.com>
2023-03-21 15:10:12 +01:00
David Brown 569b1d6393 Update to version 1.10.0-rc1
Signed-off-by: David Brown <david.brown@linaro.org>
2023-03-20 14:02:12 -06:00
David Brown d2dfa1bd20 docs: Create release notes for 1.10.0 release
Signed-off-by: David Brown <david.brown@linaro.org>
2023-03-20 13:50:47 -06:00
David Brown 4337feed06 docs: Describe the release note snippet requirement
Add mention of the release note requirements to the SubmittingPatches
file so that developers are more likely to see and comply.

Signed-off-by: David Brown <david.brown@linaro.org>
2023-03-20 13:49:38 -06:00
David Brown d4184ebdb9 docs: Setup template for release note process
Add some guidelines for release notes that developers can use to create
release note snippets as features and fixes are implemented.  This will
greatly reduce the work needed at release time.

Signed-off-by: David Brown <david.brown@linaro.org>
2023-03-20 13:49:38 -06:00
Dominik Ermel 1090d8ffc0 zephyr: Check zephyr,uart-mcumgr as candidate for serial recovery
The commit modifies selection of boot serial UART by first checking
the Zephyr chosen zephyr,uart-mcumgr and then reverting to the
zephyr,console, as a secondary candidate.
In case when both nodes are present and point to the same device,
error will be reported.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2023-03-20 17:16:42 +01: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
Szymon Janc 22096886a6 ci: mynewt: Enable Mynewt specific tests
This allows to run Mynewt bootserial tests in CI.

Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
2023-03-17 11:14:24 -03:00
Szymon Janc 874a0ab4d5 boot_serial: Fix Mynewt tests build
__packed may not be available in all environments. In such
case just fallback to  __attribute__((__packed__)).

Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
2023-03-17 07:53:19 -03:00
Raphael Dupont 16f3de5660 imgtool: fix boot_magic when -e big and max-align > 8
Currently if max-align > 8, magic_boot only works in little endian

For example :
With max-align = 16 and endian = big, boot_magic starts with 0x10 0x00,
but it should be 0x00 0x10

Signed-off-by: Raphael Dupont <raphael7dup@gmail.com>
2023-03-16 10:03:24 -03:00
Dominik Ermel c89a94f120 mynewt: Add flash_area_get_sector
Simple stub of flash_area_get_sector using system provided
flash_area_sector_from_off.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2023-03-15 20:15:58 +01:00
Stephane Le Roy 259d989f2e bootutil: Fix erase of trailer when located in scratch area
Trailer is temporary located in scratch when data of image goes up to last
sector of primary slot. At the end of the swap procedure, the temporary
trailer in scratch must be erased to prevent mcuboot from reading a stale
status from the scratch area. The erase tentative was not correct, this
is fixed.Issue is easily reproduced with an image size of one sector.

Signed-off-by: Stephane Le Roy <stephane.leroy@st.com>
Signed-off-by: Michel Jaouen <michel.jaouen@st.com>
2023-03-15 15:12:24 -03:00
Jamie McCrae e8294b2af5 boot_serial: Add packed to struct
Adds a packed attribute to the nmgr struct to avoid issues on
architectures that do not support unaligned memory access.

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2023-03-15 09:23:04 +01:00
Fabio Utzig 9c5d14ae67 ci: Update signed commit check to accept a SHA
Try a merge commit if no parameters are passed, otherwise accept the
first parameter as the oldest SHA to check.

Signed-off-by: Fabio Utzig <utzig@apache.org>
2023-03-14 08:18:52 -06:00
Dominik Ermel 68dcc0ee10 zephyr: single_loader: Switch to flash_area_get_sector
Use flash_area_get_sector instead of flash_area_sector_from_off.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2023-03-14 08:13:20 -06:00
Dominik Ermel 2476988309 boot: Switch to flash_area_get_sector.
Replace flash_area_sector_from_off calls with flash_area_get_sector.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2023-03-14 08:13:20 -06:00
Dominik Ermel bd0d94ce4b espressif: Add flash_area_get_sector
Commits adds implementation of flash_area_get_sector that
is supposed to replace flash_area_sector_from_off.
The flash_area_get_sector gets additional parameter of flash_area
type, while flash_area_sector_from_off uses hardcoded flash_area.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2023-03-14 08:13:20 -06:00
Dominik Ermel b1d4e00186 sim: Add flash_area_get_sector
Commits adds implementation of flash_area_get_sector that
is supposed to replace flash_area_sector_from_off.
The flash_area_get_sector gets additional parameter of flash_area
type, while flash_area_sector_from_off uses hardcoded flash_area.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2023-03-14 08:13:20 -06:00
Dominik Ermel 069aea48a2 zephry: Add flash_area_get_sector
Commits adds implementation of flash_area_get_sector that
is supposed to replace flash_area_sector_from_off.
The flash_area_get_sector gets additional parameter of flash_area
type, while flash_area_sector_from_off uses hardcoded flash_area.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2023-03-14 08:13:20 -06: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 dc8ef87932 zephyr: serial_recovery: Use Zephyr manifest zcbor files
Switches from using the zcbor files in-tree to using the ones that
are part of the zephyr manifest, this prevents using old and
potentially buggy versions of the zcbor library.

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2023-03-13 13:19:27 +01:00
Piotr Dymacz e026c3679b imgtool: sign: allow using 16-bit custom TLVs from valid range
The TLV type field in trailer TLV struct is defined as unsigned 16-bit
(in LE byte order). Currently, due to Python's struct format specified
as 'BBH', the 'imgtool' accepts only single byte for this field.

This results in error when trying to use 16-bit TLV type with option
'--custom-tlv':

  struct.error: ubyte format requires 0 <= number <= 255

This changes format to 'HH' which allows using 16-bit TLV types and
while at it, adds also simple range validation for custom TLV type.
As defined in image.h header, the vendor reserved TLVs value should
be from 0x00a0 to 0xfffe range.

Signed-off-by: Piotr Dymacz <pepe2k@gmail.com>
2023-03-10 17:30:38 -03:00
Roland Mikhel 4d51038cd5 workflow: Split configs and disable fail-fast
Split RELEASE configs to match MINSIZEREL configs and
disable auto cancel upon one of the configs exiting with an error.

Signed-off-by: Roland Mikhel <roland.mikhel@arm.com>
Change-Id: I32225ecd1316e0a7067513cfa417e00cdcf660c4
2023-03-02 14:24:25 -07:00
Roland Mikhel 9f4ef83dc0 ci: Improve FIH job result assesment
Modify the FIH CI job to fail in case successful boot happens
below a certain treshold. CI should fail if a successful boot
is achieved by bypassing one or two instructions as it would
defeat the purpose of the FIH mechanisms.

Signed-off-by: Roland Mikhel <roland.mikhel@arm.com>
Change-Id: If1703d57e3ba87e5fd73d4ba954bfd38ed1c0cc6
2023-03-02 14:24:25 -07:00
Jamie McCrae b56a65f5cb zephyr: serial_recovery: Fix missing limit on buffer size
Fixes an issue whereby the unaligned memory buffer does not
have limits applied to it.

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2023-03-01 15:39:54 +01:00
Dominik Ermel 0119cdb570 zephyr: Add missing flash_map.h to sysflash.h
The sysflash.h defines FLASH_AREA_ macros using FIXED_PARTITION
macros that are provided by flash_map.h, but it does not include
the required header.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2023-03-01 15:37:22 +01:00
Sigvart Hovland 5962433474 nrf: cc310: Change license to Apache-2
This fixes the issue: #1624 by changing the license to Apache-2.
There isn't a need to have these files nordic licensed.

Signed-off-by: Sigvart Hovland <sigvart.hovland@nordicsemi.no>
2023-02-28 08:21:01 -07:00
Jamie McCrae 0b7b7ae655 docs: zephyr: Add note on swap-using-scratch
Adds details on how to use the swap-using-scratch algorithm and
associated risks.

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2023-02-28 08:18:57 -07:00
INFINEON\DovhalA 94360d5b2f Fix possible array index overflow in loader.c: fill_rsp()
Signed-off-by: INFINEON\DovhalA <Artem.Dovhal@infineon.com>
2023-02-28 08:08:35 -07:00
Dominik Ermel 472d4c7fed bootutil: Pass flash_area to boot_read_swap_size
Modifies boot_read_swap_size and boot_read_enc_key to use
flash_area object pointer instead of image index.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2023-02-28 08:06:10 -07: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
Sherry Zhang 120b7182ae FIH: Fix possible static check error caused by FIH_DECLARE
Signed-off-by: Sherry Zhang <sherry.zhang2@arm.com>
Change-Id: I970582777018094d0cbf83d3131a7d5c576035e5
2023-02-27 11:25:33 +01:00
Ross Younger ae9d256cab imgtool: allow verify mode to use public ed25519 keys
Verify mode already works for the public halves of RSA and ECDSA keypairs.
This patch corrects an apparent oversight, enabling that functionality
in Ed25519.

Signed-off-by: Ross Younger <crazyscot@gmail.com>
2023-02-25 09:42:31 -03:00
dependabot[bot] d9e5d2681e build(deps): bump bumpalo from 3.9.1 to 3.12.0
Bumps [bumpalo](https://github.com/fitzgen/bumpalo) from 3.9.1 to 3.12.0.
- [Release notes](https://github.com/fitzgen/bumpalo/releases)
- [Changelog](https://github.com/fitzgen/bumpalo/blob/main/CHANGELOG.md)
- [Commits](https://github.com/fitzgen/bumpalo/compare/3.9.1...3.12.0)

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

Signed-off-by: dependabot[bot] <support@github.com>
2023-02-25 09:39:31 -03:00
dependabot[bot] c00f332c41 build(deps): bump nokogiri from 1.13.8 to 1.14.2 in /docs
Bumps [nokogiri](https://github.com/sparklemotion/nokogiri) from 1.13.8 to 1.14.2.
- [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.13.8...v1.14.2)

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

Signed-off-by: dependabot[bot] <support@github.com>
2023-02-24 12:04:03 +01:00
dependabot[bot] ccc8f8c855 build(deps): bump activesupport from 6.0.3.6 to 6.0.6.1 in /docs
Bumps [activesupport](https://github.com/rails/rails) from 6.0.3.6 to 6.0.6.1.
- [Release notes](https://github.com/rails/rails/releases)
- [Changelog](https://github.com/rails/rails/blob/v7.0.4.2/activesupport/CHANGELOG.md)
- [Commits](https://github.com/rails/rails/compare/v6.0.3.6...v6.0.6.1)

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

Signed-off-by: dependabot[bot] <support@github.com>
2023-02-23 20:02:05 -03:00
Dominik Ermel 76d2b89b40 ci: Skip sign-off checks for dependabot
Dependabot uses different e-mails for signoff and commit.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2023-02-23 08:12:12 -07:00
Dominik Ermel c68a600403 bootutil: Little rework of boot_find_status
In rework:
  - size has been removed from array, as it has been making array
    at least of two elements, even if scratch partition not used;
  - some variables have been localized and some removed;
  - no longer returning rc codes from flash_area_ functions on
    failure, just single point of failure-exit - it made no sense
    anyway as we can not recover from flash failure;
  - flash area pointer is now NULLified on failure, or when
    status not found.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2023-02-22 08:51:18 -07:00
Dominik Ermel 23a7a2e61f bootutil: Move duplicate static inline functions to one header
The commit moves static common functions that have duplicate
definitions in bootutil_public.c and bootutil_misc.c to header
file to be included by both files.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2023-02-22 08:49:31 -07:00
Tamas Ban 4a34b0fed1 ci: Update TF-M version to be aligned with FIH library changes
So far the FIH CI job was fetching a WIP change from
TF-M Gerrit to align the MCUboot and TF-M from the FIH
library point of view. This change is replacing to fetch
the final version instead of the WIP change.

Signed-off-by: Tamas Ban <tamas.ban@arm.com>
2023-02-22 08:14:09 -07:00
Jamie McCrae aee388aefa zephyr: serial_recovery: Fix confusing/wrong Kconfig values
Fixes some confusing Kconfig values to have values that make
sense for the underlying SMP transport.

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2023-02-17 15:53:57 +01:00
Jamie McCrae cde363926b zephyr: serial_recovery: Make receive buffers configurable
This allows making the number of receive buffers configurable
instead of being fixed at 2.

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2023-02-17 15:53:57 +01:00
Dominik Ermel 453e8bd7de flash_map_backend: Remove flash_area_id_to_image_slot
The function has not been in use and some ports have not been
implementing it anyway.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2023-02-14 16:40:21 -07:00
Dominik Ermel b26fc487ee boot/boot_serial: Add boot_reset_request_hook to bs_reset
When hooks are enabled then boot_reset_request_hook will be
called to check whether it is allowed to reset a device.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2023-02-14 16:33:34 -07:00
Dominik Ermel ad35e2b227 boot/bootutil: Provide prototype for boot_reset_request_hook
Provide prototype for a new hook boot_reset_request_hook
which is called when device is requested to reboot.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2023-02-14 16:33:34 -07:00
hasheddan 85b4e0bf54 Use full links for Cypress and Sim usage instructions
The relative links do not work on the docs website due to the files not
living in the docs/ directory. This updates to link directly to the
GitHub source so that users are not dropped onto a 404 page.

Signed-off-by: hasheddan <georgedanielmangum@gmail.com>
2023-02-14 12:29:08 -07:00
Dominik Ermel a4c725109d zephyr: Remove FLASH_AREA_IMAGE_SCRATCH from single app config
Does not have to be set anymore when CONFIG_SINGLE_APPLICATION_SLOT
is set.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2023-02-14 08:42:15 -07:00
Dominik Ermel d546079707 bootutil: Don't default to scratch when single app is used
When MCUBOOT_SINGLE_APPLICATION_SLOT is set then the app can
only be overwritten with new image and scratch algorithm
is not used. The configuration logic would default
MCUBOOT_SWAP_USING_SCRATCH to 1 because it was lacking
check for MCUBOOT_SINGLE_APPLICATION_SLOT.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2023-02-14 08:42:15 -07:00
Daniel DeGrasse 8e8b5455bc boot: zephyr: add support for RT595
Add support for RT595 to MCUBoot. A larger number of max sectors is
required due to the large flash size present on the RT595 EVK.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2023-02-14 08:33:53 -07: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