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:
config EXAMPLES_MYAPP bool "My First NuttX Application" default n ---help--- Enable the \"MyAPP\" example if EXAMPLES_MYAPP endif
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:
Edit apps/examples/Make.defs and add:
ifeq ($(CONFIG_EXAMPLES_MYAPP),y) CONFIGURED_APPS += examples/myapp endif
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:
Copy the firmware to the board and open the serial console:
NuttShell (NSH) 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: myapp nsh> myapp This is my first application!! nsh>
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”
i’v got this error message when i compile
arm-nuttx-eabi-gcc: error trying to exec ‘cc1’: execvp: No such file or directory
execvp is not implemented, you should to use exec, execv, or other.
thanks for the replay, i have now this error
make: cygpath: Command not found
I don’t know about this problem. It is suppose to be something related to cygwin commands. I use Linux as developing machine.
Good tutorial. Alan . I have followed it without errors on a mbed lpc1768.
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.
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.