blob: 72c6f981eb023c3d346c6f414e6195347fa30ab8 [file] [log] [blame]
<!--
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.18.1: http://docutils.sourceforge.net/" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Host Side Tools &mdash; 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/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/js/theme.js"></script>
<link rel="index" title="Index" href="../../genindex.html" />
<link rel="search" title="Search" href="../../search.html" />
<link rel="next" title="Wireless Libraries and NSH Add-Ons" href="../wireless/index.html" />
<link rel="prev" title="unity Unity testing framework" href="../testing/unity/index.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"><a class="reference internal" href="../nsh/index.html">NuttShell (NSH)</a></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 current"><a class="current reference internal" href="#">Host Side Tools</a><ul>
<li class="toctree-l3"><a class="reference internal" href="#bitmap-converter-py-nxwidgets"><code class="docutils literal notranslate"><span class="pre">bitmap_converter.py</span></code> NxWidgets</a></li>
<li class="toctree-l3"><a class="reference internal" href="#mkromfsimg-sh"><code class="docutils literal notranslate"><span class="pre">mkromfsimg.sh</span></code></a><ul>
<li class="toctree-l4"><a class="reference internal" href="#processes-and-programs-in-the-kernel-build">Processes and Programs in the KERNEL Build</a></li>
<li class="toctree-l4"><a class="reference internal" href="#kernel-build-differences">KERNEL Build Differences</a></li>
<li class="toctree-l4"><a class="reference internal" href="#apps-bin">apps/bin</a></li>
<li class="toctree-l4"><a class="reference internal" href="#apps-tools-mkromfsimg-sh">apps/tools/mkromfsimg.sh</a></li>
<li class="toctree-l4"><a class="reference internal" href="#application-initialization">Application Initialization</a></li>
</ul>
</li>
</ul>
</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="../../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>
</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 active">Host Side Tools</li>
<li class="wy-breadcrumbs-aside">
<a href="../../_sources/applications/tools/index.rst.txt" rel="nofollow"> View page source</a>
</li>
</ul>
<hr/>
</div>
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
<div itemprop="articleBody">
<section id="host-side-tools">
<h1>Host Side Tools<a class="headerlink" href="#host-side-tools" title="Permalink to this heading"></a></h1>
<section id="bitmap-converter-py-nxwidgets">
<h2><code class="docutils literal notranslate"><span class="pre">bitmap_converter.py</span></code> NxWidgets<a class="headerlink" href="#bitmap-converter-py-nxwidgets" title="Permalink to this heading"></a></h2>
<p>This script converts from any image type supported by Python imaging library to
the RLE-encoded format used by NxWidgets.</p>
<p>RLE (Run Length Encoding) is a very simply encoding that compress quite well
with certain kinds of images: Images that that have many pixels of the same
color adjacent on a row (like simple graphics). It does not work well with
photographic images.</p>
<p>But even simple graphics may not encode compactly if, for example, they have
been resized. Resizing an image can create hundreds of unique colors that may
differ by only a bit or two in the RGB representation. This “color smear” is the
result of pixel interpolation (and might be eliminated if your graphics software
supports resizing via pixel replication instead of interpolation).</p>
<p>When a simple graphics image does not encode well, the symptom is that the
resulting RLE data structures are quite large. The palette structure, in
particular, may have hundreds of colors in it. There is a way to fix the graphic
image in this case. Here is what I do (in fact, I do this on all images prior to
conversion just to be certain):</p>
<ul class="simple">
<li><p>Open the original image in GIMP.</p></li>
<li><p>Select the option to select the number of colors in the image.</p></li>
<li><p>Pick the smallest number of colors that will represent the image faithfully.
For most simple graphic images this might be as few as 6 or 8 colors.</p></li>
<li><p>Save the image as PNG or other lossless format (NOT jpeg).</p></li>
<li><p>Then generate the image.</p></li>
</ul>
</section>
<section id="mkromfsimg-sh">
<h2><code class="docutils literal notranslate"><span class="pre">mkromfsimg.sh</span></code><a class="headerlink" href="#mkromfsimg-sh" title="Permalink to this heading"></a></h2>
<p><strong>Q</strong>: Why are there two versions of the script <code class="docutils literal notranslate"><span class="pre">mkromfsimg.sh</span></code>, one in
<code class="docutils literal notranslate"><span class="pre">apps/tools</span></code> and one in <code class="docutils literal notranslate"><span class="pre">nuttx/tools</span></code>.</p>
<p><strong>A</strong>: The version of <code class="docutils literal notranslate"><span class="pre">mkromfsimg.sh</span></code> in <code class="docutils literal notranslate"><span class="pre">nuttx/tools</span></code> is a generic
tool to simplify creation of ROMFS file system from any directory contain
content that you would like to access within the the target.</p>
<p>The version in <code class="docutils literal notranslate"><span class="pre">apps/tools</span></code>, on the other hand, has a very special purpose.
It is part of the support that can be used in the KERNEL build mode.</p>
<section id="processes-and-programs-in-the-kernel-build">
<h3>Processes and Programs in the KERNEL Build<a class="headerlink" href="#processes-and-programs-in-the-kernel-build" title="Permalink to this heading"></a></h3>
<p>In the kernel build, there are no tasks. There are only processes and all
code lives in its own, private address space.
See <a class="reference internal" href="../../implementation/processes_vs_tasks.html"><span class="doc">Linux Processes vs NuttX Tasks</span></a>.</p>
<p>One consequence of that is that functions like <code class="docutils literal notranslate"><span class="pre">task_create()</span></code> and friends
cannot be used in the KERNEL build mode. Instead, all processes must be loaded
into a virtual address space from an ELF or NxFLAT file residing in the file
system. ROMFS is one of many file system, but one that is particularly usable
for this purpose in deeply embedded systems.</p>
</section>
<section id="kernel-build-differences">
<h3>KERNEL Build Differences<a class="headerlink" href="#kernel-build-differences" title="Permalink to this heading"></a></h3>
<p>In the FLAT and PROTECTED build mode all applications are built into a single
BLOB, so every symbol must have a unique name to avoid name collisions.</p>
<p>In the KERNEL build mode, all applications are built at separately linked
programs that reside in a file system. The entry point to ALL programs is the
function <code class="docutils literal notranslate"><span class="pre">main()</span></code>.</p>
</section>
<section id="apps-bin">
<h3>apps/bin<a class="headerlink" href="#apps-bin" title="Permalink to this heading"></a></h3>
<p>When you build the <code class="docutils literal notranslate"><span class="pre">apps/</span></code> programs in FLAT or PROTECTED modes, all of the
object files are put into an archive apps/libapps.a which is, eventually,
copied to <code class="docutils literal notranslate"><span class="pre">nuttx/libs</span></code> and the BLOB is created by linking NuttX archives
with <code class="docutils literal notranslate"><span class="pre">lib/libapps.a</span></code>.</p>
<p>But when you build the <code class="docutils literal notranslate"><span class="pre">apps/</span></code> programs in the KERNEL mode, the directory
<code class="docutils literal notranslate"><span class="pre">apps/bin</span></code> is created by the top-level apps/Makefile. Each source file is
compiled, but the object files are not added to ayn archive. Instead, the
object files are linked into a separate compiled and linked program. Each program
is then installed at <code class="docutils literal notranslate"><span class="pre">apps/bin</span></code>.</p>
</section>
<section id="apps-tools-mkromfsimg-sh">
<h3>apps/tools/mkromfsimg.sh<a class="headerlink" href="#apps-tools-mkromfsimg-sh" title="Permalink to this heading"></a></h3>
<p>When the <code class="docutils literal notranslate"><span class="pre">apps/</span></code> kernel build is complete, all of the programs have been installed
in <code class="docutils literal notranslate"><span class="pre">apps/bin</span></code>. That is where <code class="docutils literal notranslate"><span class="pre">apps/tools/mkromfsimg.sh</span></code> file comes into to play.
It takes all of the programs in apps/bin and creates a ROMFS file system image
containing all of the applications. That ROMFS file system image is built into
the kernel.</p>
</section>
<section id="application-initialization">
<h3>Application Initialization<a class="headerlink" href="#application-initialization" title="Permalink to this heading"></a></h3>
<p>At run time, when the kernel boots, it will mount that ROMFS file system at <code class="docutils literal notranslate"><span class="pre">/bin</span></code>.
In the FLAT build mode, the OS boot logic calls <code class="docutils literal notranslate"><span class="pre">task_create()</span></code> to start the initial
task you have configured with <code class="docutils literal notranslate"><span class="pre">CONFIG_INIT_ENTRYPOINT</span></code>. But in the KERNEL build, something
different happens. <code class="docutils literal notranslate"><span class="pre">CONFIG_INIT_ENTRYPOINT</span></code> is not used. Instead, <code class="docutils literal notranslate"><span class="pre">CONFIG_INIT_FILEPATH</span></code>
is used. This will be the name of the program to stared in <code class="docutils literal notranslate"><span class="pre">/bin</span></code> to bring up the system.</p>
</section>
</section>
</section>
</div>
</div>
<footer><div class="rst-footer-buttons" role="navigation" aria-label="Footer">
<a href="../testing/unity/index.html" class="btn btn-neutral float-left" title="unity Unity testing framework" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a>
<a href="../wireless/index.html" class="btn btn-neutral float-right" title="Wireless Libraries and NSH Add-Ons" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a>
</div>
<hr/>
<div role="contentinfo">
<p>&#169; Copyright 2023, The Apache Software Foundation.</p>
</div>
</footer>
</div>
</div>
</section>
</div>
<script>
jQuery(function () {
SphinxRtdTheme.Navigation.enable(true);
});
</script>
</body>
</html>