How to put your application to be called from NuttX terminal

In my previous post I explained how to compile NuttX to Freedom board, then a guy asked me how to add his application on NuttX. This tutorial will explain step by step how to do it.

It will use the Freedom Board (FRDM-KL25Z) as reference, but it could be adapted to any other board.

First add support to BUILT-IN applications on configs/freedom-kl25z/nsh/defconfig :


Also make sure CONFIG_BINFMT_DISABLE is not defined or is defined as NOT :


To make our life easy just use original “hello” example as base:

$ cd ..
$ cp -a apps/examples/hello apps/examples/myapp
$ cd apps/examples/myapp
$ mv hello_main.c myapp.c

Edit Kconfig file changing it to reflect your application name:

        bool "My First NuttX Application"
        default n
                Enable the \"MyAPP\" example


Edit Makefile replacing APPNAME and CSRCS to reflect our application name:

APPNAME         = myapp
CSRCS           = myapp.c

Also remember to edit your myapp.c replacing hello_main by myapp_main.

Edit apps/examples/Kconfig and add:

source "$APPSDIR/examples/myapp/Kconfig"

Edit apps/examples/Make.defs and add:

CONFIGURED_APPS += examples/myapp

Now you should to compile the frontend to kconfig interface:

$ cd ../misc/tools/kconfig-frontends
$ ./configure --enable-mconf
$ make
$ sudo make install

Inside nuttx directory execute this command to clear apps directory:

$ cd ../../../nuttx
$ make apps_distclean

Now execute the menuconfig to select your application:

$ make menuconfig

Choose “myapp” following this path:

Application Configuration  --->
    Examples  --->
        [*] My First NuttX Application

Now just compile everything:

$ make

Copy the firmware to the board and open the serial console:

NuttShell (NSH)

nsh> help
help usage:  help [-v] []

  ?           exec        help        ls          mw          usleep      
  cat         exit        hexdump     mb          ps          xd          
  echo        free        kill        mh          sleep       

Builtin Apps:

nsh> myapp
This is my first application!!


Next time you execute “make distclean” the “myapp” will be remove from compilation.

If you want to keep it in the final Nuttx firmware you need to add into configs/freedom-kl25z/nsh/defconfig :


That is it!!! Now keep going and create your nice application to run on NuttX!

8 thoughts on “How to put your application to be called from NuttX terminal

  1. hello
    i’v got this error message when i compile
    arm-nuttx-eabi-gcc: error trying to exec ‘cc1’: execvp: No such file or directory

    1. Hi mohammed,
      I don’t know about this problem. It is suppose to be something related to cygwin commands. I use Linux as developing machine.

  2. hi,
    Need to integrate CURL to Nuttx.
    I have added curl successfully to apps. for compiling curl i need to add more things like libcurl and -DBUILDING_LIBCURL. how and where can i add these things while compiling through nuttx make?

    Can you please help me out.

    1. Hi Vivek,
      In the NuttX apps/ you don’t need to create a real library to use with your application. See the examples/lvgldemo and graphics/littlevgl. This is an example of APP / LIB relation.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s