5️⃣NuttX

https://nuttx.apache.org/

NuttX is a real-time operating system (RTOS) with an emphasis on standards compliance and small footprint. Scalable from 8-bit to 64-bit microcontroller environments, the primary governing standards in NuttX are Posix and ANSI standards. Additional standard APIs from Unix and other common RTOS’s (such as VxWorks) are adopted for functionality not available under these standards, or for functionality that is not appropriate for deeply-embedded environments (such as fork()).

Installing

sudo apt install \
bison flex gettext texinfo libncurses5-dev libncursesw5-dev xxd \
gperf automake libtool pkg-config build-essential gperf genromfs \
libgmp-dev libmpc-dev libmpfr-dev libisl-dev binutils-dev libelf-dev \
libexpat-dev gcc-multilib g++-multilib picocom u-boot-tools util-linux

KConfig frontend

sudo apt install kconfig-frontends

Toolchain

To build Apache NuttX you need the appropriate toolchain according to your target platform. Some Operating Systems such as Linux distribute toolchains for various architectures. This is usually an easy choice however you should be aware that in some cases the version offered by your OS may have problems and it may be better to use a widely used build from another source.

sudo apt install gcc-arm-none-eabi binutils-arm-none-eabi

Download NuttX

Apache NuttX is actively developed on GitHub. There are two main repositories, nuttx and apps, where the latter is technically optional (but recommended for complete set of features). If you intend to contribute changes, you need the absolute latest version or you simply prefer to work using git, you should clone these repositories (recommended). Otherwise you can choose to download any stable release archive.

mkdir nuttxspace
cd nuttxspace
git clone https://github.com/apache/nuttx.git nuttx
git clone https://github.com/apache/nuttx-apps apps

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

Initialize Configuration

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:

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 NuttShell (NSH).

To choose a configuration you pass the <board name>:<board configuration> option to configure.sh and indicate your host platform, such as:

cd nuttx
./tools/configure.sh -l stm32f4discovery:nsh

The -l tells use that we’re on Linux (macOS and Windows builds are possible). Use the -h argument to see all available options.

You can then customize this configuration by using the menu based configuration system with:

cd nuttx
make menuconfig

Modifying the configuration is covered in Configuring.

Build NuttX

We can now build NuttX. To do so, you can simply run:

cd nuttx
make

The build will complete by generating the binary outputs inside 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:

make clean

Last updated