Added the bindesc command to west, for working with binary
descriptors. Currently it supports dump, list and search
subcommands, for bin, hex, elf and uf2 file types.
Signed-off-by: Yonatan Schachter <yonatan.schachter@gmail.com>
As part of the overall work on improving west integration with Zephyr,
add support for zsh completion in the `west completion` command.
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
This patch introduces the basic infrastructure to list and fetch binary
blobs. This includes:
- The new 'blobs' extension command
- An implementation of the `west blobs list` command
with custom formatting
- A very simple mechanism for loading fetchers
- A basic implementation of an HTTP fetcher
In order to ensure consistency among the west extension commands in the
main zephyr tree, we reuse a similar class factory pattern that is present
for ZephyrBinaryRunner instances in the ZephyrBlobFetcher case. This
could be achieved with a simpler mechanism, but opted for consistency
before simplicity.
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
This adds support to generate SPDX 2.2 tag-value documents via the
new west spdx command. The CMake file-based APIs are leveraged to
create relationships from source files to the corresponding
generated build files. SPDX-License-Identifier comments in source
files are scanned and filled into the SPDX documents.
Before `west build` is run, a specific file must be created in the
build directory so that the CMake API reply will run. This can be
done by running:
west spdx --init -d BUILD_DIR
After `west build` is run, SPDX generation is then activated by
calling `west spdx`; currently this requires passing the build
directory as a parameter again:
west spdx -d BUILD_DIR
This will generate three SPDX documents in `BUILD_DIR/spdx/`:
1) `app.spdx`: This contains the bill-of-materials for the
application source files used for the build.
2) `zephyr.spdx`: This contains the bill-of-materials for the
specific Zephyr source code files that are used for the build.
3) `build.spdx`: This contains the bill-of-materials for the built
output files.
Each file in the bill-of-materials is scanned, so that its hashes
(SHA256 and SHA1) can be recorded, along with any detected licenses
if an `SPDX-License-Identifier` appears in the file.
SPDX Relationships are created to indicate dependencies between
CMake build targets; build targets that are linked together; and
source files that are compiled to generate the built library files.
`west spdx` can be called with optional parameters for further
configuration:
* `-n PREFIX`: specifies a prefix for the Document Namespaces that
will be included in the generated SPDX documents. See SPDX spec 2.2
section 2.5 at
https://spdx.github.io/spdx-spec/2-document-creation-information/.
If -n is omitted, a default namespace will be generated according
to the default format described in section 2.5 using a random UUID.
* `-s SPDX_DIR`: specifies an alternate directory where the SPDX
documents should be written. If not specified, they will be saved
in `BUILD_DIR/spdx/`.
* `--analyze-includes`: in addition to recording the compiled
source code files (e.g. `.c`, `.S`) in the bills-of-materials, if
this flag is specified, `west spdx` will attempt to determine the
specific header files that are included for each `.c` file. This
will take longer, as it performs a dry run using the C compiler
for each `.c` file (using the same arguments that were passed to it
for the actual build).
* `--include-sdk`: if `--analyze-includes` is used, then adding
`--include-sdk` will create a fourth SPDX document, `sdk.spdx`,
which will list any header files included from the SDK.
Signed-off-by: Steve Winslow <steve@swinslow.net>
This command make it possible to use west for first time registration
of a Zephyr config package in CMake.
To register Zephyr as a CMake config package, invoke:
west zephyr-export
Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
Add a completion command that dumps the contents of a shell
completion file present in the zephyr repository.
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
Add a new "boards" command that is able to list all the boards in the
upstream tree. There is currently no support for out-of-tree boards.
The command executes cmake to use the built-in CMake script,
boards.cmake, to list the boards, and then stores the information
retrieved and allows the user to present it in a user-definable format.
Fixes https://github.com/zephyrproject-rtos/west/issues/53
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
This command is useful for signing binaries for loading by a
bootloader. At present, only MCUboot's "imgtool" is supported, but it
would be straightforward to add support for additional tools.
Using this command instead of "plain" imgtool avoids looking up any
numbers for the flash write block size, text section offset, or slot
size to get a signed binary. All users need to specify is the location
of the signing key.
This greatly improves usability for those unfamiliar with MCUboot, or
even experienced users who have to deal with multiple flash partition
layouts, boards, etc.
The command works by inspecting state in the Zephyr build system, some
of which is also provided by the runner package.
Signed-off-by: Marti Bolivar <marti@foundries.io>
Although each of these command implementations has good output for
"west <command> --help", the "west --help" output is missing the
one-line descriptions.
Add them by modifying west-commands.yml to use a new 'help' key in
each command name. These need to be kept in sync with the Python
sources. For now just do that by copy/pasting. We could add fancy
logic to load the help from west-commands.yml later if we want.
Signed-off-by: Marti Bolivar <marti@foundries.io>
West now supports a mechanism for extension commands. Use it to move
the command implementations that are tightly coupled with boards and
the zephyr build system back into the Zephyr repository.
This patch doesn't include test cases. Those will be moved over in a
subsequent patch.
Signed-off-by: Marti Bolivar <marti@foundries.io>