quickstart.rst 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. .. include:: /substitutions.rst
  2. .. _quickstart:
  3. Quickstart
  4. ==========
  5. Here's the quick version of getting started with NuttX. This is a bare-bones outline for experienced developers– if it's
  6. going too quickly, dive into the following sections. This Quickstart guide assumes you're on a Linux
  7. computer, you're using an ARM microcontroller on your embedded board, and you're familiar with using the command line.
  8. #. Install a Cross-Compiler Toolchain
  9. With NuttX, you compile the operating system and your application on your desktop or laptop computer, then install the
  10. binary file on your embedded computer. This guide assumes your computer is an
  11. `ARM <https://en.wikipedia.org/wiki/ARM_architecture>`_ CPU. If it isn't, you'll need a different tool chain.
  12. You can download a toolchain from
  13. `ARM Embedded GNU Toolchain <https://developer.arm.com/tools-and-software/open-source-software/developer-tools/gnu-toolchain/gnu-rm>`_
  14. for your embedded processor's CPU. You can also use a toolchain shipped with your OS for the `none-eabi` target, such as `gcc-arm-none-eabi` in Linux.
  15. In the following example, we download ``gcc-arm-none-eabi`` version 9.0 and unpack it into ``/opt/gcc``:
  16. .. code-block:: console
  17. $ sudo mkdir /opt/gcc
  18. $ sudo chgrp -R users /opt/gcc
  19. $ cd /opt/gcc
  20. $ wget https://developer.arm.com/-/media/Files/downloads/gnu-rm/9-2019q4/gcc-arm-none-eabi-9-2019-q4-major-x86_64-linux.tar.bz2
  21. $ tar xf gcc-arm-none-eabi-9-2019-q4-major-x86_64-linux.tar.bz2
  22. Then, add the toolchain ``bin/`` directory to your path:
  23. .. code-block:: console
  24. $ echo "export PATH=/opt/gcc/gcc-arm-none-eabi-9-2019-q4-major/bin:$PATH" >> ~/.bashrc
  25. If you are using any other shell, the procedure is similar by editing the corresponding rc file.
  26. #. Download Apache NuttX
  27. The next step is to download NuttX main repository along the application repository. The latter is technically optional in a very minimal configurations but should be included in normal configuration since it includes the NuttX shell.
  28. .. code-block:: console
  29. $ mkdir nuttx
  30. $ cd nuttx
  31. $ git clone https://github.com/apache/incubator-nuttx.git nuttx
  32. $ git clone https://github.com/apache/incubator-nuttx-apps apps
  33. $ git clone https://bitbucket.org/nuttx/tools.git tools
  34. #. Install the ``kconfig-frontends`` package
  35. NuttX is configured using ``kconfig`` system via an interactive menu system (``menuconfig``). It also includes the ``kconfig-tweak`` utility that can be used to quickly change debug settings without going into the menu system.
  36. .. tabs::
  37. .. code-tab:: console Ubuntu 20.04 LTS and later
  38. $ apt install kconfig-frontends
  39. .. code-tab:: console MacOS, Ubuntu 18.04 LTS and earlier
  40. $ cd tools/kconfig-frontends
  41. $ # on MacOS do the following:
  42. $ patch < ../kconfig-macos.diff -p 1
  43. $ ./configure --enable-mconf --disable-shared --enable-static --disable-gconf --disable-qconf --disable-nconf
  44. $ # on Linux do the following:
  45. $ ./configure --enable-mconf --disable-nconf --disable-gconf --disable-qconf
  46. $ make
  47. $ make install
  48. #. List Possible Apache NuttX Base Configurations
  49. Find your hardware and a good starting application in the list of base configurations. In the application list,
  50. ``nsh`` is the Apache NuttX Shell, an interactive commandline that's a good starting place if you're new.
  51. .. code-block:: bash
  52. $ cd nuttx
  53. $ ./tools/configure.sh -L | less
  54. #. Initialize Configuration
  55. Pick one of the board:application base configuration pairs from the list, and feed it to
  56. the configuration script. The ``-l`` tells us that we're on Linux. macOS and Windows builds
  57. are possible, this guide doesn't cover them yet.
  58. .. code-block:: bash
  59. $ cd nuttx
  60. $ ./tools/configure.sh -l <board-name>:<config-dir>
  61. # for instance:
  62. $ ./tools/configure.sh -l sama5d27-xult:nsh
  63. #. Customize Your Configuration (Optional)
  64. This step is optional. Right now, this is mainly to get familiar with how it works– you don't need to change
  65. any of the options now, but knowing how to do this will come in handy later.
  66. There are a lot of options. We'll cover a few of them here. Don't worry about the complexity– you don't have to use most of the options.
  67. .. code-block:: bash
  68. $ make menuconfig
  69. Use your arrows to navigate the menu and :kbd:`Enter` key to enable/disable options. To exit and save your configuration, go back to the main menu, choose ``<Exit>`` and select "yes" when asked if you want to save.
  70. #. Compile Apache NuttX
  71. .. code-block:: bash
  72. $ make
  73. #. Install the Executable Program on Your Board
  74. This step is a bit more complicated, depending on your board. It's covered in the section
  75. :ref:`Running Apache NuttX <running>`.
  76. ----
  77. .. rubric:: More Details
  78. If you want more details, start at :ref:`install`.