| <!-- |
| Documentation/_templates/layout.html |
| |
| Licensed to the Apache Software Foundation (ASF) under one or more |
| contributor license agreements. See the NOTICE file distributed with |
| this work for additional information regarding copyright ownership. The |
| ASF licenses this file to you under the Apache License, Version 2.0 (the |
| "License"); you may not use this file except in compliance with the |
| License. You may obtain a copy of the License at |
| |
| http://www.apache.org/licenses/LICENSE-2.0 |
| |
| Unless required by applicable law or agreed to in writing, software |
| distributed under the License is distributed on an "AS IS" BASIS, WITHOUT |
| WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |
| License for the specific language governing permissions and limitations |
| under the License. |
| --> |
| |
| |
| |
| <!DOCTYPE html> |
| <html class="writer-html5" lang="en"> |
| <head> |
| <meta charset="utf-8" /><meta name="generator" content="Docutils 0.19: https://docutils.sourceforge.io/" /> |
| |
| <meta name="viewport" content="width=device-width, initial-scale=1.0" /> |
| <title>NSH “Built-In” Applications — NuttX latest documentation</title> |
| <link rel="stylesheet" type="text/css" href="../../_static/pygments.css" /> |
| <link rel="stylesheet" type="text/css" href="../../_static/css/theme.css" /> |
| <link rel="stylesheet" type="text/css" href="../../_static/copybutton.css" /> |
| <link rel="stylesheet" type="text/css" href="../../_static/design-style.1e8bd061cd6da7fc9cf755528e8ffc24.min.css" /> |
| <link rel="stylesheet" type="text/css" href="../../_static/custom.css" /> |
| |
| |
| <link rel="shortcut icon" href="../../_static/favicon.ico"/> |
| <script src="../../_static/jquery.js"></script> |
| <script src="../../_static/_sphinx_javascript_frameworks_compat.js"></script> |
| <script data-url_root="../../" id="documentation_options" src="../../_static/documentation_options.js"></script> |
| <script src="../../_static/doctools.js"></script> |
| <script src="../../_static/sphinx_highlight.js"></script> |
| <script src="../../_static/clipboard.min.js"></script> |
| <script src="../../_static/copybutton.js"></script> |
| <script src="../../_static/design-tabs.js"></script> |
| <script src="../../_static/js/theme.js"></script> |
| <link rel="index" title="Index" href="../../genindex.html" /> |
| <link rel="search" title="Search" href="../../search.html" /> |
| <link rel="next" title="Customizing NSH Initialization" href="installation.html" /> |
| <link rel="prev" title="The NSH Library and NSH Initialization" href="customizing.html" /> |
| </head> |
| |
| <body class="wy-body-for-nav"> |
| <div class="wy-grid-for-nav"> |
| <nav data-toggle="wy-nav-shift" class="wy-nav-side"> |
| <div class="wy-side-scroll"> |
| <div class="wy-side-nav-search" > |
| |
| <a href="../../index.html" class="icon icon-home"> NuttX |
| |
| |
| |
| </a> |
| |
| <!-- this version selector is quite ugly, should be probably replaced by something |
| more modern --> |
| |
| <div class="version-selector"> |
| <select onchange="javascript:location.href = this.value;"> |
| |
| <option value="../../../latest" selected="selected">latest</option> |
| |
| <option value="../../../10.0.0" >10.0.0</option> |
| |
| <option value="../../../10.0.1" >10.0.1</option> |
| |
| <option value="../../../10.1.0" >10.1.0</option> |
| |
| <option value="../../../10.2.0" >10.2.0</option> |
| |
| <option value="../../../10.3.0" >10.3.0</option> |
| |
| <option value="../../../11.0.0" >11.0.0</option> |
| |
| <option value="../../../12.0.0" >12.0.0</option> |
| |
| <option value="../../../12.1.0" >12.1.0</option> |
| |
| <option value="../../../12.2.0" >12.2.0</option> |
| |
| <option value="../../../12.2.1" >12.2.1</option> |
| |
| <option value="../../../12.3.0" >12.3.0</option> |
| |
| <option value="../../../12.4.0" >12.4.0</option> |
| |
| <option value="../../../12.5.0" >12.5.0</option> |
| |
| <option value="../../../12.5.1" >12.5.1</option> |
| |
| <option value="../../../12.6.0" >12.6.0</option> |
| |
| <option value="../../../12.7.0" >12.7.0</option> |
| |
| <option value="../../../12.8.0" >12.8.0</option> |
| |
| <option value="../../../12.9.0" >12.9.0</option> |
| |
| <option value="../../../12.10.0" >12.10.0</option> |
| |
| <option value="../../../12.11.0" >12.11.0</option> |
| |
| </select> |
| </div> |
| |
| |
| <div role="search"> |
| <form id="rtd-search-form" class="wy-form" action="../../search.html" method="get"> |
| <input type="text" name="q" placeholder="Search docs" aria-label="Search docs" /> |
| <input type="hidden" name="check_keywords" value="yes" /> |
| <input type="hidden" name="area" value="default" /> |
| </form> |
| </div> |
| |
| </div><div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="Navigation menu"> |
| <p class="caption" role="heading"><span class="caption-text">Table of Contents</span></p> |
| <ul class="current"> |
| <li class="toctree-l1"><a class="reference internal" href="../../index.html">Home</a></li> |
| <li class="toctree-l1"><a class="reference internal" href="../../introduction/index.html">Introduction</a></li> |
| <li class="toctree-l1"><a class="reference internal" href="../../quickstart/index.html">Getting Started</a></li> |
| <li class="toctree-l1"><a class="reference internal" href="../../contributing/index.html">Contributing</a></li> |
| <li class="toctree-l1"><a class="reference internal" href="../../introduction/inviolables.html">The Inviolable Principles of NuttX</a></li> |
| <li class="toctree-l1"><a class="reference internal" href="../../platforms/index.html">Supported Platforms</a></li> |
| <li class="toctree-l1"><a class="reference internal" href="../../components/index.html">OS Components</a></li> |
| <li class="toctree-l1 current"><a class="reference internal" href="../index.html">Applications</a><ul class="current"> |
| <li class="toctree-l2"><a class="reference internal" href="../audioutils/index.html">Audio Utility libraries</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../boot/index.html">Bootloader Utilities</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../benchmarks/index.html">Benchmark Applications</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../canutils/index.html">CAN Utilities</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../crypto/index.html">Cryptography Library Support</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../fsutils/index.html">File System Utilities</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../games/index.html">Games</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../graphics/index.html">Graphics Support</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../industry/index.html">Industrial Applications</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../inertial/index.html">Inertial Libraries Support</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../interpreters/index.html">Interpreters</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../logging/index.html">Logging Utilities</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../lte/index.html">LTE Libraries and NSH Add-Ons</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../math/index.html">Math Library Support</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../mlearing/index.html">Machine Learning Support</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../netutils/index.html">Network Utilities</a></li> |
| <li class="toctree-l2 current"><a class="reference internal" href="index.html">NuttShell (NSH)</a><ul class="current"> |
| <li class="toctree-l3"><a class="reference internal" href="nsh.html">Overview</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="commands.html">Commands</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="config.html">Configuration Settings</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="customizing.html">The NSH Library and NSH Initialization</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="customizing.html#nsh-commands">NSH Commands</a></li> |
| <li class="toctree-l3 current"><a class="current reference internal" href="#">NSH “Built-In” Applications</a><ul> |
| <li class="toctree-l4"><a class="reference internal" href="#built-in-applications">Built-In Applications</a></li> |
| <li class="toctree-l4"><a class="reference internal" href="#synchronous-built-in-applications">Synchronous Built-In Applications</a></li> |
| </ul> |
| </li> |
| <li class="toctree-l3"><a class="reference internal" href="installation.html">Customizing NSH Initialization</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="login.html">Shell Login</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="running_apps.html">Running Applications from NSH</a></li> |
| </ul> |
| </li> |
| <li class="toctree-l2"><a class="reference internal" href="../sdr/index.html">Software Define Radio Libraries</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../system/index.html">System Libraries and NSH Add-Ons</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../testing/index.html">Testing</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../tools/index.html">Host Side Tools</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../wireless/index.html">Wireless Libraries and NSH Add-Ons</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../examples/index.html">Examples</a></li> |
| </ul> |
| </li> |
| <li class="toctree-l1"><a class="reference internal" href="../../implementation/index.html">Implementation Details</a></li> |
| <li class="toctree-l1"><a class="reference internal" href="../../reference/index.html">API Reference</a></li> |
| <li class="toctree-l1"><a class="reference internal" href="../../faq/index.html">FAQ</a></li> |
| <li class="toctree-l1"><a class="reference internal" href="../../debugging/index.html">Debugging</a></li> |
| <li class="toctree-l1"><a class="reference internal" href="../../guides/index.html">Guides</a></li> |
| <li class="toctree-l1"><a class="reference internal" href="../../glossary.html">Glossary</a></li> |
| <li class="toctree-l1"><a class="reference internal" href="../../logos/index.html">NuttX Logos</a></li> |
| <li class="toctree-l1"><a class="reference internal" href="../../_tags/tagsindex.html">Tags</a></li> |
| </ul> |
| |
| </div> |
| </div> |
| </nav> |
| |
| <section data-toggle="wy-nav-shift" class="wy-nav-content-wrap"><nav class="wy-nav-top" aria-label="Mobile navigation menu" > |
| <i data-toggle="wy-nav-top" class="fa fa-bars"></i> |
| <a href="../../index.html">NuttX</a> |
| </nav> |
| |
| <div class="wy-nav-content"> |
| <div class="rst-content"> |
| <div role="navigation" aria-label="Page navigation"> |
| <ul class="wy-breadcrumbs"> |
| <li><a href="../../index.html" class="icon icon-home" aria-label="Home"></a></li> |
| <li class="breadcrumb-item"><a href="../index.html">Applications</a></li> |
| <li class="breadcrumb-item"><a href="index.html">NuttShell (NSH)</a></li> |
| <li class="breadcrumb-item active">NSH “Built-In” Applications</li> |
| <li class="wy-breadcrumbs-aside"> |
| <a href="https://github.com/apache/nuttx/blob/master/Documentation/applications/nsh/builtin.rst" class="fa fa-github"> Edit on GitHub</a> |
| </li> |
| </ul> |
| <hr/> |
| </div> |
| <div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article"> |
| <div itemprop="articleBody"> |
| |
| <section id="nsh-built-in-applications"> |
| <h1>NSH “Built-In” Applications<a class="headerlink" href="#nsh-built-in-applications" title="Permalink to this heading"></a></h1> |
| <p><strong>Overview.</strong> In addition to these commands that are a part of NSH, |
| external programs can also be executed as NSH commands. These external |
| programs are called “Built-In” Applications for historic reasons. That |
| terminology is somewhat confusing because the actual NSH commands as |
| described above are truly “built-into” NSH whereas these applications |
| are really external to NuttX.</p> |
| <p>These applications are built-into NSH in the sense that they can be |
| executed by simply typing the name of the application at the NSH prompt. |
| Built-in application support is enabled with these configuration option:</p> |
| <blockquote> |
| <div><ul class="simple"> |
| <li><p><code class="docutils literal notranslate"><span class="pre">CONFIG_BUILTIN</span></code>: Enable NuttX support for builtin applications.</p></li> |
| <li><p><code class="docutils literal notranslate"><span class="pre">CONFIG_NSH_BUILTIN_APPS</span></code>: Enable NSH support for builtin |
| applications.</p></li> |
| </ul> |
| </div></blockquote> |
| <p>When these configuration options are set, you will also be able to see |
| the built-in applications if you enter “nsh> help”. They will appear at |
| the bottom of the list of NSH commands under:</p> |
| <div class="highlight-none notranslate"><div class="highlight"><pre><span></span>Builtin Apps: |
| </pre></div> |
| </div> |
| <p>Note that no detailed help information beyond the name of the built-in |
| application is provided.</p> |
| <section id="built-in-applications"> |
| <h2>Built-In Applications<a class="headerlink" href="#built-in-applications" title="Permalink to this heading"></a></h2> |
| <p><strong>Overview.</strong> The underlying logic that supports the NSH built-in |
| applications is called “Built-In Applications”. The builtin application |
| logic can be found at <code class="docutils literal notranslate"><span class="pre">apps/builtin</span></code>. This logic simply does the |
| following:</p> |
| <blockquote> |
| <div><ol class="arabic simple"> |
| <li><p>It supports registration mechanism so that builtin applications can |
| dynamically register themselves at build time, and</p></li> |
| <li><p>Utility functions to look up, list, and execute the builtin |
| applications.</p></li> |
| </ol> |
| </div></blockquote> |
| <p><strong>Built-In Application Utility Functions</strong>. The utility functions |
| exported by the builtin application logic are prototyped in |
| <code class="docutils literal notranslate"><span class="pre">nuttx/include/nuttx/lib/builtin.h</span></code> and <code class="docutils literal notranslate"><span class="pre">apps/include/builtin.h</span></code>. |
| These utility functions include:</p> |
| <blockquote> |
| <div><ul class="simple"> |
| <li><p><code class="docutils literal notranslate"><span class="pre">int</span> <span class="pre">builtin_isavail(FAR</span> <span class="pre">const</span> <span class="pre">char</span> <span class="pre">*appname);</span></code> Checks for |
| availability of application registered as <code class="docutils literal notranslate"><span class="pre">appname</span></code> during build |
| time.</p></li> |
| <li><p><code class="docutils literal notranslate"><span class="pre">const</span> <span class="pre">char</span> <span class="pre">*builtin_getname(int</span> <span class="pre">index);</span></code> Returns a pointer to a |
| name of built-in application pointed by the <code class="docutils literal notranslate"><span class="pre">index</span></code>. This is the |
| utility function that is used by NSH in order to list the available |
| built-in applications when “<code class="docutils literal notranslate"><span class="pre">nsh></span> <span class="pre">help</span></code>” is entered.</p></li> |
| <li><p><code class="docutils literal notranslate"><span class="pre">int</span> <span class="pre">exec_builtin(FAR</span> <span class="pre">const</span> <span class="pre">char</span> <span class="pre">*appname,</span> <span class="pre">FAR</span> <span class="pre">const</span> <span class="pre">char</span> <span class="pre">**argv);</span></code> |
| Executes built-in builtin application registered during compile time. |
| This is the utility function used by NSH to execute the built-in |
| application.</p></li> |
| </ul> |
| </div></blockquote> |
| <p><strong>Autogenerated Header Files</strong>. Application entry points with their |
| requirements are gathered together in two files when NuttX is first |
| built:</p> |
| <blockquote> |
| <div><ol class="arabic simple"> |
| <li><p><code class="docutils literal notranslate"><span class="pre">apps/builtin/builtin_proto.h</span></code>: Prototypes of application task |
| entry points.</p></li> |
| <li><p><code class="docutils literal notranslate"><span class="pre">apps/builtin/builtin_list.h</span></code>: Application specific information and |
| start-up requirements</p></li> |
| </ol> |
| </div></blockquote> |
| <p><strong>Registration of Built-In Applications</strong>. The NuttX build occurs in |
| several phases as different build targets are executed: (1) <em>context</em> |
| when the configuration is established, (2) <em>depend</em> when target |
| dependencies are generated, and (3) <em>default</em> (<code class="docutils literal notranslate"><span class="pre">all</span></code>) when the normal |
| compilation and link operations are performed. Built-in application |
| information is collected during the make <em>context</em> build phase.</p> |
| <p>An example application that can be “built-in” is be found in the |
| <code class="docutils literal notranslate"><span class="pre">apps/examples/hello</span> <span class="pre">directory</span></code>. Let’s walk through this specific |
| cause to illustrate the general way that built-in applications are |
| created and how they register themselves so that they can be used from |
| NSH.</p> |
| <p><code class="docutils literal notranslate"><span class="pre">apps/examples/hello</span></code>. The main routine for apps/examples/hello can be |
| found in <code class="docutils literal notranslate"><span class="pre">apps/examples/hello/main.c</span></code>. The main routine is:</p> |
| <div class="highlight-c notranslate"><div class="highlight"><pre><span></span><span class="kt">int</span><span class="w"> </span><span class="nf">hello_main</span><span class="p">(</span><span class="kt">int</span><span class="w"> </span><span class="n">argc</span><span class="p">,</span><span class="w"> </span><span class="kt">char</span><span class="w"> </span><span class="o">*</span><span class="n">argv</span><span class="p">[])</span> |
| <span class="p">{</span> |
| <span class="w"> </span><span class="n">printf</span><span class="p">(</span><span class="s">"Hello, World!!</span><span class="se">\n</span><span class="s">"</span><span class="p">);</span> |
| <span class="w"> </span><span class="k">return</span><span class="w"> </span><span class="mi">0</span><span class="p">;</span> |
| <span class="p">}</span> |
| </pre></div> |
| </div> |
| <p>This is the built in function that will be registered during the |
| <em>context</em> build phase of the NuttX build. That registration is performed |
| by logic in <code class="docutils literal notranslate"><span class="pre">apps/examples/hello/Makefile</span></code>. But the build system gets |
| to that logic through a rather tortuous path:</p> |
| <blockquote> |
| <div><ol class="arabic simple"> |
| <li><p>The top-level context make target is in <code class="docutils literal notranslate"><span class="pre">nuttx/Makefile</span></code>. All build |
| targets depend upon the <em>context</em> build target. For the <code class="docutils literal notranslate"><span class="pre">apps/</span></code> |
| directory, this build target will execute the <em>context</em> target in the |
| <code class="docutils literal notranslate"><span class="pre">apps/Makefile</span></code>.</p></li> |
| <li><p>The <code class="docutils literal notranslate"><span class="pre">apps/Makefile</span></code> will, in turn, execute the <em>context</em> targets in |
| all of the configured sub-directories. In our case will include the |
| <code class="docutils literal notranslate"><span class="pre">Makefile</span></code> in <code class="docutils literal notranslate"><span class="pre">apps/examples</span></code>.</p></li> |
| <li><p>And finally, the <code class="docutils literal notranslate"><span class="pre">apps/examples/Makefile</span></code> will execute the |
| <em>context</em> target in all configured <code class="docutils literal notranslate"><span class="pre">example</span></code>sub-directories, |
| getting us finally to <code class="docutils literal notranslate"><span class="pre">apps/examples/Makefile</span></code> which is covered |
| below.</p></li> |
| </ol> |
| </div></blockquote> |
| <p><strong>NOTE</strong>: Since this context build phase can only be executed one time, |
| any subsequent configuration changes that you make will, then, not be |
| reflected in the build sequence. That is a common area of confusion. |
| Before you can instantiate the new configuration, you have to first get |
| rid of the old configuration. The most drastic way to this is:</p> |
| <div class="highlight-none notranslate"><div class="highlight"><pre><span></span>make distclean |
| </pre></div> |
| </div> |
| <p>But then you will have to re-configuration NuttX from scratch. But if |
| you only want to re-build the configuration in the <code class="docutils literal notranslate"><span class="pre">apps/</span></code> |
| sub-directory, then there is a less labor-intensive way to do that. The |
| following NuttX make command will remove the configuration only from the |
| <code class="docutils literal notranslate"><span class="pre">apps/</span></code> directory and will let you continue without re-configuring |
| everything:</p> |
| <div class="highlight-none notranslate"><div class="highlight"><pre><span></span>make apps_distclean |
| </pre></div> |
| </div> |
| <p>Logic for the <code class="docutils literal notranslate"><span class="pre">context</span></code> target in <code class="docutils literal notranslate"><span class="pre">apps/examples/hello/Makefile</span></code> |
| registers the <code class="docutils literal notranslate"><span class="pre">hello_main()</span></code> application in the <code class="docutils literal notranslate"><span class="pre">builtin</span></code>’s |
| <code class="docutils literal notranslate"><span class="pre">builtin_proto.h</span></code>and <code class="docutils literal notranslate"><span class="pre">builtin_list.h</span></code> files. That logic that does |
| that in <code class="docutils literal notranslate"><span class="pre">apps/examples/hello/Makefile</span></code> is abstracted below:</p> |
| <blockquote> |
| <div><ol class="arabic"> |
| <li><p>First, the <code class="docutils literal notranslate"><span class="pre">Makefile</span></code> includes <code class="docutils literal notranslate"><span class="pre">apps/Make.defs</span></code>:</p> |
| <div class="highlight-none notranslate"><div class="highlight"><pre><span></span>include $(APPDIR)/Make.defs |
| </pre></div> |
| </div> |
| <p>This defines a macro called <code class="docutils literal notranslate"><span class="pre">REGISTER</span></code> that adds data to the |
| <em>builtin</em> header files:</p> |
| <div class="highlight-none notranslate"><div class="highlight"><pre><span></span>define REGISTER |
| @echo "Register: $1" |
| @echo "{ \"$1\", $2, $3, $4 }," >> "$(APPDIR)/builtin/builtin_list.h" |
| @echo "EXTERN int $4(int argc, char *argv[]);" >> "$(APPDIR)/builtin/builtin_proto.h" |
| endef |
| </pre></div> |
| </div> |
| <p>When this macro runs, you will see the output in the build |
| “<code class="docutils literal notranslate"><span class="pre">Register:</span> <span class="pre">hello</span></code>”, that is a sure sign that the registration was |
| successful.</p> |
| </li> |
| <li><p>The make file then defines the application name (<code class="docutils literal notranslate"><span class="pre">hello</span></code>), the task |
| priority (default), and the stack size that will be allocated in the |
| task runs (2K):</p> |
| <div class="highlight-none notranslate"><div class="highlight"><pre><span></span>APPNAME = hello |
| PRIORITY = SCHED_PRIORITY_DEFAULT |
| STACKSIZE = 2048 |
| </pre></div> |
| </div> |
| </li> |
| <li><p>And finally, the <code class="docutils literal notranslate"><span class="pre">Makefile</span></code> invokes the <code class="docutils literal notranslate"><span class="pre">REGISTER</span></code> macro to added |
| the <code class="docutils literal notranslate"><span class="pre">hello_main()</span></code> builtin application. Then, when the system build |
| completes, the <code class="docutils literal notranslate"><span class="pre">hello</span></code> command can be executed from the NSH command |
| line. When the <code class="docutils literal notranslate"><span class="pre">hello</span></code> command is executed, it will start the task |
| with entry point <code class="docutils literal notranslate"><span class="pre">hello_main()</span></code> with the default priority and with |
| a stack size of 2K:</p> |
| <div class="highlight-none notranslate"><div class="highlight"><pre><span></span>context: |
| $(call REGISTER,$(APPNAME),$(PRIORITY),$(STACKSIZE),$(APPNAME)_main) |
| </pre></div> |
| </div> |
| </li> |
| </ol> |
| </div></blockquote> |
| <p><strong>Other Uses of Built-In Application.</strong> The primary purpose of builtin |
| applications is to support command line execution of applications from |
| NSH. However, there is one other use of builtin applications that should |
| be mentioned.</p> |
| <blockquote> |
| <div><ol class="arabic simple"> |
| <li><p><strong>binfs</strong>. <em>binfs</em> is a tiny file system located at |
| <code class="docutils literal notranslate"><span class="pre">apps/builtin/binfs.c</span></code>. This provides an alternative what of |
| visualizing installed builtin applications. Without <em>binfs</em>, you can |
| see the installed builtin applications using the NSH help command. |
| <em>binfs</em> will create a tiny pseudo-file system mounted at <code class="docutils literal notranslate"><span class="pre">/bin</span></code>. |
| Using <em>binfs</em>, you can see the available builtin applications by |
| listing the contents of <code class="docutils literal notranslate"><span class="pre">/bin</span></code> directory. This gives some |
| superficial Unix-like compatibility, but does not really add any new |
| functionality.</p></li> |
| </ol> |
| </div></blockquote> |
| </section> |
| <section id="synchronous-built-in-applications"> |
| <h2>Synchronous Built-In Applications<a class="headerlink" href="#synchronous-built-in-applications" title="Permalink to this heading"></a></h2> |
| <p>By default, built-in commands started from the NSH command line will run |
| asynchronously with NSH. If you want to force NSH to execute commands |
| then wait for the command to execute, you can enable that feature by |
| adding the following to the NuttX configuration file:</p> |
| <div class="highlight-none notranslate"><div class="highlight"><pre><span></span>CONFIG_SCHED_WAITPID=y |
| </pre></div> |
| </div> |
| <p>This configuration option enables support for the standard <code class="docutils literal notranslate"><span class="pre">waitpid()</span></code> |
| RTOS interface. When that interface is enabled, NSH will use it to wait, |
| sleeping until the built-in application executes to completion.</p> |
| <p>Of course, even with <code class="docutils literal notranslate"><span class="pre">CONFIG_SCHED_WAITPID=y</span></code> defined, specific |
| applications can still be forced to run asynchronously by adding the |
| ampersand (&) after the NSH command.</p> |
| </section> |
| </section> |
| |
| |
| </div> |
| </div> |
| <footer><div class="rst-footer-buttons" role="navigation" aria-label="Footer"> |
| <a href="customizing.html" class="btn btn-neutral float-left" title="The NSH Library and NSH Initialization" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a> |
| <a href="installation.html" class="btn btn-neutral float-right" title="Customizing NSH Initialization" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a> |
| </div> |
| |
| <hr/> |
| |
| <div role="contentinfo"> |
| <p>© Copyright 2023, The Apache Software Foundation.</p> |
| </div> |
| |
| |
| |
| </footer> |
| </div> |
| </div> |
| </section> |
| </div> |
| <script> |
| jQuery(function () { |
| SphinxRtdTheme.Navigation.enable(true); |
| }); |
| </script> |
| |
| </body> |
| </html> |