Commit Graph

18 Commits

Author SHA1 Message Date
honglin leng 37e4223413 sample:zephyr: decrease some hard code
Signed-off-by: honglin leng <a909204013@gmail.com>
2022-10-04 16:27:18 -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
David Brown 358ca1ae4f Use Ninja instead of Makefiles for Zephyr
Zephyr builds use 'cmake' which can generate either makefiles, or use
the Ninja build tools.  There are several significant advantages to
using Ninja as the build tool:

  - It is significantly faster.  Ninja reads a directory and stats the
    files in it once.  Make often stats a given directory thousands of
    times, many for files that don't even exist.

  - It has better output.  Ninja collects commands together with their
    error output.  When doing multi-cpu builds, Ninja prints a status
    indicator, and only prints fully verbose commands when that command
    fails.  Instead of having to try an piece together a given command
    with its errors, they will always be together.

  - Make's support of multiple CPUs is a crude hack.  Make forks off
    multiple processes to use multiple CPUs.  These processes don't
    communicate with each other (very much), which causes make to often
    continue after enountering errors.  It is common for a multi-CPU
    make invocation to print hundreds or thousands of additional lines
    after an error message.

Nearly all distros have a version of Ninja available in their package
manager, making this change of low cost.

Signed-off-by: David Brown <david.brown@linaro.org>
2019-07-29 11:29:21 -05: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
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
Fabio Utzig ffffbaded0 Fix multi-line script call
Signed-off-by: Fabio Utzig <utzig@apache.org>
2018-07-10 09:51:06 -03:00
Fabio Utzig 44588eff41 Update `--included-header` parameter
The `--included-header` was "mandatory" when using imgtool with firmware
images generated by the Zephyr build system and it was a source of
issues when it was forgotten. This removes `--included-header` and adds
a new parameter `--pad-header` with inverted semantics, to be used only
when a zeroed header is required to be added to the firmware image.

Signed-off-by: Fabio Utzig <utzig@apache.org>
2018-06-22 07:58:14 -03:00
Fabio Utzig 263d4398fa Add --slot-size to allow size checking without pad
Add the new `--slot-size` and make `--pad` a bool flag, to allow
checking that firmware fits in the slot without overflowing into the
trailer region even when no padding was requested.

Fixes #241

Signed-off-by: Fabio Utzig <utzig@apache.org>
2018-06-07 14:29:33 -03:00
Marti Bolivar a87984327a zephyr: migrate upgrade-only to Kconfig
Handle CONFIG_BOOT_UPGRADE_ONLY in mcuboot_config.h, and switch the
release test Makefile to using an OVERLAY_CONFIG fragment.

This removes the last user of the Makefile BOOTLOADER_CONFIG variable,
so delete it as well.

Signed-off-by: Marti Bolivar <marti@opensourcefoundries.com>
2018-04-25 18:44:03 -03:00
Marti Bolivar 15c9b6f944 zephyr: migrate slot 0 validation to Kconfig
Handle CONFIG_BOOT_VALIDATE_SLOT0 in mcuboot_config.h, and switch to
setting it with an OVERLAY_CONFIG fragment in the test Makefile.

Signed-off-by: Marti Bolivar <marti@opensourcefoundries.com>
2018-04-25 18:44:03 -03:00
Marti Bolivar a4818a5565 zephyr: migrate signature type to Kconfig
Handle the CONFIG_BOOT_SIGNATURE_TYPE_xxx values in Zephyr's
mcuboot_config.h by converting them into the platform-agnostic MCUboot
definitions.

This requires some changes to the way the release test Makefile is
structured, since Kconfig symbols cannot be set from the command line.

Instead, use the OVERLAY_CONFIG feature of the Zephyr build system,
which allows specifying extra fragments to merge into the final
.config. (This is an orthogonal mechanism to setting CONF_FILE; it is
used by Zephyr's CI script sanitycheck to add additional fragments, so
it's appropriate for use by MCUboot's testing scripts as well.)

We additionally need to move to a single prj.conf file due to a
dependency issue. We can no longer determine CONF_FILE from the
signature type, since that is now determined from the final .config or
autoconf.h, which is a build output that depends on CONF_FILE.

To move to a single prj.conf:

- delete prj-p256.conf and adjust prj.conf to serve both signature types
- add a top-level mbedTLS configuration file which dispatches to
  the right sub-header depending on the key type
- as a side effect, have the simulator pick the right config file
  depending on the case

This fixes and cleans up quite a bit of the signature type handling,
which had become something of a mess over time. For example, it fixes
a bug in ECDSA mode's configuration that wasn't actually selecting
config-asn1.h, and forces the simulator to use the same mbedTLS
configuration file as builds for real hardware.

Finally, we also have to move the mbedTLS vs. TinyCrypt choice into
mcuboot_config.h at the same time as well, since CMakeLists.txt was
making that decision based on the signature type.

Signed-off-by: Marti Bolivar <marti@opensourcefoundries.com>
2018-04-25 18:44:03 -03:00
Marti Bolivar bf909a1fcc zephyr: port build system to CMake
Convert the Zephyr build to the new CMake-based sytem.

Signed-off-by: Marti Bolivar <marti@opensourcefoundries.com>
2017-11-20 18:10:29 -07:00
David Brown 1d3f67d36e zephyr: Move testplan into sample Makefile
Instead of a bunch of patches that tend to become conflicting, use the
newly parameterized Makefile to make all of the test plans into make
targets.  Update the instructions to match this.

Signed-off-by: David Brown <david.brown@linaro.org>
2017-09-14 16:10:50 -06:00
Marti Bolivar b9f5a68dac samples: zephyr: use unified application
Replace the hello1 and hello2 applications with hello-world.

Signed-off-by: Marti Bolivar <marti.bolivar@linaro.org>
2017-08-03 07:19:06 -06:00
Marti Bolivar 7135410196 samples: zephyr: trivial Makefile fixes
Signed-off-by: Marti Bolivar <marti.bolivar@linaro.org>
2017-08-03 07:19:06 -06:00
David Brown 84a67af32c zephyr: sample: Add flash for full.bin
Previous commits added the full.bin target.  Add a flash_full target to
be able to flash this full image for testing.

Signed-off-by: David Brown <david.brown@linaro.org>
2017-07-26 18:42:29 -06:00
David Brown dbc5727902 samples: Add a 'full.bin' target to Zephyr sample
This full.bin target demonstrates how to assemble all of the images into
a single file which can be flashed to the device.  As it is, it will
then boot into the first "primary" image.  The second image will be
present, but will not ever be run.

Signed-off-by: David Brown <david.brown@linaro.org>
2017-07-20 14:55:50 -06:00
David Brown ada28e1b69 samples: Create a zephyr sample
Most of the meat of this is in the Makefile, which is able to build the
bootloader, and two small applications, along with instructions on how
to load these into flash and test that upgrades work.

JIRA: MCUB-62
Signed-off-by: David Brown <david.brown@linaro.org>
2017-07-10 11:16:25 -06:00