doc: getting_started: Support multi-OS instructions
In order to be able to document the build on Windows and UNIX
systems, slight variations are required on the app commands
that are used throughout the documentation system.
This includes getting rid of the prompt symbol and providing commands
for both UNIX and Windows operating systems.
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
@ -73,6 +73,7 @@ emulated environment, for example, with the :ref:`synchronization_sample`:
@@ -73,6 +73,7 @@ emulated environment, for example, with the :ref:`synchronization_sample`:
@ -82,6 +82,7 @@ emulated environment. For example, with the :ref:`synchronization_sample`:
@@ -82,6 +82,7 @@ emulated environment. For example, with the :ref:`synchronization_sample`:
@ -17,6 +17,7 @@ emulated environment, for example, with the :ref:`synchronization_sample`:
@@ -17,6 +17,7 @@ emulated environment, for example, with the :ref:`synchronization_sample`:
set ZEPHYR_SDK_INSTALL_DIR=<sdk installation directory>
#. Navigate to the main project directory:
..code-block:: console
$ cd zephyr
cd zephyr
#. Source the project environment file to set the project environment
variables:
#. Set the project environment variables:
..code-block:: console
$ source zephyr-env.sh
# On Linux/macOS
source zephyr-env.sh
# On Windows
set ZEPHYR_BASE=%cd%
#. Build the :ref:`hello_world` example for the `arduino_101` board, enter:
@ -94,6 +121,16 @@ To build an example application follow these steps:
@@ -94,6 +121,16 @@ To build an example application follow these steps:
:build-dir:arduino_101
:goals:build
On Linux/macOS you can also build with ``make`` instead of ``ninja``:
..zephyr-app-commands::
:zephyr-app:samples/hello_world
:generator:make
:host-os:unix
:board:arduino_101
:build-dir:arduino_101
:goals:build
You can build for a different board by defining the variable BOARD
with another of the supported boards, for example:
@ -109,10 +146,10 @@ of the supported boards:
@@ -109,10 +146,10 @@ of the supported boards:
..code-block:: console
$ make usage
ninja usage
Sample projects for different features of the project are available at
at :file:`$ZEPHYR_BASE/samples`.
at :file:`ZEPHYR_BASE/samples`.
After building an application successfully, the results can be found in the
directory where cmake was invoked.
@ -121,7 +158,6 @@ The ELF binaries generated by the build system are named by default
@@ -121,7 +158,6 @@ The ELF binaries generated by the build system are named by default
configuration The build system generates different names for different use cases
depending on the hardware and boards used.
.._sdkless_builds:
Building without the Zephyr SDK
@ -145,21 +181,29 @@ must be installed.
@@ -145,21 +181,29 @@ must be installed.
..code-block:: console
$ unset ZEPHYR_GCC_VARIANT
$ unset ZEPHYR_SDK_INSTALL_DIR
$ cd <zephyr git clone location>
$ source zephyr-env.sh
# On Linux/macOS
unset ZEPHYR_GCC_VARIANT
unset ZEPHYR_SDK_INSTALL_DIR
cd <zephyr git clone location>
source zephyr-env.sh
# On Windows
set ZEPHYR_GCC_VARIANT=
set ZEPHYR_SDK_INSTALL_DIR=
cd <zephyr git clone location>
set ZEPHYR_BASE=%cd%
#. Build Kconfig in :file:`$ZEPHYR_BASE/build` and add it to path
#. On UNIX platforms, Build Kconfig in :file:`$ZEPHYR_BASE/build` and add
To run an application using the x86 emulation board configuration (qemu_x86),
type:
..code-block:: console
$ cd $ZEPHYR_BASE/samples/hello_world
$ mkdir qemu_build && cd qemu_build
$ cmake -DBOARD=qemu_x86 ..
$ make run
..zephyr-app-commands::
:zephyr-app:samples/hello_world
:host-os:unix
:board:qemu_x86
:goals:build run
To exit the qemu emulator, press ``Ctrl-a``, followed by ``x``.
@ -223,9 +270,6 @@ QEMU is not supported on all boards and SoCs. When developing for a specific
@@ -223,9 +270,6 @@ QEMU is not supported on all boards and SoCs. When developing for a specific
hardware target you should always test on the actual hardware and should not
rely on testing in the QEMU emulation environment only.
.._GCC ARM Embedded: https://launchpad.net/gcc-arm-embedded
@ -29,14 +29,14 @@ before upgrading:
@@ -29,14 +29,14 @@ before upgrading:
..code-block:: console
$ sudo apt-get update
$ sudo apt-get upgrade
sudo apt-get update
sudo apt-get upgrade
On Fedora:
..code-block:: console
$ sudo dnf upgrade
sudo dnf upgrade
Note that having a newer version available for an installed package
(and reported by ``dnf check-update``) does not imply a subsequent
@ -52,7 +52,7 @@ Install the required packages in a Ubuntu host system with:
@@ -52,7 +52,7 @@ Install the required packages in a Ubuntu host system with:
python3-ply python3-pip python3-setuptools xz-utils file make gcc-multilib
@ -60,27 +60,27 @@ Install the required packages in a Fedora host system with:
@@ -60,27 +60,27 @@ Install the required packages in a Fedora host system with:
@ -120,7 +120,7 @@ Follow these steps to install the SDK on your Linux host system.
@@ -120,7 +120,7 @@ Follow these steps to install the SDK on your Linux host system.
#. Run the installation binary, follow this example:
@ -131,7 +131,7 @@ Follow these steps to install the SDK on your Linux host system.
@@ -131,7 +131,7 @@ Follow these steps to install the SDK on your Linux host system.
..code-block:: console
$ sh zephyr-sdk-<version>-setup.run
sh zephyr-sdk-<version>-setup.run
There is no need to use ``sudo`` if the SDK is installed in the current
user's home directory.
@ -146,15 +146,15 @@ Follow these steps to install the SDK on your Linux host system.
@@ -146,15 +146,15 @@ Follow these steps to install the SDK on your Linux host system.
@ -106,9 +106,9 @@ Install tools needed for building the toolchain (if needed):
@@ -106,9 +106,9 @@ Install tools needed for building the toolchain (if needed):
To build the toolchain, you will need the latest version of crosstool-ng (1.23).
@ -117,7 +117,7 @@ however try and see if you get 1.23 installed:
@@ -117,7 +117,7 @@ however try and see if you get 1.23 installed:
..code-block:: console
$ brew install crosstool-ng
brew install crosstool-ng
Alternatively you can install the latest version of :program:`crosstool-ng`
from source. Download the latest version from the `crosstool-ng site`_. The
@ -125,12 +125,12 @@ latest version usually supports the latest released compilers.
@@ -125,12 +125,12 @@ latest version usually supports the latest released compilers.
@ -158,9 +158,9 @@ When mounted, the file system of the image will be available under
@@ -158,9 +158,9 @@ When mounted, the file system of the image will be available under
..code-block:: console
$ cd /Volumes/CrossToolNG
$ mkdir build
$ cd build
cd /Volumes/CrossToolNG
mkdir build
cd build
Setting the Toolchain Options
=============================
@ -179,15 +179,15 @@ Currently the following configurations are provided:
@@ -179,15 +179,15 @@ Currently the following configurations are provided:
You can create a toolchain configuration or customize an existing configuration
yourself using the configuration menus:
..code-block:: console
$ export CT_PREFIX=/Volumes/CrossToolNG
$ ct-ng oldconfig
export CT_PREFIX=/Volumes/CrossToolNG
ct-ng oldconfig
Verifying the Configuration of the Toolchain
============================================
@ -220,7 +220,7 @@ To build the toolchain, enter:
@@ -220,7 +220,7 @@ To build the toolchain, enter:
..code-block:: console
$ ct-ng build
ct-ng build
The above process takes a while. When finished, the toolchain will be available
under :file:`/Volumes/CrossToolNG/x-tools`.
@ -232,8 +232,8 @@ and use the target location where the toolchain was installed, type:
@@ -232,8 +232,8 @@ and use the target location where the toolchain was installed, type:
To use the same toolchain in new sessions in the future you can set the
@ -241,7 +241,7 @@ variables in the file :file:`${HOME}/.zephyrrc`, for example:
@@ -241,7 +241,7 @@ variables in the file :file:`${HOME}/.zephyrrc`, for example:
#. The build system should now be ready to work with any toolchain installed in
your system. In the next step you'll find instructions for installing
@ -118,8 +118,8 @@ packages from their respective websites.
@@ -118,8 +118,8 @@ packages from their respective websites.
..code-block:: console
> set ZEPHYR_GCC_VARIANT=issm
> set ISSM_INSTALLATION_PATH=c:\issm0-toolchain-windows-2017-01-25
set ZEPHYR_GCC_VARIANT=issm
set ISSM_INSTALLATION_PATH=c:\issm0-toolchain-windows-2017-01-25
Use the path where you extracted the ISSM toolchain.
@ -127,15 +127,15 @@ packages from their respective websites.
@@ -127,15 +127,15 @@ packages from their respective websites.
..code-block:: console
> set ZEPHYR_GCC_VARIANT=gccarmemb
> set GCCARMEMB_TOOLCHAIN_PATH=c:\gccarmemb
set ZEPHYR_GCC_VARIANT=gccarmemb
set GCCARMEMB_TOOLCHAIN_PATH=c:\gccarmemb
And for either, set the `ZEPHYR_BASE` environment variable to the root
of the Zephyr repository you cloned:
..code-block:: console
> set ZEPHYR_BASE=%userprofile%\zephyr
set ZEPHYR_BASE=%userprofile%\zephyr
#. Finally, you can try building the :ref:`hello_world` sample to check things
out.
@ -144,6 +144,7 @@ packages from their respective websites.
@@ -144,6 +144,7 @@ packages from their respective websites.
..zephyr-app-commands::
:zephyr-app:samples/hello_world
:host-os:win
:generator:ninja
:board:arduino_101
:goals:build
@ -152,6 +153,7 @@ packages from their respective websites.
@@ -152,6 +153,7 @@ packages from their respective websites.
..zephyr-app-commands::
:zephyr-app:samples/hello_world
:host-os:win
:generator:ninja
:board:nrf52_pca10040
:goals:build
@ -194,16 +196,16 @@ environment for Windows. Follow the steps below to set it up:
@@ -194,16 +196,16 @@ environment for Windows. Follow the steps below to set it up:
#. If you're behind a corporate firewall, you'll likely need to specify a
#. From within the MSYS2 MSYS Shell, clone a copy of the Zephyr source
into your home directory using Git. (Some Zephyr tools require
@ -213,16 +215,16 @@ environment for Windows. Follow the steps below to set it up:
@@ -213,16 +215,16 @@ environment for Windows. Follow the steps below to set it up:
$ cd ~/zephyr # or to the folder where you cloned the zephyr repo
$ pip install --user -r scripts/requirements.txt
curl -O 'https://bootstrap.pypa.io/get-pip.py'
./get-pip.py
rm get-pip.py
cd ~/zephyr # or to the folder where you cloned the zephyr repo
pip install --user -r scripts/requirements.txt
#. The build system should now be ready to work with any toolchain installed in
your system. In the next step you'll find instructions for installing
@ -237,8 +239,8 @@ environment for Windows. Follow the steps below to set it up:
@@ -237,8 +239,8 @@ environment for Windows. Follow the steps below to set it up:
You'll need the tar application to unpack this file. In an ``MSYS2 MSYS``
console, install ``tar`` and use it to extract the toolchain archive::
$ pacman -S tar
$ tar -zxvf /c/Users/myusername/Downloads/issm-toolchain-windows-2017-01-15.tar.gz -C /c
pacman -S tar
tar -zxvf /c/Users/myusername/Downloads/issm-toolchain-windows-2017-01-15.tar.gz -C /c
substituting the .tar.gz path name with the one you downloaded.
@ -261,8 +263,8 @@ environment for Windows. Follow the steps below to set it up:
@@ -261,8 +263,8 @@ environment for Windows. Follow the steps below to set it up:
Use the path where you extracted the ISSM toolchain.
@ -270,29 +272,29 @@ environment for Windows. Follow the steps below to set it up:
@@ -270,29 +272,29 @@ environment for Windows. Follow the steps below to set it up:
..code-block:: console
$ export ZEPHYR_GCC_VARIANT=gccarmemb
$ export GCCARMEMB_TOOLCHAIN_PATH=/c/gccarmemb
export ZEPHYR_GCC_VARIANT=gccarmemb
export GCCARMEMB_TOOLCHAIN_PATH=/c/gccarmemb
And for either, run the provided script to set up zephyr project specific
variables:
..code-block:: console
$ unset ZEPHYR_SDK_INSTALL_DIR
$ cd <zephyr git clone location>
$ source zephyr-env.sh
unset ZEPHYR_SDK_INSTALL_DIR
cd <zephyr git clone location>
source zephyr-env.sh
#. Within the MSYS console, build Kconfig in :file:`$ZEPHYR_BASE/build` and
@ -306,6 +308,7 @@ To build for the Intel |reg| Quark |trade| (x86-based) Arduino 101:
@@ -306,6 +308,7 @@ To build for the Intel |reg| Quark |trade| (x86-based) Arduino 101:
..zephyr-app-commands::
:zephyr-app:samples/hello_world
:board:arduino_101
:host-os:win
:goals:build
To build for the ARM-based Nordic nRF52 Development Kit:
@ -313,6 +316,7 @@ To build for the ARM-based Nordic nRF52 Development Kit:
@@ -313,6 +316,7 @@ To build for the ARM-based Nordic nRF52 Development Kit:
..zephyr-app-commands::
:zephyr-app:samples/hello_world
:board:nrf52_pca10040
:host-os:win
:goals:build
This should check that all the tools and toolchain are set up correctly for
@ -62,6 +62,7 @@ locate the source code of this sample application and type:
@@ -62,6 +62,7 @@ locate the source code of this sample application and type:
..zephyr-app-commands::
:zephyr-app:samples/net/http_server
:host-os:unix
:board:qemu_x86
:goals:run
:compact:
@ -180,6 +181,7 @@ In order to compile and run the code execute:
@@ -180,6 +181,7 @@ In order to compile and run the code execute:
@ -67,6 +67,7 @@ Build the lwm2m-client sample application for QEMU like this:
@@ -67,6 +67,7 @@ Build the lwm2m-client sample application for QEMU like this:
..zephyr-app-commands::
:zephyr-app:samples/net/lwm2m_client
:host-os:unix
:board:qemu_x86
:goals:run
:compact:
@ -87,6 +88,7 @@ To build the lwm2m-client sample for QEMU with DTLS support do the following:
@@ -87,6 +88,7 @@ To build the lwm2m-client sample for QEMU with DTLS support do the following: