Commit Graph

817 Commits

Author SHA1 Message Date
Fabio Utzig 4b2547c755 Remove symlinks, newt should find packages
Signed-off-by: Fabio Utzig <utzig@apache.org>
2019-03-15 07:51:28 -03:00
Fabio Utzig e14729b95b Use Mynewt pkgpath in imports
This allows both MCUBoot as root package with Mynewt core as remote and
the other way around.

Signed-off-by: Fabio Utzig <utzig@apache.org>
2019-03-15 07:51:28 -03:00
Andrzej Puzdrowski cf97dd08bd encryption: changed boot_enc_valid() return value to bool
boot_enc_valid() is supposed to return boolena so
changed it return type in order to reflect this.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2019-03-14 16:10:54 +01:00
Andrzej Puzdrowski e575fe9ead image encryption: fix enc_state array indexing for zephyr
enc_state table was indexed with assumption that
image flash area are subsequent and increasing numbers.
It might not be true while building zephyr.

Patch introduce flash_area_id_to_image_slot() implementation for
the zephyr port and uses it to assign proper slot number.
This API is already available in MyNewt.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2019-03-14 16:10:54 +01:00
Fabio Utzig ad0e9b8077 Add Mynewt configuration to enable HW crypto
Signed-off-by: Fabio Utzig <utzig@apache.org>
2019-03-14 07:29:01 -03:00
David Vincze 2d736ad4c5 Replace flash partitioning terminology
This change replaces the slot 0/1 terminology with primary/secondary
slot and replaces FLASH_AREA_IMAGE_0/1 with
FLASH_AREA_IMAGE_PRIMARY/SECONDARY. This naming convention may be more
understandable, fits better to MCUs with multiple images and it is an
architecture agnostic alternative as well.

Change-Id: I655a585f6ae023852c671ee6635399efe25209c9
Signed-off-by: David Vincze <david.vincze@arm.com>
Signed-off-by: David Brown <david.brown@linaro.org>
2019-03-13 15:40:21 -06:00
Fabio Utzig 59bcb3787e Add Mynewt target builds to CI
Adds scripts to build and test many Mynewt project configurations; this
avoids breaking builds after changes are not tested for some particular
configuration option.

Signed-off-by: Fabio Utzig <utzig@apache.org>
2019-03-12 10:37:49 -03:00
Fabio Utzig 1e38d1a6a9 Add Mynewt targets and keys
Add target projects to test build success in many different options.

Signed-off-by: Fabio Utzig <utzig@apache.org>
2019-03-12 10:37:49 -03:00
Fabio Utzig 94a9b261da Create CI resources directory
Add a new directory "ci", to easily add new tests with setup/run phases
that don't require direct setup in .travis.yml. This also avoids
polution of scripts/.

Signed-off-by: Fabio Utzig <utzig@apache.org>
2019-03-12 10:37:49 -03:00
Sebastian Bøe 0717552dfb zephyr: cmake: Don't declare the deprecated macro set_conf_file
The pattern that 'set_conf_file' has been added to the Zephyr build
system, so it is not necesary for the application build script to
implement it.

Also, the macro has been deprecated, so it should not be used.

This change is a pure refactoring.

Signed-off-by: Sebastian Bøe <sebastian.boe@nordicsemi.no>
2019-03-12 07:09:35 -03:00
Rajavardhan Gundi e2747487df intel_s1000: Enable CONFIG_BOOT_HAVE_LOGGING
The logger issue on Xtensa is resolved in mainline Zephyr with
239805b2d82aebee4969c3ae57fbf8025c4fb60d. Hence logging can be
enabled now.

Signed-off-by: Rajavardhan Gundi <rajavardhan.gundi@intel.com>
2019-03-08 16:31:48 +01:00
Rajavardhan Gundi edea467300 dfu: Enable CONFIG_BOOT_WAIT_FOR_USB_DFU for intel_s1000
Signed-off-by: Rajavardhan Gundi <rajavardhan.gundi@intel.com>
2019-03-08 16:31:48 +01:00
Rajavardhan Gundi 51c9d707fb dfu: Introduce CONFIG_BOOT_WAIT_FOR_USB_DFU
This Kconfig parameter makes MCUboot wait for a prescribed duration
of time to allow for USB DFU to be invoked.

Signed-off-by: Rajavardhan Gundi <rajavardhan.gundi@intel.com>
2019-03-08 16:31:48 +01:00
Sebastian Bøe 048168aa37 zephyr: Fix bug where prototype of SNPRINTF was not declared
Fix #10990.

A warning is triggered when snprintf is used because it is being
declared / configured incorrectly. The MBEDTLS configuration is
defaulting to disabling all of LIBC, and then explicitly enabling the
LIBC functions in use, this has been done for printf with
MBEDTLS_PLATFORM_STD_PRINTF, but not for
MBEDTLS_PLATFORM_STD_SNPRINTF.

Signed-off-by: Sebastian Bøe <sebastian.boe@nordicsemi.no>
2019-03-04 09:20:14 -03:00
Sebastian Bøe c2216cc5b5 zephyr: Minor refactoring for readability
Minor refactoring of Zephyr config file for readaiblity, STD functions
are now grouped.

Signed-off-by: Sebastian Bøe <sebastian.boe@nordicsemi.no>
2019-03-04 09:20:14 -03:00
Andrzej Puzdrowski b26a4a9c40 zephyr: align uart device name
Zephyr changed way of generation UART device name label
which implies device name label text change.

Patch aligns the code to above change.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2019-02-27 12:51:04 +01:00
Andrzej Puzdrowski 0cd178d0e9 zephyr: fix build with zephyr
zephyr macro min() was hanged to MIN()
Kconfig key CDC_ACM_PORT_NAME was changed to CDC_ACM_PORT_NAME_0

zephyr sha of the fixing time is 406dc2cb0e2868392f444677ace416440695829f.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2019-02-22 10:36:41 +01:00
Johannes Bruder 4b4ac906e3 Do not use an ASSERT to catch the case if no image is loaded
Signed-off-by: Johannes Bruder <johannes.bruder@plating.de>
2019-02-19 11:54:45 -07:00
Rajavardhan Gundi 5b39d3c7a4 Clean up intel_s1000_crb.conf file
Cleaned up the conf file for intel_s1000_crb by defining only
those values that are different from prj.conf.

Signed-off-by: Rajavardhan Gundi <rajavardhan.gundi@intel.com>
Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2019-02-19 11:52:31 -07:00
Rajavardhan Gundi 24321c3926 Replace DT_SPI_NOR_DRV_NAME with DT_JEDEC_SPI_NOR_0_LABEL
Zephyr mainline now generates DT_JEDEC_SPI_NOR_0_LABEL instead of
DT_SPI_NOR_DRV_NAME.

Signed-off-by: Rajavardhan Gundi <rajavardhan.gundi@intel.com>
Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2019-02-19 11:52:31 -07:00
Maureen Helm 4df602aeab boot: zephyr: Fix pyocd board runner args
The pyocd runner in zephyr changed its arguments slightly when it
converted to the new unified pyocd tool with subcommands. Change the
board runner args here similarly so we can use 'west flash' again for
the zephyr bootloader.

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2019-02-19 14:09:36 -03:00
Maureen Helm 0e0c488ab4 docs: samples: Update pyocd calls to unified tool subcommands
pyocd 0.14.0 merged its command-line tools into a unified pyocd tool
with subcommands. The separate command-line tools still remain, but are
deprecated. Update all pyocd calls in samples and documentation to use
the new unified pyocd tool with subcommands.

Note that pyocd 0.15.0 has an issue with the command 'pyocd erase',
which was fixed in pyocd 0.16.0.

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2019-02-19 14:09:36 -03:00
Michael Scott f9be7a9fae boot: zephyr: ensure LOG_LEVEL resource savings
Let's ensure that random Zephyr changes in logging don't affect
the resource usage in MCUBOOT, by setting LOG_LEVEL_DEFAULT
to 0.

Signed-off-by: Michael Scott <mike@foundries.io>
Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2019-02-11 10:47:04 +01:00
Michael Scott 74ceae5ba6 boot: zephyr: establish an MCUBOOT_LOG_LEVEL config
Rather than use LOG_DEFAULT_LEVEL to control MCUBOOT's log output,
let's create an MCUBOOT specific log level setting.

Signed-off-by: Michael Scott <mike@foundries.io>
Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2019-02-11 10:47:04 +01:00
Michael Scott cef4427d8d zephyr: kconfig: replace LOG_INPLACE_PROCESS setting w/ LOG_IMMEDIATE
Commit 1d9e5ee1 ("logging: Refactoring 'in place' mode to reduce memory
footprint") changed the resource restrained version of LOGGER from
LOG_INPLACE_PROCESS to LOG_IMMEDIATE.

Signed-off-by: Michael Scott <mike@foundries.io>
Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2019-02-11 10:47:04 +01:00
Andrzej Puzdrowski 419a47531b zephyr: allow dynamic numeration of flash_areas
Zephyr flash_map reworks caused that areas id exact number are
assigned dynamically.

This patch i counterpart to
https://github.com/zephyrproject-rtos/zephyr/pull/8837

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2019-02-10 16:08:38 +01:00
Marti Bolivar 23e3853c0a zephyr: CMakeLists.txt: support nrfjprog mass erase flag
The upstream Zephyr runner for nrfjprog now supports an --erase
toggle, which controls whether a mass-erase is done. Add that to its
invocation when CONF_ZEPHYR_TRY_MASS_ERASE is given, just like is done
for dfu-util and pyocd.

Signed-off-by: Marti Bolivar <marti@foundries.io>
2019-02-04 17:04:41 -07:00
David Brown adf57829dc Bump to release v1.3.0
Signed-off-by: David Brown <david.brown@linaro.org>
2019-02-04 12:57:18 -07:00
David Brown 4963b013c4 Bump version to 1.3.0-rc3
Third release candidate for 1.3.0.

Signed-off-by: David Brown <david.brown@linaro.org>
2019-02-01 10:02:00 -07:00
Christopher Collins ae01f153b1 Set pending: don't crash when image slot corrupt
This change affects the "set pending" operation.  That is, the operation
that configures mcuboot to temporarily swap images on the next boot.

PRIOR TO COMMIT:

If the slot 1 trailer contained an invalid 128-bit magic number, an
assertion would fail, causing a crash.

AFTER COMMIT:

If corruption is detected in the slot 1 trailer, the entire image slot
is erased, and the "set pending" operation fails with a `BOOT_EBADIMAGE`
status.

RATIONALE:

mcuboot cannot meaningfully recover from data corruption.  The only
recourse is to erase the bad data so that future upgrades can be
performed.  I was tempted to add a build-time setting to control whether
the image slot gets erased when corruption is detected, but I dont think this
freedom justifies the cost of extra config.  A device with a corrupt
image slot can no longer be upgraded, so the only reason someone would
want to preserve the corrupt data would be for debugging.

Signed-off-by: Christopher Collins <ccollins@apache.org>
2019-01-31 18:13:52 -02:00
Andrzej Puzdrowski e82e3163de zephyr:board: squash nrf51_pca10028 flash footprint
Disable logging and enable size optimizations on
nrf51_pca10028 target in order to fit in boot slot size
for out-off-the-box build.

fixes #411

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2019-01-30 14:45:38 +01:00
David Brown ef4861d1ae Bump version to 1.3.0-rc2
Second pre-release for v1.3.0.

Signed-off-by: David Brown <david.brown@linaro.org>
2019-01-29 15:21:41 -07:00
Rajavardhan Gundi 73bb71b0c6 CONFIG_FLASH_BASE_ADDRESS is defined only for memory-mapped Flash
Made FLASH_DEVICE_BASE 0 for non-memory-mapped Flash.

Signed-off-by: Rajavardhan Gundi <rajavardhan.gundi@intel.com>
2019-01-28 12:26:08 +01:00
Christopher Collins b17af7f85f repository.yml: Remove invalid stability "rc1"
Newt only allows the following stability strings in a repo version:

    VERSION_STABILITY_NONE   = ""
    VERSION_STABILITY_STABLE = "stable"
    VERSION_STABILITY_DEV    = "dev"
    VERSION_STABILITY_LATEST = "latest"
    VERSION_STABILITY_COMMIT = "commit"

An attempt to update a project that uses mcuboot would choke due to the
invalid stability string "rc1":

    Error: Unknown stability (rc1) in version 1.3.0-rc1

Signed-off-by: Christopher Collins <ccollins@apache.org>
2019-01-24 12:17:58 -08:00
David Brown 5e9078f1e0 Bump version to 1.3.0-rc1
First pre-release for v1.3.0.

Signed-off-by: David Brown <david.brown@linaro.org>
2019-01-24 10:03:37 -07:00
David Brown b1d15a7195 docs: Release notes for 1.3.0-rc1
Signed-off-by: David Brown <david.brown@linaro.org>
2019-01-24 10:03:37 -07:00
Fabio Utzig ed0ca4356a Fix trailer erase for some devices
Previously it was assumed that the trailer would fit one sector. While
this works for most devices, some which happen to have lots of sectors
end up using lots of space for their swap status area. The same issue
could also happen if sectors are small (less than 2K/4K, for example).

This fixes the issue by checking the trailer size and erasing all
sectors that encompass it.

Signed-off-by: Fabio Utzig <utzig@apache.org>
2019-01-23 14:04:47 -07:00
Sebastian Bøe be972176f1 cmake: zephyr: Misc. modernizations of the build scripts
Modernize and simplify the build scripts of the Zephyr
bootloader. Most notably, the new build scripts are targeting the
'zephyr_library_' API instead of the 'target_' API.

In addition to simplifying the build scripts, this permits us to be
automatically compatible with an upcoming change that will break the
'target_' API but not the 'zephyr_library_' API.

Signed-off-by: Sebastian Bøe <sebastian.boe@nordicsemi.no>
2019-01-22 16:09:02 -07:00
Sebastian Bøe 913a385137 boot: zephyr: Detect invalid Kconfig'uration earlier
Instead of detecting an invalid Kconfiguration during CMake
Configure-time we detect it where it belongs, in Kconfig.

Signed-off-by: Sebastian Bøe <sebastian.boe@nordicsemi.no>
2019-01-22 16:09:02 -07:00
Sebastian Bøe b94bda03aa zephyr: boot: Correct how the default board is set
The default board should be set simply by 'set'ing the BOARD. This has
the lowest precedence of all possible inputs.

Signed-off-by: Sebastian Bøe <sebastian.boe@nordicsemi.no>
2019-01-22 16:09:02 -07:00
Sebastian Bøe 90c70e31ad cmake: KCONFIG_ROOT does not need to be set explicitly
The presence of a Kconfig file will be checked by the build system so
it is not necessary to explicitly set KCONFIG_ROOOT.

Signed-off-by: Sebastian Bøe <sebastian.boe@nordicsemi.no>
2019-01-22 16:09:02 -07:00
David Brown 038e299e79 samples/zephyr: Build ECDSA tests with ECDSA key
Set the public key for ECDSA tests to use the ECDSA.  This avoids a link
error with:

    ../app/libapp.a(keys.c.obj):(.rodata.bootutil_keys+0x0): undefined reference to `ecdsa_pub_key'
    ../app/libapp.a(keys.c.obj):(.rodata.bootutil_keys+0x4): undefined reference to `ecdsa_pub_key_len'

Signed-off-by: David Brown <david.brown@linaro.org>
2019-01-22 16:08:46 -07:00
David Brown 2bc2685b2a ptest: Start of utility to run tests in parallel
The travis config allows multiple tests to run in parallel.  Run a small
program that does the same thing.

Signed-off-by: David Brown <david.brown@linaro.org>
2019-01-18 14:01:04 -07:00
Fabio Utzig 432c32c928 Fix ECDSA signature builds in Zephyr
Commit 3ac36ead3 updated the bundled asn1parser, which now consists of
two files. The Zephyr build system was not updated with that commit which
has broken ECDSA signature builds. This adds the new file.

This fixes #397.

Signed-off-by: Fabio Utzig <utzig@apache.org>
2019-01-18 12:33:19 -07:00
Emanuele Di Santo 30a9265bc8 boot: zephyr: select GPIO when MCUBOOT_SERIAL is enabled
Select GPIO when MCUBOOT_SERIAL is enabled.

Signed-off-by: Emanuele Di Santo <emdi@nordicsemi.no>
2019-01-18 12:31:24 -07:00
Fabio Utzig 05ab014e36 Update sim ecdsa testing to use ring signing
This removes the unsafe Tinycrypt bindings previously used for signing
with ECDSA, and relies on ring native support.

The ring library was updated to 0.14.1.

Signed-off-by: Fabio Utzig <utzig@apache.org>
2019-01-18 09:44:48 -07:00
Fabio Utzig 006994b754 Fix a buffer overflow on EC point load
While loading a new EC point, when it was smaller than the expected
number of bytes, a zero padding was being written beyond the end of the
buffer instead of at the initial position.

While this has been working before, it broke when images were signed using
the ring API.

Signed-off-by: Fabio Utzig <utzig@apache.org>
2019-01-18 09:44:48 -07:00
Fabio Utzig 90abedc752 Add ECDSA-P256 key in PKCS#8 format
The ring crypto library used by the simulator only accepts PEM keys in
PKCS#8 format; this provides a conversion of the original bundled key.

```
$ openssl pkcs8 -topk8 -nocrypt -in ../root-ec-p256.pem -out ../root-ec-p256-pkcs8.pem
```

Signed-off-by: Fabio Utzig <utzig@apache.org>
2019-01-18 09:44:48 -07:00
Ruth Fuchss db1a5f3b6a doc: fix typo in file name
Broken link in design.md since the file name is misspelled.

Signed-off-by: Ruth Fuchss <ruth.fuchss@nordicsemi.no>
2019-01-14 15:00:35 -02:00
Emanuele Di Santo c7514ad7a0 boot: zephyr: pca10059: disable logging by default
The board cannot output logs on the UART because it is used
by MCUBoot's serial recovery for DFU. Remove logging and
the RTT console from project defaults.

Signed-off-by: Emanuele Di Santo <emdi@nordicsemi.no>
2019-01-14 10:10:54 +01:00