Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Building NuttX with Applications Outside of the Source Tree

Q: Has anyone come up with a tidy way to build NuttX with board-specific pieces outside the source tree?

A: Here are four:

1. Make export

There is a make target called make export. It will build NuttX, then bundle all of the header files, libaries, startup objects, and other build components into a .zip file. You can can move that .zip file into any build environment you want. You can even build NuttX under a DOS CMD window.

This make target is documented in the top level nuttx/README.txt.

2. Replace the apps/ Directory

You can replace the entire apps/ directory. It is not a critical part of the OS. The apps/ is simply provided for you to help with your application development. It should not dictate anything that that you do.

...

You can copy any pieces that you like from the old apps/directory to your custom apps directory as necessary. This is documented in nuttx/boards/README.txt, in the NuttX Porting Guide and Build options, and in the apps/README.txt file.

3. Extend the apps/ Directory

If you like the random collection of stuff in the apps/ directory but just want to expand the existing components with your own, external sub-directory then there is an easy way to that too: You just create a sympolic link in the apps/ directory that redirects to your application sub-directory (or copy your code into a sub-directory of apps/).

http://www.nuttx.org/Images/Extended-apps.jpg?400Image RemovedImage Added

Makefile and Make.defs. In order to be incorporated into the build, the directory that you link under the apps/ directory should contain (1) a Makefile that supports the clean and distclean targets (see other Makefile}}s for examples), and (2) a tiny {{Make.defs make file fragment that simply adds the build directories to the variable ''{{CONFIGURED_APPS like:

...

Special }}apps/external Directory{{. Use of the name }}apps/external{{ is suggested because that name is included in the .gitignore file and will save you some nuisance when working with GIT.

4. Contain the apps/ Directory

A simple, minimally invasive approach would be to contain the }}apps/{{ GIT clone within your custom application directory. In this case }}apps/{{ would appear as a directory under your custom application directory instead of your application directories being kludged in as sub-directories of }}apps/{{. It may even be implemented as a sub-module of your custom application directory.

http://www.nuttx.org/Images/Contained-apps.jpg?400Image RemovedImage Added

Kconfig and Makefile. There are only a few minimal requirements of your custom application directory. It needs to have only its own }}Makefile{{ and }}Kconfig{{ file. That }}Kconfig{{ would need to include the }}apps/Kconfig{{. The }}Makefile{{, would similarly need to invoke the }}apps/Makefil{{e for all of the relevant build targets. For example, the clean target:

...

In this case, you would probably also want to contain the nuttx/ directory in the project directory as well so that the entire system is built out-of-tree.

Hooking External Applications into the Configuration System

Suppose you have opted to extend the apps/ directory with your custom external applicatoin directories and would also like to support configuration variables in your external application. No problem. Thanks to Sebastien Lorquet, any external application that you install into the apps/, whether via a symbolic link or via a directory copy, will be included into the NuttX configuration system.

...