2018-09-01 01:56:05 +08:00
|
|
|
This is the Zephyr RTOS meta tool, ``west``.
|
2018-06-05 00:04:47 +08:00
|
|
|
|
2018-09-14 07:36:19 +08:00
|
|
|
For more information about west, see:
|
|
|
|
|
|
|
|
https://docs.zephyrproject.org/latest/west/index.html
|
|
|
|
|
2018-09-01 01:56:05 +08:00
|
|
|
Installation
|
|
|
|
------------
|
2018-06-05 00:04:47 +08:00
|
|
|
|
2018-09-01 01:56:05 +08:00
|
|
|
Install west's bootstrapper with pip::
|
2018-06-05 00:04:47 +08:00
|
|
|
|
2018-09-01 01:56:05 +08:00
|
|
|
pip3 install west
|
2018-06-09 05:51:00 +08:00
|
|
|
|
2018-09-01 01:56:05 +08:00
|
|
|
Then install the rest of west and a Zephyr development environment in
|
|
|
|
a directory of your choosing::
|
2018-06-09 05:51:00 +08:00
|
|
|
|
2018-09-01 01:56:05 +08:00
|
|
|
mkdir zephyrproject && cd zephyrproject
|
|
|
|
west init
|
|
|
|
west fetch
|
2018-06-09 05:51:00 +08:00
|
|
|
|
2018-09-01 01:56:05 +08:00
|
|
|
What just happened:
|
2018-06-09 05:51:00 +08:00
|
|
|
|
2018-09-01 01:56:05 +08:00
|
|
|
- ``west init`` runs the bootstrapper, which clones the west source
|
|
|
|
repository and a *west manifest* repository. The manifest contains a
|
|
|
|
YAML description of the Zephyr installation, including Git
|
|
|
|
repositories and other metadata. The ``init`` command is the only
|
|
|
|
one supported by the bootstrapper itself; all other commands are
|
|
|
|
implemented in the west source repository it clones.
|
2018-06-09 05:51:00 +08:00
|
|
|
|
2018-09-01 01:56:05 +08:00
|
|
|
- ``west fetch`` clones the repositories in the manifest, creating
|
|
|
|
working trees in the installation directory. In this case, the
|
|
|
|
bootstrapper notices the command (``fetch``) is not ``init``, and
|
|
|
|
delegates handling to the "main" west implementation in the source
|
|
|
|
repository it cloned in the previous step.
|
2018-06-09 05:51:00 +08:00
|
|
|
|
2018-09-01 01:56:05 +08:00
|
|
|
(For those familiar with it, this is similar to how Android's Repo
|
|
|
|
tool works.)
|
2018-06-09 05:51:00 +08:00
|
|
|
|
2018-09-01 01:56:05 +08:00
|
|
|
Usage
|
|
|
|
-----
|
2018-06-09 05:51:00 +08:00
|
|
|
|
2018-09-01 01:56:05 +08:00
|
|
|
West has multiple sub-commands. After running ``west init``, you can
|
|
|
|
run them from anywhere under ``zephyrproject``.
|
2018-06-09 05:51:00 +08:00
|
|
|
|
2018-09-01 01:56:05 +08:00
|
|
|
For a list of available commands, run ``west -h``. Get help on a
|
|
|
|
command with ``west <command> -h``. For example::
|
2018-06-09 05:51:00 +08:00
|
|
|
|
2018-09-01 01:56:05 +08:00
|
|
|
$ west -h
|
|
|
|
usage: west [-h] [-z ZEPHYR_BASE] [-v]
|
|
|
|
{build,flash,debug,debugserver,attach,list-projects,fetch,pull,rebase,branch,checkout,diff,status,forall}
|
|
|
|
...
|
|
|
|
[snip]
|
|
|
|
$ west flash -h
|
|
|
|
usage: west flash [-h] [-H] [-d BUILD_DIR] ...
|
|
|
|
[snip]
|
2018-06-09 05:51:00 +08:00
|
|
|
|
2018-09-01 01:56:05 +08:00
|
|
|
Test Suite
|
|
|
|
----------
|
2018-06-09 05:51:00 +08:00
|
|
|
|
2018-09-01 01:56:05 +08:00
|
|
|
To run the test suite, run this from the west repository::
|
2018-06-09 05:51:00 +08:00
|
|
|
|
2018-09-01 01:56:05 +08:00
|
|
|
pip3 install -r tests_requirements.txt
|
|
|
|
python3 setup.py test
|
2018-06-09 05:51:00 +08:00
|
|
|
|
2018-09-01 01:56:05 +08:00
|
|
|
Hacking on West
|
|
|
|
---------------
|
2018-06-09 05:51:00 +08:00
|
|
|
|
2018-09-01 01:56:05 +08:00
|
|
|
West is distributed as two Python packages:
|
2018-06-09 05:51:00 +08:00
|
|
|
|
2018-09-01 01:56:05 +08:00
|
|
|
1. A ``bootstrap`` package, which is distributed via PyPI. Running
|
|
|
|
``pip3 install west`` installs this **bootstrapper package only**.
|
|
|
|
2. The "main" ``west`` package, which is fetched by the bootstrapper
|
|
|
|
when ``west init`` is run.
|
2018-06-09 05:51:00 +08:00
|
|
|
|
2018-09-01 01:56:05 +08:00
|
|
|
This somewhat unusual arrangement is because:
|
2018-06-05 00:04:47 +08:00
|
|
|
|
2018-09-01 01:56:05 +08:00
|
|
|
- One of west's jobs is to manage a Zephyr installation's Git
|
|
|
|
repositories, including its own.
|
|
|
|
- It allows easy customization of the version of west that's shipped
|
|
|
|
with non-upstream distributions of Zephyr.
|
|
|
|
- West is experimental and is not stable. Users need to stay in sync
|
|
|
|
with upstream, and this allows west to automatically update itself.
|
2018-06-05 00:04:47 +08:00
|
|
|
|
2018-09-01 01:56:05 +08:00
|
|
|
To initialize west from a non-default location::
|
2018-08-01 01:03:53 +08:00
|
|
|
|
2018-09-01 01:56:05 +08:00
|
|
|
west init -w https://example.com/your-west-repository.git
|
|
|
|
|
|
|
|
You can also add ``--west-rev some-branch`` to use ``some-branch``
|
|
|
|
instead of ``master``.
|
|
|
|
|
|
|
|
To use another manifest repository (optionally with ``--mr
|
|
|
|
some-manifest-branch``)::
|
|
|
|
|
|
|
|
west init -u https://example.com/your-manifest-repository.git
|
|
|
|
|
|
|
|
After ``init`` time, you can hack on the west tree in ``zephyrproject``.
|
|
|
|
|
|
|
|
To install everything in development mode instead, clone the west
|
|
|
|
repository and run this from the top level directory::
|
|
|
|
|
|
|
|
pip3 install -e .
|
|
|
|
|
|
|
|
(On Linux, make sure ``~/.local/bin`` is in your ``PATH`` if you go
|
|
|
|
this route.)
|
|
|
|
|
|
|
|
If you don't want to change your system outside of cloning this
|
|
|
|
repository (and installing dependencies), you can run the ``west``
|
|
|
|
package as a module. In a Bash shell::
|
|
|
|
|
|
|
|
PYTHONPATH=/path/to/west/repository/src python3 -m west
|
2018-08-01 01:03:53 +08:00
|
|
|
|
2018-09-01 01:56:05 +08:00
|
|
|
In a Windows command shell::
|
2018-08-01 01:03:53 +08:00
|
|
|
|
2018-09-01 01:56:05 +08:00
|
|
|
cmd /C "set PYTHONPATH=/path/to/west/repo && python3 -m west"
|