Commit Graph

572 Commits

Author SHA1 Message Date
Carles Cufí e09e2084a1
Merge pull request #263 from carlescufi/zephyr_doc_tweaks
doc: zephyr: Extend info about flashing
2018-04-05 13:23:29 +02:00
Carles Cufi 5a9688a5ac doc: zephyr: Extend info about flashing
Add precisions to the information regarding flashing MCUboot and Zephyr
application images in order to make users aware of mass-erase scenarios
that might bite them.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2018-04-03 17:10:18 +02:00
Fabio Utzig 30f6b2a908 Fix boot_serial to follow flash write alignment
This fixes an issue found on stm32f3 where newtmgr after writing an odd
sized packet, would hardfault on the next write due to trying to write an
odd address which is not valid on stm32f3 flash.

Signed-off-by: Fabio Utzig <utzig@apache.org>
2018-04-03 11:42:58 -03:00
Fabio Utzig 1d46c944ed Always enable uart, use blocking mode
Signed-off-by: Fabio Utzig <utzig@apache.org>
2018-03-29 16:33:25 -03:00
Fabio Utzig 2a33aa26ed Add logging support for Mynewt
Signed-off-by: Fabio Utzig <utzig@apache.org>
2018-03-29 16:33:25 -03:00
Fabio Utzig 6771601435 Fix printf size warning
Signed-off-by: Fabio Utzig <utzig@apache.org>
2018-03-29 16:33:25 -03:00
Carles Cufi 0165be8ba8 boot_serial: zephyr: Use new base64 library
Instead of relying on mbedTLS' base64 codec, use the new Zephyr base64
library.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2018-03-27 10:12:11 -03:00
Carles Cufi efd783cf97 doc: zephyr: Refer to the BOOTLOADER_MCUBOOT Kconfig option
Since the sample application now uses the BOOTLOADER_MCUBOOT
configuration option, refer to it in the Zephyr documentation itself.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2018-03-27 10:09:48 -03:00
Carles Cufi 6168f427ee doc: Document support for .hex files in imgtool
Specify in the documentation that .hex files are supported by imgtool
when signing.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2018-03-27 10:09:48 -03:00
Carles Cufi b791138c0c samples: zephyr: Use BOOTLOADER_MCUBOOT
Instead of manually setting the text section offset and the overlay
file, use the now readily available BOOTLOADER_MCUBOOT Kconfig option to
provide that automatically.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2018-03-27 10:09:18 -03:00
Marti Bolivar 58b321a89f zephyr: CMakeLists: allow users to specify DTC_OVERLAY_FILE fragments
Allow the user to add additional device tree overlays onto the default
one that sets up the code partition.

Signed-off-by: Marti Bolivar <marti@opensourcefoundries.com>
2018-03-26 12:46:40 -03:00
David Brown 57837b98e6 zephyr: arm: Use proper macro to set MSP
The macro _MspSet has gone away in Zephyr.  Change to use the __set_MSP
macro from the CMSIS code that has always been present.  This allows
mcuboot to build with Zephyr after:

    commit c028f88b37d2a033d6a85c8d365ef048e1e4d621
    Author: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
    Date:   Mon Mar 12 10:45:02 2018 +0100

        arch: arm: remove redundant asm inline headers

Fixes #246.

Signed-off-by: David Brown <david.brown@linaro.org>
2018-03-14 10:09:55 -06:00
David Brown d9d28a78d4 zephyr: Fix overlay dir for Zephyr build
The Zephyr CMakeLists.txt uses its own logic to have board-specific
overlays, named boards/${BOARD}.prj.  However, the only overlay file we
have, arduino_101.conf, isn't in this boards directory, and this target
doesn't build.

Fix this by moving the target into the right directory.  Fixes #188.

Signed-off-by: David Brown <david.brown@linaro.org>
2018-03-13 16:39:14 -06:00
Christopher Collins db974f2fc2 Mynewt app: Remove .OVERWITE suffix from pkg.deps
The boot loader app needs all the base dependencies, whether or not
`BOOT_SERIAL` is enabled.  Therefore, it makes sense for the serial boot
loader to add to, rather than replace, the dependency list.

This bug in the pkg.yml file went unnoticed ealier because of an issue
in newt: it used to effectively ignore the `.OVERWRITE` suffix when it
was applied to `pkg.deps`.

Signed-off-by: Christopher Collins <ccollins@apache.org>
2018-02-23 20:50:37 -03:00
David Brown 3f9ec900c4 zephyr: Configure mbed TLS for PSS instead of V1.5
Although MCUboot has used PKCS#1 v2.1 (PSS) for some time now, the mbed
TLS config file was calling out v1.5.  This compiled because MCUboot
implements its own specialized version of the signature check, and only
needs the underlying primitives from mbed TLS.  (The general code in
mbed TLS is quite a bit larger).

To make it clear that we are always using PSS, change the mbed TLS
configuration to call this out explicitly.

Signed-off-by: David Brown <david.brown@linaro.org>
2018-02-23 09:38:47 -07:00
Fabio Utzig 9f7c3d2096 Initialize "uart" only when boot_serial is enabled
Signed-off-by: Fabio Utzig <utzig@apache.org>
2018-02-22 15:51:39 -07:00
Andrzej Kaczmarek c49099c284 Make boot serial work on Mynewt
Signed-off-by: Andrzej Kaczmarek <andrzej.kaczmarek@codecoup.pl>
Signed-off-by: Fabio Utzig <utzig@apache.org>
2018-02-22 15:51:39 -07:00
Fabio Utzig 1a2e41ae44 Fix serial boot functionality for Mynewt
Signed-off-by: Fabio Utzig <utzig@apache.org>
2018-02-22 15:51:39 -07:00
Fabio Utzig fe9dd965f5 Fix with correct release numbers
Signed-off-by: Fabio Utzig <utzig@apache.org>
2018-02-16 16:45:03 -07:00
Johann Fischer ed8461b604 bootutil: loader: fix BOOT_STATUS_ASSERT macro
BOOT_STATUS_ASSERT increments the variable if the macro argument
is evaluated as true, which is incorrect behavior compared to the
ASSERT macro.

Signed-off-by: Johann Fischer <j.fischer@phytec.de>
2018-02-16 16:44:17 -07:00
Fabio Utzig 84ed794d14 Fix configuration when RSA signature is used
This defines the correct "mbedtls" config files in both ECDSA256 and RSA
modes.

Signed-off-by: Fabio Utzig <utzig@apache.org>
2018-02-16 16:31:38 -07:00
Fabio Utzig b519ed03dc Use relative links for docs
- Also fix imgtool script link

Signed-off-by: Fabio Utzig <utzig@apache.org>
2018-02-16 16:23:09 -07:00
Ding Tao b664a082aa zephyr: mbedtls: Fix compile error no such file or directory
Upstream zephyr will automatically link mbedtls when CONFIG_MBEDTLS is
enabled.

If user chose to use ECDSA_P256 as signature type, will get a compile
error message in file ${ZEPHYR_BASE}/ext/lib/crypto/mbedtls/zephyr_init.c:
    fatal error: config-asn1.h: No such file or directory

Fix this by disable CONFIG_MBEDTLS  when ECDSA_P256 signature type is
selected.

Signed-off-by: Ding Tao <miyatsu@qq.com>
2018-02-14 13:55:23 -02:00
David Brown b77262e18d Bump internal mbedtls to 2.7.0
2.7.0 fixes a security issue but breaks MCU boot.  Bump to this version
so that the simulator will verify that this version works properly.

Signed-off-by: David Brown <david.brown@linaro.org>
2018-02-13 15:10:36 -07:00
David Brown 785dc4c9b3 Fix RSA sigs for mbed TLS 2.7.0
In 2f8f06aa25

    commit 2f8f06aa25e9d5ee4fc9fe217543c872b39e4d05
    Author: Hanno Becker <hanno.becker@arm.com>
    Date:   Fri Sep 29 11:47:26 2017 +0100

        Don't always recompute context length in mbedtls_rsa_get_len

mbed TLS begins assuming that the 'len' field of the context has been
set properly.  Previously, we relied on this not being true, and various
tests fail for all keys without setting this.

The fix is to simply set the length based on the value we read.

fixes #235.

Signed-off-by: David Brown <david.brown@linaro.org>
2018-02-13 15:10:36 -07:00
Fabio Utzig 4dce6aac8b Change all doc links to use relative names
Github pages assumes that links to files using relative
names point to the same location so this should work both
when accessing through the github browser and mcuboot.com

Signed-off-by: Fabio Utzig <utzig@apache.org>
2018-02-12 15:53:07 -02:00
Carles Cufi 37d052fff1 imgtool: Add support for Intel Hex images
Some platforms prefer images in the Intel Hex (.hex) format. Implement
support for signing images in this format in imgtool.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2018-02-01 16:00:21 -07:00
Carles Cufi f242901a85 imgtool: Use a requirements file for dependencies
Instead of relying on distro packages standardize the imgtool
dependencies into a requirements.txt.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2018-02-01 16:00:21 -07:00
Marti Bolivar 6f2857c2a7 zephyr: add compatibility shim for flash driver name
The upstream Zephyr project is renaming FLASH_DRIVER_NAME to
FLASH_DEV_NAME as part of some changes related to device tree.

Work around this for now by keeping the MCUboot name the same if
FLASH_DRIVER_NAME is not provided by Zephyr, but FLASH_DEV_NAME is.

Signed-off-by: Marti Bolivar <marti@opensourcefoundries.com>
2018-02-01 15:59:18 -07:00
Marti Bolivar aefbd46631 zephyr: try to mass erase when flashing
It's recommended practice to mass erase the flash chip before
reflashing mcuboot. Add a configuration option for Zephyr which does
this by default on some Zephyr runner backends which can support
this (pyOCD and dfu-util). Additional runners can be added as needed.

Signed-off-by: Marti Bolivar <marti@opensourcefoundries.com>
2018-01-30 16:17:52 -07:00
Marti Bolivar 388454880f zephyr: fix MCUBOOT_TARGET_CONFIG definition
When the target doesn't have good enough generic support for MCUBoot,
you can specify the flash layout etc on a per-board basis by creating
a header, boot/zephyr/targets/BOARD.h.

The build system tries to pick this up, but isn't doing it
correctly. Fix it.

Signed-off-by: Marti Bolivar <marti@opensourcefoundries.com>
2018-01-29 14:35:38 -07:00
David Brown 8e0016eb14 zephyr: Create a test runner for the samples
Enhance the test runner so that it can verify the output of the tests by
itself.  This needs the console to be logged to a file, but otherwise
works the same as the current test runner.

Also, the build results are placed in a log file, so that it is easier
to see what is happening.

Signed-off-by: David Brown <david.brown@linaro.org>
2018-01-29 14:29:48 -07:00
Marti Bolivar dde1b1c481 zephyr: fix the build
Since the Kconfig file was moved in 51a0921006 ("zephyr: Move Kconfig
file to boot/zephyr"), the CMakeLists.txt reference to it needs updating.

Signed-off-by: Marti Bolivar <marti@opensourcefoundries.com>
2018-01-29 14:04:13 -07:00
Carles Cufi 67c792efbb zephyr: Enable flash page layout if available
Since not all ICs default to enabling flash page layout, enable it from
the MCUboot Kconfig options whenever it is available.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2018-01-29 12:22:48 -07:00
Carles Cufi 84ede5893f kconfig: Add new MCUboot device settings
Add a new MCUboot device settings option that enables or configures
features that are specific to a particular device.
Additionally enable software vector relay in Cortex-M0 CPUs that do not
have a hardware mechanism to relay or forward interrupts.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2018-01-29 12:22:48 -07:00
Carles Cufi 51a0921006 zephyr: Move Kconfig file to boot/zephyr
Since the Kconfig file is only relevant to Zephyr, move it from the root
folder into boot/zephyr, in order to keep all Zephyr-related files
together.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2018-01-29 12:22:48 -07:00
Sebastian Bøe 9c38d76677 zephyr: hello-world: Samples should not define default boards
hello-world is serving as a sample application and should therefore
not define a default board as Zephyr samples do not either.

Signed-off-by: Sebastian Bøe <sebastian.boe@nordicsemi.no>
2018-01-29 16:19:37 -02:00
Sebastian Bøe 688a216a1a zephyr: hello-world: Remove documentaiton for non-existant feature
The documentation claims that one can place per-board overlay files in
the boards/ directory. But no such support has been implemented.

Signed-off-by: Sebastian Bøe <sebastian.boe@nordicsemi.no>
2018-01-29 16:19:37 -02:00
Sebastian Bøe 8680b90374 zephyr: boot: Use abs. path instead of rel. path for dts overlay
When a relative path was used the build would fail when CMake was
invoked with the -B -H flags. Using an absolute path for the
dts.overlay flags fixes #187.

Signed-off-by: Sebastian Bøe <sebastian.boe@nordicsemi.no>
2018-01-29 16:19:05 -02:00
Carles Cufi 90eda80838 doc: Fix MCUboot capitalization
The correct spelling is "MCUboot", so replace the instances that differ
from this.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2018-01-29 15:49:04 -02:00
Fabio Utzig ecc7e14e55 Update nokogiri due to security vulnerability
http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2017-9050

Signed-off-by: Fabio Utzig <utzig@apache.org>
2018-01-24 07:07:36 -02:00
Carles Cufi 3b61e70b8b docs: Link to instructions from landing pages
Link to usage instructions from the main README file and from
docs/index.md so that the usage is visible from the root documentation
files.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2018-01-23 14:08:14 -02:00
Carles Cufi ecc34bb787 doc: Convert rst to md and move to docs/
To avoid having multiple documentation standards, transition all
documentation files to the Markdown (md) format and move them to the
docs/ folder.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2018-01-23 14:08:14 -02:00
Fabio Utzig f70e302617 Fix warn in overwrite-only with slot0 validation
Signed-off-by: Fabio Utzig <utzig@apache.org>
2018-01-10 10:35:10 -07:00
Fabio Utzig 891f4fb023 Fix EC API usage due to change in mbed-TLS
Signed-off-by: Fabio Utzig <utzig@apache.org>
2018-01-10 10:34:45 -07:00
Fabio Utzig 476fd99d82 Bump to version 1.1.0
Signed-off-by: Fabio Utzig <utzig@apache.org>
2018-01-09 16:36:52 -02:00
Fabio Utzig 07d65c9a73 Update Mynewt version numbers
Signed-off-by: Fabio Utzig <utzig@apache.org>
2018-01-09 11:32:45 -07:00
Fabio Utzig 49045cc9e8 Update with 1.1.0 release notes
Signed-off-by: Fabio Utzig <utzig@apache.org>
2018-01-09 10:58:29 -07:00
David Brown f88d9f95d4 imgtool: Add password support to ECDSA
Signed-off-by: David Brown <david.brown@linaro.org>
2018-01-09 09:41:30 -07:00
David Brown 31d29c8edb imgtool: Update docs for new key format
Update the dependencies needed, as well as adding a blurb about how to
password protect the private key.

Signed-off-by: David Brown <david.brown@linaro.org>
2018-01-09 09:41:30 -07:00