diff --git a/Documentation/components/cmake.rst b/Documentation/components/cmake.rst new file mode 100644 index 0000000000..c0b133f644 --- /dev/null +++ b/Documentation/components/cmake.rst @@ -0,0 +1,6 @@ +============= +CMake Support +============= + +In the future this page will contain details about the CMake build system +support in NuttX. diff --git a/Documentation/quickstart/compiling_cmake.rst b/Documentation/quickstart/compiling_cmake.rst new file mode 100644 index 0000000000..069d38d4c2 --- /dev/null +++ b/Documentation/quickstart/compiling_cmake.rst @@ -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 ``:``. 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 ``:`` 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 diff --git a/Documentation/quickstart/compiling.rst b/Documentation/quickstart/compiling_make.rst similarity index 97% rename from Documentation/quickstart/compiling.rst rename to Documentation/quickstart/compiling_make.rst index a1f4453cd1..204b2bb07f 100644 --- a/Documentation/quickstart/compiling.rst +++ b/Documentation/quickstart/compiling_make.rst @@ -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 diff --git a/Documentation/quickstart/configuring.rst b/Documentation/quickstart/configuring.rst index 9d197d9e48..5add3d6748 100644 --- a/Documentation/quickstart/configuring.rst +++ b/Documentation/quickstart/configuring.rst @@ -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 `_). -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. diff --git a/Documentation/quickstart/index.rst b/Documentation/quickstart/index.rst index 24da7183e2..c77e8329e5 100644 --- a/Documentation/quickstart/index.rst +++ b/Documentation/quickstart/index.rst @@ -9,7 +9,8 @@ required step: :maxdepth: 1 install.rst - compiling.rst + compiling_make.rst + compiling_cmake.rst running.rst configuring.rst debugging.rst