Compiling NuttX

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 be run on the embedded board.

  1. List Possible Apache NuttX Base Configurations

    Find your hardware and a good starting application in the list of base configurations. In the application list, nsh is the Apache NuttX Shell, an interactive commandline that’s a good starting place if you’re new.

    $ cd nuttx
    $ ./tools/ -L | less
    # or to see just the Jupiter Nano configurations that are available...
    $ ./tools/ -L | grep jupiter-nano
  2. Initialize Configuration

    Pick one of the board:application base configuration pairs from the list, and feed it to the configuration script. The -l tells use that we’re on Linux. macOS and Windows builds are possible, this guide doesn’t cover them yet.

    $ cd nuttx
    $ # this is the basic layout of the command:
    $ # ./tools/ -l <board-name>:<config-dir>
    $ # for example:
    $ ./tools/ -l jupiter-nano:sdmmc-nsh-net-resolvconf
  3. Customize Your Configuration (Optional)

    This step is optional. Right now, this is mainly to get familiar with how it works– you don’t need to change any of the options now, but knowing how to do this will come in handy later.

    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. See Configuring NuttX for more information on how to use this system.

    $ make menuconfig
  4. Compile NuttX

    $ make clean; make
  5. Install the Executable Program on Your Board

    This step is a bit more complicated, depending on your board. It’s covered in the section Running NuttX.

You can see the generic, official version of these instructions in the Apache NuttX documentation here: Compiling Apache NuttX

Next: Running NuttX