Nuttx on Linux

Posted by April 2, 2014

If you are also working with Nuttx, you will love the “sim” configuration. It will allow running a minimal version of Nuttx as a regular program on a linux machine (assuming 86x_64).

Before getting the sources and building anything you will need the 32-bit version of the GCC and the following libraries that can be installed like this:

sudo apt-get install -y gcc-multilib libc6-dev-i386 lib32z1-dev

After installing there is a final thing you need to fix on your own (see this launchpad ticket)

sudo ln -s /usr/include/x86_64-linux-gnu/zconf.h /usr/include

Now get the Nuttx sources using git like this:

git clone nuttx.git

First thing after getting the sources is to run the configure script (a bit different from the well known ./configure) to setup the build directory for the target hardware. In our case the target will be the native machine for which the “sim” configuration has been created (see nuttx/configs/sim).

To configure the build setup for target “sim” with “nsh” as the application to run on start, run:

cd nuttx.git/nuttx/tools
./ sim/nsh
cd ..

Last step before building is the configure the image. This is done by calling

make menuconfig

There is at least one setting that needs to be enabled:

– System Type —> [*] Build 32-bit simulation on 64-bit machine

You are now ready to build the image


If there was no problem during the build you will find a “nuttx” file in the same directory. Just run it and you will see the NSH prompt.


Leave a Reply

Your email address will not be published. Required fields are marked *