1.. _no-west: 2 3Using Zephyr without west 4######################### 5 6This page provides information on using Zephyr without west. This is 7not recommended for beginners due to the extra effort involved. In 8particular, you will have to do work "by hand" to replace these 9features: 10 11- cloning the additional source code repositories used by Zephyr in 12 addition to the main zephyr repository, and keeping them up to date 13- specifying the locations of these repositories to the Zephyr build 14 system 15- flashing and debugging without understanding detailed usage of the 16 relevant host tools 17 18.. note:: 19 20 If you have previously installed west and want to stop using it, 21 uninstall it first: 22 23 .. code-block:: console 24 25 pip3 uninstall west 26 27 Otherwise, Zephyr's build system will find it and may try to use 28 it. 29 30Getting the Source 31------------------ 32 33In addition to downloading the zephyr source code repository itself, 34you will need to manually clone the additional projects listed in the 35:term:`west manifest` file inside that repository. 36 37.. code-block:: console 38 39 mkdir zephyrproject 40 cd zephyrproject 41 git clone https://github.com/zephyrproject-rtos/zephyr 42 # clone additional repositories listed in zephyr/west.yml, 43 # and check out the specified revisions as well. 44 45As you pull changes in the zephyr repository, you will also need to 46maintain those additional repositories, adding new ones as necessary 47and keeping existing ones up to date at the latest revisions. 48 49Building applications 50--------------------- 51 52You can build a Zephyr application using CMake and Ninja (or make) directly 53without west installed if you specify any modules manually. 54 55.. zephyr-app-commands:: 56 :zephyr-app: samples/hello_world 57 :tool: cmake 58 :goals: build 59 :gen-args: -DZEPHYR_MODULES=module1;module2;... 60 :compact: 61 62When building with west installed, the Zephyr build system will use it to set 63:ref:`ZEPHYR_MODULES <important-build-vars>`. 64 65If you don't have west installed and your application does not need any of 66these repositories, the build will still work. 67 68If you don't have west installed and your application *does* need one 69of these repositories, you must set :makevar:`ZEPHYR_MODULES` 70yourself as shown above. 71 72See :ref:`modules` for more details. 73 74Similarly, if your application requires binary blobs and you are not using 75west, you will need to download and place those blobs in the right places 76instead of using ``west blobs``. See :ref:`bin-blobs` for more details. 77 78Flashing and Debugging 79---------------------- 80 81Running build system targets like ``ninja flash``, ``ninja debug``, 82etc. is just a call to the corresponding :ref:`west command 83<west-build-flash-debug>`. For example, ``ninja flash`` calls ``west 84flash``\ [#wbninja]_. If you don't have west installed on your system, running 85those targets will fail. You can of course still flash and debug using 86any :ref:`flash-debug-host-tools` which work for your board (and which those 87west commands wrap). 88 89If you want to use these build system targets but do not want to 90install west on your system using ``pip``, it is possible to do so 91by manually creating a :term:`west workspace`: 92 93.. code-block:: console 94 95 # cd into zephyrproject if not already there 96 git clone https://github.com/zephyrproject-rtos/west.git .west/west 97 98Then create a file :file:`.west/config` with the following contents: 99 100.. code-block:: none 101 102 [manifest] 103 path = zephyr 104 105 [zephyr] 106 base = zephyr 107 108After that, and in order for ``ninja`` to be able to invoke ``west`` 109to flash and debug, you must specify the west directory. This can be 110done by setting the environment variable ``WEST_DIR`` to point to 111:file:`zephyrproject/.west/west` before running CMake to set up a 112build directory. 113 114.. rubric:: Footnotes 115 116.. [#wbninja] 117 118 Note that ``west build`` invokes ``ninja``, among other 119 tools. There's no recursive invocation of either ``west`` or 120 ``ninja`` involved by default, however, as ``west build`` does not 121 invoke ``ninja flash``, ``debug``, etc. The one exception is if you 122 specifically run one of these build system targets with a command 123 line like ``west build -t flash``. In that case, west is run twice: 124 once for ``west build``, and in a subprocess, again for ``west 125 flash``. Even in this case, ``ninja`` is only run once, as ``ninja 126 flash``. This is because these build system targets depend on an 127 up to date build of the Zephyr application, so it's compiled before 128 ``west flash`` is run. 129