From 2a892d5d6d70becfb2c7f4c2dcdf9f2cc7ef45fc Mon Sep 17 00:00:00 2001 From: Anas Nashif Date: Tue, 15 May 2018 09:52:49 +0300 Subject: [PATCH] doc: update mac instructions Use sdn-ng scripts to build toolchain instead of repeating them here. Fixes #6912 Signed-off-by: Anas Nashif --- doc/getting_started/installation_mac.rst | 119 +++-------------------- 1 file changed, 13 insertions(+), 106 deletions(-) diff --git a/doc/getting_started/installation_mac.rst b/doc/getting_started/installation_mac.rst index 8d362a415e0..059c3f960a9 100644 --- a/doc/getting_started/installation_mac.rst +++ b/doc/getting_started/installation_mac.rst @@ -108,114 +108,20 @@ To build for the ARM-based Nordic nRF52 Development Kit: Setting Up the Toolchain ************************ -Install tools needed for building the toolchain (if needed): +In case a toolchain is not available for the board you are using, you can build +a toolchain from scratch using crosstool-NG. Follow the steps on the +crosstool-NG website to `prepare your host +`_ -.. code-block:: console +Follow the `Zephyr SDK with Crosstool NG instructions `_ to build +the toolchain for various architectures. You will need to clone the ``sdk-ng`` +repo and run the following command:: - brew install gettext help2man mpfr gmp coreutils wget - brew tap homebrew/dupes - brew install grep --with-default-names + ./go.sh +.. note:: + Currently only i586 and arm builds are verified. -To build the toolchain, you will need crosstool-ng version 1.23 or higher. -Install it by using Homebrew: - -.. code-block:: console - - brew install crosstool-ng - -Creating a Case-sensitive File System -===================================== - -Building the compiler requires a case-sensitive file system. Therefore, use -:program:`diskutil` to create an 8 GB blank sparse image making sure you select -case-sensitive file system (OS X Extended (Case-sensitive, Journaled) and -mount it. - -Alternatively you can use the script below to create the image: - -.. code-block:: bash - - #!/bin/bash - ImageName=CrossToolNG - ImageNameExt=${ImageName}.sparseimage - diskutil umount force /Volumes/${ImageName} && true - rm -f ${ImageNameExt} && true - hdiutil create ${ImageName} -volname ${ImageName} -type SPARSE -size 8g -fs HFSX - hdiutil mount ${ImageNameExt} - cd /Volumes/$ImageName - -When mounted, the file system of the image will be available under -:file:`/Volumes`. Change to the mounted directory: - -.. code-block:: console - - cd /Volumes/CrossToolNG - mkdir build - cd build - -Setting the Toolchain Options -============================= - -In the Zephyr kernel source tree we provide configurations for NIOS-II and -X86 that can be used to preselect the options needed for building the toolchain. - -The configuration files can be found in -:file:`${ZEPHYR_BASE}/scripts/cross_compiler/`. - -Currently the following configurations are provided: - -* i586.config: for standard ABI, for example for Galileo and qemu_x86 -* iamcu.config: for IAMCU ABI, for example for the Arduino 101 -* nios2.config: for Nios II boards - -.. code-block:: console - - cp ${ZEPHYR_BASE}/scripts/cross_compiler/i586.config .config - -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 - -Verifying the Configuration of the Toolchain -============================================ - -Before building the toolchain it is advisable to perform a quick verification -of the configuration set for the toolchain. - -1. Open the generated :file:`.config` file. - -2. Verify the following lines are present, assuming the sparse image was - mounted under :file:`/Volumes/CrossToolNG`: - -.. code-block:: bash - - ... - CT_LOCAL_TARBALLS_DIR="/Volumes/CrossToolNG/src" - # CT_SAVE_TARBALLS is not set - CT_WORK_DIR="${CT_TOP_DIR}/.build" - CT_PREFIX_DIR="/Volumes/CrossToolNG/x-tools/${CT_TARGET}" - CT_INSTALL_DIR="${CT_PREFIX_DIR}" - # Following options prevent link errors - CT_WANTS_STATIC_LINK=n - CT_CC_STATIC_LIBSTDCXX=n - ... - -Building the Toolchain -====================== - -To build the toolchain, enter: - -.. code-block:: console - - ct-ng build - -The above process takes a while. When finished, the toolchain will be available -under :file:`/Volumes/CrossToolNG/x-tools`. Repeat the step for all architectures you want to support in your environment. @@ -225,7 +131,7 @@ and use the target location where the toolchain was installed, type: .. code-block:: console export ZEPHYR_TOOLCHAIN_VARIANT=xtools - export XTOOLS_TOOLCHAIN_PATH=/Volumes/CrossToolNG/x-tools + export XTOOLS_TOOLCHAIN_PATH=/Volumes/CrossToolNGNew/build/output/ To use the same toolchain in new sessions in the future you can set the @@ -234,7 +140,7 @@ variables in the file :file:`${HOME}/.zephyrrc`, for example: .. code-block:: console cat < ~/.zephyrrc - export XTOOLS_TOOLCHAIN_PATH=/Volumes/CrossToolNG/x-tools + export XTOOLS_TOOLCHAIN_PATH=/Volumes/CrossToolNGNew/build/output/ export ZEPHYR_TOOLCHAIN_VARIANT=xtools EOF @@ -244,3 +150,4 @@ variables in the file :file:`${HOME}/.zephyrrc`, for example: .. _Homebrew site: http://brew.sh/ .. _crosstool-ng site: http://crosstool-ng.org +