Commit Graph

1243 Commits

Author SHA1 Message Date
Fabio Utzig 6ec2ec32cb assemble: Allow use of ZEPHYR_BASE environment var
Make `-z` flag optional, so if it is not provided rely on the
ZEPHYR_BASE environemnt variable to find the Zephyr tree.

Signed-off-by: Fabio Utzig <fabio.utzig@nordicsemi.no>
2020-07-10 15:26:13 -03:00
David Brown 8a99adf0c5 sim: Update to aes-ctr 0.4 and fix for API changes
Upgrade to the latest aes-ctr package, and apply minor fixes due to
trait naming changes in this version.

Signed-off-by: David Brown <david.brown@linaro.org>
2020-07-10 11:14:15 -06:00
David Brown 886641b77a sim: Bump base64 dependency to 0.12
There are no API changes affecting us.

Signed-off-by: David Brown <david.brown@linaro.org>
2020-07-10 11:14:15 -06:00
David Brown 9637136727 sim: Bump pem to 0.8
Move to latest version of pem dependency.  No API changes affect us.

Signed-off-by: David Brown <david.brown@linaro.org>
2020-07-10 11:14:15 -06:00
David Brown 3327e99619 sim: Update env_logger to 0.7
Update to the newest version of this crate.  There are no API changes
affecting us, so this is just an update of the Cargo.toml file.

Signed-off-by: David Brown <david.brown@linaro.org>
2020-07-10 11:14:15 -06:00
David Brown cd842848c3 sim: Migrate main sim to rand 0.7
Adapt to the API changes that have happened in recent versions of the
rand crate.

Signed-off-by: David Brown <david.brown@linaro.org>
2020-07-10 11:14:15 -06:00
David Brown fd8b05eb6a sim: Upgrade to 0.7 API version of rand
There have been some revamping of the Rand API.  The Standard
distribution on floating point numbers will return a value in the
interval [0,1).

Signed-off-by: David Brown <david.brown@linaro.org>
2020-07-10 11:14:15 -06:00
Viktor Sjölind f1e6e9ccec zephyr: Find board name from dts.pre.tmp file
In scripts/assemble.py:

Use the <board_name>.dts.pre.tmp file in <build-dir>/zephyr to find the
board name.

This allows the build directory path to be set freely and not enforcing
directory structures.

Signed-off-by: Viktor Sjölind <viktor.sjolind@endian.se>
2020-07-10 09:16:25 -03:00
Fabio Utzig 2c3be5cfb4 Add test for erased secondary with leftover trailer
Signed-off-by: Fabio Utzig <fabio.utzig@nordicsemi.no>
2020-07-10 06:57:08 -03:00
Fabio Utzig 260ec45734 Fix erase of possible trailer leftover after reset
This fixes an issue where an image might be erased, but a trailer left
behind. It can happen if the image in the secondary slot did not pass
validation, in which case the whole slot is erased. If during the erase
operation, a reset occurs, parts of the slot might have been erased
while some have not. The concerning part is the trailer because it
might disable a new image from being loaded through mcumgr; so just get
rid of the trailer here, if the header is erased.

Signed-off-by: Fabio Utzig <fabio.utzig@nordicsemi.no>
2020-07-10 06:57:08 -03:00
Harry Jiang 6828151973 docs: Fix the typo for imgtool keygen command
Signed-off-by: Harry Jiang <explora26@gmail.com>
2020-07-06 06:36:12 -03:00
Rafał Kuźnia d854bb6659 boot/zephyr: add option to relocate interrupts to application
If CONFIG_BOOT_INTR_VEC_RELOC is set, the mcuboot will
relocate the interrupt vector to the booted application.

Signed-off-by: Rafał Kuźnia <rafal.kuznia@nordicsemi.no>
2020-06-23 15:25:29 -06:00
Torsten Rasmussen 33fbef51c0 cmake: scripts: now using ZEPHYR_BASE as local variable
This commit is a followup to the usage of `find_package(Zephyr ...)`.

The zephyr/hello-world sample has been updated to use find_package.
The assemble.py script now takes ZEPHYR_BASE as an argument, so it may
be used from CMakeLists.txt files when ZEPHYR_BASE is not set in
environment, and thus the Makefile sample has been adjusted accordingly.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2020-06-15 15:27:48 +02:00
Dominik Ermel 9b48d08dfc boot/zephyr: Fix single image compilation with serial recovery
Fixes mistake in CMakeLits.txt that prevented successful compilation
of single image with serial recovery enabled.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2020-06-08 10:18:32 -03:00
Andrzej Puzdrowski 97e966a226 zephyr: fix zephyr testcase extra_tags
dtc overlay should be transfered via DTC_OVERLAY_FILE,
not by DTC_OVERLAY.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2020-06-05 13:30:40 -06:00
Kostiantyn Tkachov 120efee34f Use cypress cy-mbedtls-acceleration revision w/o HAL
Signed-off-by: Kostiantyn Tkachov <kotk@cypress.com>
Signed-off-by: Roman Okhrimenko <roman.okhrimenko@cypress.com>
2020-06-05 01:08:36 +03:00
Dominik Ermel 4dc3f442d7 boot/zephyr: Kconfig changes supporting single image DFU
Modifications to Kconfig that add option for selection of single image
DFU and disable incompatible options.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2020-06-04 13:50:34 -06:00
Dominik Ermel 8101c0cd4e boot/zephyr: Allow single image applications
The change enables usage of single image applications. This can be used
when user does not need multiple boot images and wants to use more flash
are for main application or other purposes.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2020-06-04 13:50:34 -06:00
Ihor Slabkyy 24d93738d5 Add a way to specify custom TLVs.
Custom TLVs will be placed in the protected area.

Tag and value come from command line.

Values with 0x prefix will be interpreted as an integer, otherwise
it will be interpreted as a string.

Signed-off-by: Ihor Slabkyy <ihor.slabkyy@cypress.com>
2020-06-04 13:02:41 -06:00
Kumar Gala 0813efeac6 zephyr: Convert from Zephyr to C99 types
Use C99 types in favor of the Zephyr defined types.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-06-04 08:28:35 -06:00
Andrzej Puzdrowski 16b6d15a6b zephyr/Kconfig: cleanup mcuboot menuconfig
A few mcuboot option were outside of mcuboot-specific
menu.
This patch moves them into mcuboot menu.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2020-06-01 09:36:28 -06:00
Torsten Rasmussen 43004b8541 cmake: use find_package to locate Zephyr
Using find_package to locate Zephyr.

Old behavior was to use $ENV{ZEPHYR_BASE} for inclusion of boiler plate
code.

Whenever an automatic run of CMake happend by the build system / IDE
then it was required that ZEPHYR_BASE was defined.
Using ZEPHYR_BASE only to locate the Zephyr package allows CMake to
cache the base variable and thus allowing subsequent invocation even
if ZEPHYR_BASE is not set in the environment.

It also removes the risk of strange build results if a user switchs
between different Zephyr based project folders and forgetting to reset
ZEPHYR_BASE before running ninja / make.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2020-06-01 12:45:38 +02:00
Roman Okhrimenko 2dcc96db52 Fix compilation of cypress code
Signed-off-by: Roman Okhrimenko <roman.okhrimenko@cypress.com>
2020-05-29 14:11:57 -03:00
Bohdan Kovalchuk 0324f1b023 Add external memory support for cypress platform
Signed-off-by: Bohdan Kovalchuk <bohd@cypress.com>
Signed-off-by: Roman Okhrimenko <roman.okhrimenko@cypress.com>
2020-05-29 03:40:28 +03:00
David Brown 50d24a5751 Preps for v1.6.0 release
Update README, release notes the mynewt repository file, and imgtool for
the v1.6.0 release.

Signed-off-by: David Brown <david.brown@linaro.org>
2020-05-22 11:59:39 -06:00
Joakim Andersson b0890aeaa4 kconfig: Update to CONFIG_FLOAT to CONFIG_FPU rename in zephyr
Update CONFIG_FLOAT to CONFIG_FPU which has been renamed in zephyr.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2020-05-22 10:10:13 -06:00
David Vincze 9015a5d404 boot: Fix uninitialized variable warning
Fix uninitialized variable warning that may occur when
compiler optimization is enabled (especially for size).

Change-Id: Id56669a2079ac20edbf74c17f943c974f1e8bf93
Signed-off-by: David Vincze <david.vincze@linaro.org>
2020-05-18 15:53:53 -06:00
Kumar Gala 45b00acf0f scripts/assemble: Rework to use EDT library to get devicetree data
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2020-05-15 15:11:56 -06:00
Kumar Gala 00108fe973 sim: Fixup devicetree.h for changes to mcuboot
Fixup how we fake out devicetree.h, which is now really the flash map
API for what mcuboot is using.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2020-05-15 15:11:56 -06:00
Andrzej Puzdrowski 7024340b66 zephyr: Change DT_FLASH_AREA_ macros to FLASH_AREA for multimage
Use the new FLASH_AREA_ macros.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2020-05-15 15:11:56 -06:00
Kumar Gala 6e26e38585 zephyr: Change DT_FLASH_AREA_ macros to FLASH_AREA_
As we replace the legacy DT_FLASH_ support use the new FLASH_AREA_
macros.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2020-05-15 15:11:56 -06:00
Arvin Farahmand fb5ec1877d zephyr: add option to disable cryptographic check of the image
- Add Kconfig option `CONFIG_BOOT_SIGNATURE_TYPE_NONE`. When y,
  The bootloader will not verify the cryptographic signature of the image
  at boot or prior to upgrade. Image integrity check is retained.

  Images would still need to be processed using `imgtool` however no key
  should be provided to skip cryptographic signature generation.

Signed-off-by: Arvin Farahmand <arvinf@ip-logix.com>
2020-05-15 12:07:20 -06:00
Arvin Farahmand f824019956 boot: bootutil: add option to disable cryptographic check of the image
- If MCUBOOT_SIGN_RSA, MCUBOOT_SIGN_EC, MCUBOOT_SIGN_EC256 are not
  defined cryptographic signature check is skipped during validation.
  sha256 check is still retained. This reduces the binary size, at the
  expense of greatly reduced security. However this can be acceptable
  in some scenarios where cryptographic check is not required.

Signed-off-by: Arvin Farahmand <arvinf@ip-logix.com>
2020-05-15 12:07:20 -06:00
Øyvind Rønningstad 16d7b73cd2 serial_recovery: Reduce minimum number of members in packet
Was 3, but mcumgr sometimes sends 2 ("off" + "data", "len" is not needed
when "off" != 0). Reduce to 1 to avoid the problem, since the code
has other checks to catch this.

Signed-off-by: Øyvind Rønningstad <oyvind.ronningstad@nordicsemi.no>
2020-05-13 07:59:22 -06:00
David Brown 57f0df3e18 boot_serial: Initialize possibly initialized variable
The variable `dec_off` can possibly be uninitialized in this function.
As long as the serial protocol used is formed correctly, the
initialization will always happen.  Place an initialization upon
function entry to protect against a case where a malformed protocol is
able to provoke this variable being used before being initialized.

Signed-off-by: David Brown <david.brown@linaro.org>
2020-05-12 13:50:58 -06:00
David Brown 4cb70ccb0e Add a link to the simulator from the top-level README
Hopefully this will help a little with awareness of the existence of the
simulator.

Signed-off-by: David Brown <david.brown@linaro.org>
2020-05-12 08:38:46 -06:00
David Brown a3a96fed85 sim: Add `--recursive` to submodule update
Now that mbed tls has its own submodules, add `--recursive` to the
sample invocation of submodule update.  Without this, building the
simulator produces difficult messages about `sha256.c` missing.

Signed-off-by: David Brown <david.brown@linaro.org>
2020-05-12 08:38:46 -06:00
David Brown 82c5f7c65c Preps for 1.6.0-rc2 release
Update various version fields.  Also include a note in the release notes
describing Zephyr compatibility.

Signed-off-by: David Brown <david.brown@linaro.org>
2020-05-06 08:40:22 -06:00
Kumar Gala 9a5b95158e zephyr: convert DT_JEDEC_SPI_NOR_0_LABEL to new dt macros
As the DT define DT_JEDEC_SPI_NOR_0_LABEL is intended to be deprecated
move to the new macro style to determine for DT_JEDEC_SPI_NOR_0_LABEL

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-05-04 13:34:11 -06:00
Kumar Gala 32b61f333b zephyr: Replace DT_FLASH_DEV_NAME with DT_CHOSEN_ZEPHYR_FLASH_CONTROLLER_LABEL
As upstream zephyr is phasing out DT_FLASH defines for non-partition
usage replace DT_FLASH_DEV_NAME with
DT_CHOSEN_ZEPHYR_FLASH_CONTROLLER_LABEL.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-05-04 13:34:11 -06:00
Andrzej Puzdrowski f4a9a9d7e9 zephyr/Kconfig: reference missing new Nordic boards keywords
Updated boards reference names.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2020-04-30 13:25:54 +02:00
Fabio Utzig 377307de7d Fix imgtool publishing missing python package
Add missing `packaging` to allow version comparison.

Signed-off-by: Fabio Utzig <utzig@apache.org>
2020-04-23 12:03:48 -06:00
Fabio Utzig 14301abbc1 travis: add imgtool publishing
Add new CI vm that parses the imgtool version from __init__.py and
compares with the current published release. If the version in the repo
is newer it will be published automatically.

Signed-off-by: Fabio Utzig <utzig@apache.org>
2020-04-23 09:56:58 -06:00
David Brown 342e875d0f Preps for 1.6.0-rc1
Update version fields, and add release notes for the 1.6.0-rc1 release.

Signed-off-by: David Brown <david.brown@linaro.org>
2020-04-22 18:27:00 -06:00
David Brown e06ef9bca2 Bump imgtool version to 1.6.0-rc1.
Signed-off-by: David Brown <david.brown@linaro.org>
2020-04-22 18:27:00 -06:00
David Brown aac7111b02 boot: Update copyrights and licenses
To make contributions easier, place explicit copyrights by the major
contributors, along with an SPDX license identifier.  Files that came
from the mynewt project, which was an Apache project will retain the
Apache project license text, although this does not apply to new
contributions, which are being made by individual contributors.

Hopefully, this will keep everyone happy, but allow contributors that
need to add an explicit copyright to have a place they can add that.

Fixes #501

Signed-off-by: David Brown <david.brown@linaro.org>
2020-04-22 15:07:28 -06:00
David Vincze 25459bffcc docs: Provide description for multiple features
- Update documentation of 'HW based downgrade prevention'
- Add description for the following features:
      MCUBOOT_MEASURED_BOOT
      MCUBOOT_DATA_SHARING
      MCUBOOT_HW_KEY

Change-Id: If7247e906de3028d44cdd9d14a5004661fb955af
Signed-off-by: David Vincze <david.vincze@linaro.org>
2020-04-22 14:25:21 -06:00
David Vincze 4e3c47bfca docs: Fix Markdown rendering issues
- Fix rendering issues of multi-line HTML comments (license headers)
- Fix rendering issues of footnotes

Change-Id: I06c8ad3454a62187e9d527df62560b897ec478f4
Signed-off-by: David Vincze <david.vincze@linaro.org>
2020-04-21 15:42:29 -06:00
David Brown e3cbbece36 Use _Static_assert on all platforms
This macro is part of the C11 standard.  Remove the use of a specialized macro
just for Zephyr, and use the standard macro for all platforms.  This reduces
dependencies on specific versions of Zephyr.

In addition.  The Zephyr-specific code was using toolchain/gcc.h which
would only work with gcc.h, so doesn't actually address any of the
objections.  If this ever becomes a problem with Zephyr, we can figure
out a proper way to fix this.

Signed-off-by: David Brown <david.brown@linaro.org>
2020-04-21 08:20:29 -06:00
Bohdan Kovalchuk 7725652e30 Add files to eliminate HAL dependency, build/compile pass
Signed-off-by: Bohdan Kovalchuk <bohd@cypress.com>
Signed-off-by: Roman Okhrimenko <roman.okhrimenko@cypress.com>
2020-04-21 07:55:10 -06:00