Commit Graph

2261 Commits

Author SHA1 Message Date
David Brown a5c12c6ad7 Merge pull request #44 from utzig/create-doc
Move design doc to doc dir
2017-05-01 09:38:38 -06:00
David Brown 079793ca46 Merge pull request #43 from d3zd3z/frdm
Better frdm_k64f partitions
2017-05-01 09:38:28 -06:00
David Brown 8b445b5737 Merge pull request #42 from d3zd3z/tinycrypt
Tinycrypt updates
2017-05-01 09:38:17 -06:00
David Brown 45979592a7 Merge pull request #40 from utzig/switch-to-mynewt-master
Switch mynewt repo to master
2017-05-01 09:34:27 -06:00
David Brown 946b2bea4d Merge pull request #39 from utzig/fix-random-resets
Fix random reset behavior
2017-05-01 09:34:12 -06:00
Fabio Utzig 9d6ee9de31 Move design doc to doc dir 2017-05-01 07:41:59 -03:00
David Brown b8e9dde77c frdm_k64f: Use entire flash.
Expand the data slots to 384K each, leaving the boot and scratch areas
as 128K.  This allows more room for code, but will wear the scratch
partition about 3x faster because of the more extensive use of the
partition.
2017-04-27 16:35:27 -06:00
David Brown e629bf3745 Generalize SHA256 code to allow tinycrypt support
When building with ECDSA P-256 as the signature algorithm, we are still
bringing in SHA256 and some ASN.1 code from mbed TLS.  Fix part of this
by wrapping the hash functions with general routines (inline functions)
allowing to select between mbed TLS and Tinycrypt for the
implementation.

Update the Zephyr config files so that the Tinycrypt version is used
when building the ECDSA P-256 signing variant.
2017-04-27 16:31:12 -06:00
David Brown d7e350df7d zephyr: Fix up mbed TLS configuration
There are some problems with how mbed TLS is configured in Zephyr.
First, include the makefile stub in the Makefile that uses these
defines.  This makes sure the right definitions get made so that our
custom config gets used for all compiled files, rather than a mixed set.

Also, fix up the wrappers on the custom configs so that each is
different, making it easier to detect if multiple configs are being
included.

Lastly, only include the right header in the image validation.  The mbed
TLS includes don't seem to want to allow both RSA and ECDSA to be used
(due to the key size), and including the wrong header results in a
compilation error.
2017-04-27 16:31:04 -06:00
Fabio Utzig e3aa2e00b1 Switch mynewt repo to master 2017-04-26 10:49:44 -03:00
Fabio Utzig 57652319ae Fix random reset behaviour 2017-04-25 19:54:26 -03:00
David Brown 3e1c38c624 Merge pull request #38 from utzig/magic-sz-const
Use constant for magic size
2017-04-25 15:01:24 -06:00
David Brown 91c2fd6703 Merge pull request #37 from utzig/max-align-as-param
Make max align size a #define
2017-04-25 15:00:39 -06:00
David Brown 2ad2f96720 Merge pull request #36 from utzig/add-generated-to-ignore
Add more state files to ignore list
2017-04-25 15:00:08 -06:00
David Brown bef227c3a0 Merge pull request #35 from utzig/increase-sim-debug-info
Add extra information on errors
2017-04-25 14:59:42 -06:00
Fabio Utzig 19b2c1a927 Add extra information on errors
* Print bail out error information
* Print specific location of non-ff writes
2017-04-20 08:25:30 -03:00
Fabio Utzig 24a273d451 Use constant for magic size
- This also fixes an issue that could arrive if the magic is only partly
  erased.
2017-04-20 08:21:31 -03:00
Fabio Utzig 644b8d4f06 Make max align size a #define 2017-04-20 07:56:05 -03:00
Fabio Utzig 923d7e4c85 Add more state files to ignore list 2017-04-20 07:50:12 -03:00
David Brown 7406f18e49 Merge pull request #33 from d3zd3z/zepspace
Make zephyr code comply with indentation of rest of mcuboot
2017-04-12 07:47:16 -06:00
David Brown d87c3fd996 Merge pull request #32 from utzig/missing-syscfg-descs
Add descriptions to syscfg.yml options
2017-04-11 18:51:47 -06:00
David Brown 74b3c58f53 zephyr: Add braces around single lines
The coding guidelines for mcuboot specify using braces around all
single-line constructs.  Add these to those lines missing this.
2017-04-11 17:59:05 -06:00
David Brown 0d0652a10f zephyr: use indentation consistent across mcuboot
The original Zephyr platform support files use tabs for indentation
(to match the Zephyr project).  Since this code is all together, and
will be used as the basis for other platforms, fix this indentation to
match that used by the rest of mynewt.

This change is clean with respect to "git show -b", and only changes
the indentation of the beginning of lines.
2017-04-11 17:59:04 -06:00
Fabio Utzig fb291e4467 Add descriptions to syscfg.yml options 2017-04-11 16:20:16 -03:00
David Brown 83a3380884 Merge pull request #31 from d3zd3z/revert-shuffle
Back out unneeded part of random reset test
2017-04-11 09:12:15 -06:00
David Brown 4cb2623574 Back out unneeded part of random reset test
In change

    commit bb5635e074
    Author: Fabio Utzig <utzig@utzig.org>
    Date:   Mon Apr 10 09:07:02 2017 -0300

        Add test of multiple random resets while upgrading

in addition to adding the try_random_fails, it shuffled the order that
the initial interruption test ran.  However, this test always clones
the flash device, so it doesn't matter what order the tests are run.
Revert this part of the change to avoid unnecessary complexity in the
code.
2017-04-11 08:18:18 -06:00
David Brown a9c6661d80 Merge pull request #30 from utzig/random-resets-on-upgrade
Add test of multiple random resets while upgrading
2017-04-10 11:58:17 -06:00
Fabio Utzig bb5635e074 Add test of multiple random resets while upgrading 2017-04-10 09:07:02 -03:00
David Brown 4055d64dea Merge pull request #28 from d3zd3z/sim
Sim updates
2017-04-01 23:52:06 -06:00
David Brown 0fc2d47b1b Create a .travis.yml
Build and run the simulator for testing with travis.
2017-03-29 16:27:25 -06:00
David Brown a3b93cfe95 sim: Add runall command
Add a `runall` command that will run all combinations of devices and
alignments.

Jira: MCUB-44
2017-03-29 13:02:13 -06:00
David Brown 361be7ade7 sim: Return exit status from sim run
Instead of just printing a message, return an exit status so that
scripts running the sim can more easily tell if the tests passed.

Jira: MCUB-45
2017-03-29 13:01:44 -06:00
David Brown 274f7874db sim: Show address for overwrite error
When trying to write to the flash to a non-FF location, put the
location of the failure in the error message to help diagnose the
problem.
2017-03-29 13:01:13 -06:00
David Brown 07fb8fa0c8 sim: Add NRF52840 device
Add the flash device from the NRF52840 SoC.
2017-03-29 13:01:13 -06:00
David Brown 5c6b6798d0 sim: Use simulated flash configuration
There are some instances of hard-coded offsets, which break if the
simulated device doesn't have the same configuration.  Query these
from the flash descriptor rather than hard-coding them.
2017-03-29 13:01:13 -06:00
David Brown 0daa36c99f sim: Remove phantom declaration from CAreaDesc
Although this contains a phantom pointer, because it is passed to C,
this generates a warning on every compile.  Until this is fixed,
remove the lifetime declarations from the structures.  The user will
have to make sure that the pointed-to structures remain until the C
structure is completed.  For the common case of generating the C
structures just to make a call, this should be safe.
2017-03-29 12:58:40 -06:00
David Brown fdd68a1041 Merge pull request #27 from mbolivar/nrf52840
Nrf52840
2017-03-21 14:24:31 -06:00
Marti Bolivar 7f6ea1599d zephyr: add nrf52840_pca10056 target
This board, called the NRF52840-PDK in marketing materials, is a
preview development board for the nRF52840 SoC.

Flash layout (4 KiB sectors):

        User    Start   End     Size (KiB) Size (B)
        ------- ------- ------- ---------- --------
        mcuboot 0x00000 0x07FFF         32  0x08000
        Image 0 0x08000 0x73FFF        432  0x6C000
        Image 1 0x74000 0xDFFFF        432  0x6C000
        Scratch 0xE0000 0xFCFFF        116  0x1D000

Signed-off-by: Marti Bolivar <marti.bolivar@linaro.org>
2017-03-21 15:48:17 -04:00
Marti Bolivar 29d3a77d3b zephyr: fix flash_area_to_sectors()
This fixes MCUB-39.

On Zephyr targets, flash_area_to_sectors() assumes that the flash
device's sector size is equal to the size of the scratch area.

That breaks swap and rollback when scratch size doesn't divide image
size, since the image flash areas will not be correctly configured.
This is a valid configuration supported by the rest of mcuboot.

The best way to fix this would be to get the flash layout from Zephyr,
but that's not possible yet.

Instead, provide a new FLASH_AREA_IMAGE_SECTOR_SIZE define from
target.h. This must be the sector size for these areas:

       - FLASH_AREA_IMAGE_0
       - FLASH_AREA_IMAGE_1
       - FLASH_AREA_IMAGE_SCRATCH

Other areas on the device may have sizes different than
FLASH_AREA_IMAGE_SECTOR_SIZE.

This won't work on platforms where those areas have nonuniform sector
sizes, but we'll cross that bridge when we come to it. (At that point,
an upstream Zephyr change to the flash API really seems needed.)

Revert to the old/buggy behavior when FLASH_AREA_IMAGE_SECTOR_SIZE
isn't provided, but emit a warning. Additionally, touch up the logging
and error handling while we're here.

Signed-off-by: Marti Bolivar <marti.bolivar@linaro.org>
2017-03-21 15:48:15 -04:00
Marti Bolivar 94f3f91ca7 zephyr: 96b_nitrogen: increase scratch space
The current configuration only allows ~170 updates before we can
expect wear on the flash device (per product spec that the flash
device supports 10,000 erase cycles). Increase the scratch size to
make this better by removing some application space, to allow for
~2500 application updates or rollbacks.

The new configuration is 52 KiB (13 sectors) for scratch, and 208
KiB (52 sectors) for each application image.

Signed-off-by: Marti Bolivar <marti.bolivar@linaro.org>
2017-03-21 15:39:53 -04:00
Marti Bolivar 51181cf34f zephyr: add "real" target header
MCUBOOT_TARGET_CONFIG is included in several places now,
not just boot/zephyr/main.c. This seems likely to continue.

Let's avoid trouble and make it a real header file, target.h, that
pulls in MCUBOOT_TARGET_CONFIG. That done, include target.h instead
everywhere MCUBOOT_TARGET_CONFIG is included.

This will make it easier to provide values at an SoC/family level
later.  We can expect different Zephyr boards to have the same SoC and
thus likely the same mcuboot flash layout, so this will avoid
duplication.

All supported boards are compile-tested.

Signed-off-by: Marti Bolivar <marti.bolivar@linaro.org>
2017-03-21 15:39:46 -04:00
aditihilbert 64fdcaba4c Update README.md 2017-03-20 15:42:50 -07:00
Marti Bolivar 1011b433c2 zephyr: flash_map: fix up logging
The Zephyr log backend already prepends the function, so it's
redundant to do it here.

Also convert a stray SYS_LOG_ERR to BOOT_LOG_ERR().

Signed-off-by: Marti Bolivar <marti.bolivar@linaro.org>
2017-03-20 09:00:58 -04:00
Ricardo Salveti 8e4d44d1e4 zephyr: disable clock before reset
Avoid clock related interrupts before jumping into the first image. Safe
to disable as the first application will enable the clock/timer again
once booted.

Signed-off-by: Ricardo Salveti <ricardo.salveti@linaro.org>
2017-03-17 15:12:17 -04:00
David Brown e1942988a4 Merge pull request #26 from andrewboie/master
x86 config updates
2017-03-16 17:25:34 -06:00
Andrew Boie c41cb110bd arduino_101: disable some additional options
We won't need the GPIO, timer, or pinmux drivers for
functioning asa bootloader, and some extra exception
debug info has been disabled.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-03-16 15:22:25 -07:00
Andrew Boie ae790ddd49 Makefile: update location of target-specific .conf
arduino_101.conf was moved up a level, but the toplevel Makefile
was not updated so that it can be located.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-03-16 14:39:04 -07:00
David Brown ff4658e44f Merge pull request #25 from mbolivar/arduino-101-conf
arm fixes from x86 changes
2017-03-16 13:22:35 -06:00
Marti Bolivar 836768b2da zephyr: fix do_boot() warning on ARM
Commit 7238f51 ("zephyr: add support for x86 booting method")
introduced a backend-specific do_boot() function. On ARM, this casts
to an undefined type 'struct vector_table*'.  Fix this by using the
'struct arm_vector_table*' introduced in that patch.

Signed-off-by: Marti Bolivar <marti.bolivar@linaro.org>
2017-03-16 15:14:21 -04:00
Marti Bolivar 77683adc20 Move arduino_101.conf to boot/zephyr/.
It's currently one level down, in boot/zephyr/targets, from the rest
of the .conf files.

Signed-off-by: Marti Bolivar <marti.bolivar@linaro.org>
2017-03-16 15:06:20 -04:00