Skip to content

Commit a09d3d6

Browse files
mbolivar-nordiccarlescufi
authored andcommitted
doc: west: add tl;dr for moving to west and troubleshooting
These are based on user feedback on slack and the mailing list. Signed-off-by: Marti Bolivar <[email protected]>
1 parent bd4b248 commit a09d3d6

File tree

3 files changed

+110
-0
lines changed

3 files changed

+110
-0
lines changed

doc/guides/west/index.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ context about the tool.
3434
:maxdepth: 1
3535

3636
install.rst
37+
moving-to-west.rst
38+
troubleshooting.rst
3739
repo-tool.rst
3840
manifest.rst
3941
config.rst

doc/guides/west/moving-to-west.rst

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
.. _moving-to-west:
2+
3+
Moving to West
4+
##############
5+
6+
To convert a "pre-west" Zephyr setup on your computer to west, follow these
7+
steps. If you are starting from scratch, use the :ref:`getting_started`
8+
instead. See :ref:`west-troubleshooting` for advice on common issues.
9+
10+
#. Install west.
11+
12+
On Linux::
13+
14+
pip3 install --user -U west
15+
16+
On Windows and macOS::
17+
18+
pip3 install -U west
19+
20+
For details, see :ref:`west-install`.
21+
22+
#. Move your zephyr repository to a new :file:`zephyrproject` parent directory,
23+
and change directory there.
24+
25+
On Linux and macOS::
26+
27+
mkdir zephyrproject
28+
mv zephyr zephyrproject
29+
cd zephyrproject
30+
31+
On Windows ``cmd.exe``::
32+
33+
mkdir zephyrproject
34+
move zephyr zephyrproject
35+
chdir zephyrproject
36+
37+
The name :file:`zephyrproject` is recommended, but you can choose any name
38+
with no spaces anywhere in the path.
39+
40+
#. Create a :ref:`west installation <west-installation>` using the zephyr
41+
repository as a local manifest repository::
42+
43+
west init -l zephyr
44+
45+
This creates :file:`zephyrproject/.west`, marking the root of your
46+
installation, and does some other setup. It will not change the contents of
47+
the zephyr repository in any way.
48+
49+
#. Clone the rest of the repositories used by zephyr::
50+
51+
west update
52+
53+
**Make sure to run this command whenever you pull zephyr.** Otherwise, your
54+
local repositories will get out of sync. (Run ``west list`` for current
55+
information on these repositories.)
56+
57+
You are done: :file:`zephyrproject` is now set up to use west.
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
.. _west-troubleshooting:
2+
3+
Troubleshooting West
4+
####################
5+
6+
This page covers common issues with west and how to solve them.
7+
8+
"invalid choice: 'post-init'"
9+
*****************************
10+
11+
If you see this error when running ``west init``:
12+
13+
.. code-block:: none
14+
15+
west: error: argument <command>: invalid choice: 'post-init'
16+
(choose from 'init', 'update', 'list', 'manifest', 'diff',
17+
'status', 'forall', 'config', 'selfupdate', 'help')
18+
19+
Then you have an old version of west installed, and are trying to use it in an
20+
installation that requires a more recent version.
21+
22+
The easiest way to resolve this issue is to upgrade west and retry as follows:
23+
24+
#. Install the latest west with the ``-U`` option for ``pip3 install`` as shown
25+
in :ref:`west-install`.
26+
27+
#. Back up any contents of :file:`zephyrproject/.west/config` that you want to
28+
save. (If you don't have any configuration options set, it's safe to skip
29+
this step.)
30+
31+
#. Completely remove the :file:`zephyrproject/.west` directory (if you don't,
32+
you will get the "already in an installation" error message discussed next).
33+
34+
#. Run ``west init`` again.
35+
36+
"already in an installation"
37+
****************************
38+
39+
You may see this error when running ``west init``:
40+
41+
.. code-block:: none
42+
43+
FATAL ERROR: already in an installation (<some directory>), aborting
44+
45+
If this is unexpected and you're really trying to create a new installation,
46+
then it's likely that west is using the :envvar:`ZEPHYR_BASE` :ref:`environment
47+
variable <env_vars>` to locate a west installation elsewhere on your system.
48+
This is intentional behavior; it allows you to put your Zephyr applications in
49+
any directory and still use west.
50+
51+
To resolve this issue, unset :envvar:`ZEPHYR_BASE` and try again.

0 commit comments

Comments
 (0)