Documentation: initialize cmake doc

This commit is contained in:
raiden00pl 2023-10-27 11:26:25 +02:00 committed by Alan Carvalho de Assis
parent a2bb55d8b7
commit 408441bf15
5 changed files with 71 additions and 5 deletions

View File

@ -0,0 +1,6 @@
=============
CMake Support
=============
In the future this page will contain details about the CMake build system
support in NuttX.

View File

@ -0,0 +1,59 @@
====================
Compiling with CMake
====================
Initialize Configuration with CMake
===================================
The first step is to initialize NuttX configuration for a given board, based on
a pre-existing configuration. To list all supported configurations you can do:
.. code-block:: console
$ cd nuttx
$ ./tools/configure.sh -L | less
The output is in the format ``<board name>:<board configuration>``. You will see that
generally all boards support the ``nsh`` configuration which is a good starting point
since it enables booting into the interactive command line
:doc:`/applications/nsh/index`.
To choose a configuration you pass the ``<board name>:<board configuration>`` such as:
.. code-block:: console
$ cd nuttx
$ cmake -B build -DBOARD_CONFIG=stm32f4discovery:nsh -GNinja
The ``-B build`` tells what is the build direcotry.
You can then customize this configuration by using the menu based
configuration system with:
.. code-block:: console
$ cd nuttx
$ cmake --build build -t menuconfig
Modifying the configuration is covered in :doc:`configuring`.
Build NuttX with CMake
======================
We can now build NuttX. To do so, you can simply run:
.. code-block:: console
$ cd nuttx
$ cmake --build build -t menuconfig
The build will complete by generating the binary outputs
inside ``build/nuttx`` directory. Typically this includes the ``nuttx``
ELF file (suitable for debugging using ``gdb``) and a ``nuttx.bin``
file that can be flashed to the board.
To clean the build, you can do:
.. code-block:: console
$ cmake --build build -t clean

View File

@ -1,9 +1,9 @@
.. include:: /substitutions.rst
.. _compiling:
=========
Compiling
=========
===================
Compiling with Make
===================
Now that we've installed Apache NuttX prerequisites and downloaded the source code,
we are ready to compile the source code into an executable binary file that can

View File

@ -13,7 +13,7 @@ The Apache NuttX configuration system uses Linux's
includes various frontends that allow you to modify configuration easily. Usually, the ``menuconfig``
frontend is used, which is a console based menu system (more info `here <https://en.wikipedia.org/wiki/Menuconfig>`_).
As previously explained in :doc:`compiling`, the first step is to load a premade configuration for
As previously explained in :doc:`compiling_make`, the first step is to load a premade configuration for
your board. Then, you can modify this configuration to your liking. In this example, we will show
how you modify the default configuration of the ``sim`` build, a build of NuttX which runs on your own
computer.

View File

@ -9,7 +9,8 @@ required step:
:maxdepth: 1
install.rst
compiling.rst
compiling_make.rst
compiling_cmake.rst
running.rst
configuring.rst
debugging.rst