blob: da1ef020aee1cdbd546e43381823abf7ec61de43 [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>zmodem Zmodem Commands &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="Testing" href="../../testing/index.html" />
<link rel="prev" title="zlib zlib data compression library" href="../zlib/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 current"><a class="reference internal" href="../index.html">System Libraries and NSH Add-Ons</a><ul class="current">
<li class="toctree-l3"><a class="reference internal" href="../adb/index.html"><code class="docutils literal notranslate"><span class="pre">adb</span></code> ADB daemon application</a></li>
<li class="toctree-l3"><a class="reference internal" href="../argtable3/index.html"><code class="docutils literal notranslate"><span class="pre">argtable3</span></code> ARGTABLE3 library</a></li>
<li class="toctree-l3"><a class="reference internal" href="../cdcacm/index.html"><code class="docutils literal notranslate"><span class="pre">cdcacm</span></code> USB CDC/ACM Device Commands</a></li>
<li class="toctree-l3"><a class="reference internal" href="../cfgdata/index.html"><code class="docutils literal notranslate"><span class="pre">cfgdata</span></code> Cfgdata Command</a></li>
<li class="toctree-l3"><a class="reference internal" href="../cle/index.html"><code class="docutils literal notranslate"><span class="pre">cle</span></code> EMACS-like Command Line Editor</a></li>
<li class="toctree-l3"><a class="reference internal" href="../composite/index.html"><code class="docutils literal notranslate"><span class="pre">composite</span></code> USB Composite Device Commands</a></li>
<li class="toctree-l3"><a class="reference internal" href="../coredump/index.html"><code class="docutils literal notranslate"><span class="pre">coredump</span></code> Coredump tool capture system status</a></li>
<li class="toctree-l3"><a class="reference internal" href="../crimon/index.html"><code class="docutils literal notranslate"><span class="pre">critmon</span></code> Critcal Section Monitor</a></li>
<li class="toctree-l3"><a class="reference internal" href="../cu/index.html"><code class="docutils literal notranslate"><span class="pre">cu</span></code> CU minimal serial terminal</a></li>
<li class="toctree-l3"><a class="reference internal" href="../dd/index.html"><code class="docutils literal notranslate"><span class="pre">dd</span></code> system ‘dd’ command</a></li>
<li class="toctree-l3"><a class="reference internal" href="../debugpoint/index.html"><code class="docutils literal notranslate"><span class="pre">debugpoint</span></code> Debug Utility</a></li>
<li class="toctree-l3"><a class="reference internal" href="../dhcp6c/index.html"><code class="docutils literal notranslate"><span class="pre">dhcp6c</span></code> DHCP IPv6 Address Renewal</a></li>
<li class="toctree-l3"><a class="reference internal" href="../dhcpc/index.html"><code class="docutils literal notranslate"><span class="pre">dhcpc</span></code> DHCP Address Renewal</a></li>
<li class="toctree-l3"><a class="reference internal" href="../dumpstack/index.html"><code class="docutils literal notranslate"><span class="pre">dumpstack</span></code> dumpstack tool for show the task backtrace</a></li>
<li class="toctree-l3"><a class="reference internal" href="../fastboot/index.html"><code class="docutils literal notranslate"><span class="pre">fastboot</span></code> fastbootd</a></li>
<li class="toctree-l3"><a class="reference internal" href="../fdt/index.html"><code class="docutils literal notranslate"><span class="pre">fdt</span></code> fdt utility tools</a></li>
<li class="toctree-l3"><a class="reference internal" href="../flash_eraseall/index.html"><code class="docutils literal notranslate"><span class="pre">flash_eraseall</span></code> FLASH Erase-all Command</a></li>
<li class="toctree-l3"><a class="reference internal" href="../gcov/index.html"><code class="docutils literal notranslate"><span class="pre">gcov</span></code> gcov tool</a></li>
<li class="toctree-l3"><a class="reference internal" href="../gdbstub/index.html"><code class="docutils literal notranslate"><span class="pre">gdbstub</span></code> GDBSTUB</a></li>
<li class="toctree-l3"><a class="reference internal" href="../hex2bin/index.html"><code class="docutils literal notranslate"><span class="pre">hex2bin</span></code> Intel HEX to binary conversion</a></li>
<li class="toctree-l3"><a class="reference internal" href="../hexed/index.html"><code class="docutils literal notranslate"><span class="pre">hexed</span></code> Hex editor</a></li>
<li class="toctree-l3"><a class="reference internal" href="../hostname/index.html"><code class="docutils literal notranslate"><span class="pre">hostname</span></code> “hostname” command</a></li>
<li class="toctree-l3"><a class="reference internal" href="../i2c/index.html"><code class="docutils literal notranslate"><span class="pre">i2c</span></code> I2C Tool</a></li>
<li class="toctree-l3"><a class="reference internal" href="../input/index.html"><code class="docutils literal notranslate"><span class="pre">input</span></code> input tool</a></li>
<li class="toctree-l3"><a class="reference internal" href="../iptables/index.html"><code class="docutils literal notranslate"><span class="pre">iptables</span></code> “iptables” command</a></li>
<li class="toctree-l3"><a class="reference internal" href="../libuv/index.html"><code class="docutils literal notranslate"><span class="pre">libuv</span></code> libuv asynchronous I/O Library</a></li>
<li class="toctree-l3"><a class="reference internal" href="../lm75/index.html"><code class="docutils literal notranslate"><span class="pre">lm75</span></code> LM75 Temperature</a></li>
<li class="toctree-l3"><a class="reference internal" href="../lzf/index.html"><code class="docutils literal notranslate"><span class="pre">lzf</span></code> LZF compression tool</a></li>
<li class="toctree-l3"><a class="reference internal" href="../mdio/index.html"><code class="docutils literal notranslate"><span class="pre">mdio</span></code> PHY MDIO tool</a></li>
<li class="toctree-l3"><a class="reference internal" href="../netdb/index.html"><code class="docutils literal notranslate"><span class="pre">netdb</span></code> netdb interface</a></li>
<li class="toctree-l3"><a class="reference internal" href="../nsh/index.html"><code class="docutils literal notranslate"><span class="pre">nsh</span></code> NuttShell (NSH) example</a></li>
<li class="toctree-l3"><a class="reference internal" href="../ntpc/index.html"><code class="docutils literal notranslate"><span class="pre">ntpc</span></code> NTP Daemon Commands</a></li>
<li class="toctree-l3"><a class="reference internal" href="../nxcamera/index.html"><code class="docutils literal notranslate"><span class="pre">nxcamera</span></code> NxCamera video test application</a></li>
<li class="toctree-l3"><a class="reference internal" href="../nxcodec/index.html"><code class="docutils literal notranslate"><span class="pre">nxcodec</span></code> NxCodec video codec test application</a></li>
<li class="toctree-l3"><a class="reference internal" href="../nxdiag/index.html"><code class="docutils literal notranslate"><span class="pre">nxdiag</span></code> NuttX Diagnostic Tool</a></li>
<li class="toctree-l3"><a class="reference internal" href="../nxlooper/index.html"><code class="docutils literal notranslate"><span class="pre">nxlooper</span></code> NxLooper audio test application</a></li>
<li class="toctree-l3"><a class="reference internal" href="../nxplayer/index.html"><code class="docutils literal notranslate"><span class="pre">nxplayer</span></code> NxPlayer Media Player</a></li>
<li class="toctree-l3"><a class="reference internal" href="../nxrecorder/index.html"><code class="docutils literal notranslate"><span class="pre">nxrecorder</span></code> NxRecorder pcm raw data Recorder</a></li>
<li class="toctree-l3"><a class="reference internal" href="../ofloader/index.html"><code class="docutils literal notranslate"><span class="pre">ofloader</span></code> Open flash loader</a></li>
<li class="toctree-l3"><a class="reference internal" href="../ping/index.html"><code class="docutils literal notranslate"><span class="pre">ping</span></code> ICMP “ping” command</a></li>
<li class="toctree-l3"><a class="reference internal" href="../ping6/index.html"><code class="docutils literal notranslate"><span class="pre">ping6</span></code> ICMPv6 “ping6” command</a></li>
<li class="toctree-l3"><a class="reference internal" href="../popen/index.html"><code class="docutils literal notranslate"><span class="pre">popen</span></code> popen()/pclose() Functions</a></li>
<li class="toctree-l3"><a class="reference internal" href="../psmq/index.html"><code class="docutils literal notranslate"><span class="pre">psmq</span></code> Publish Subscribe Message Queue</a></li>
<li class="toctree-l3"><a class="reference internal" href="../ptpd/index.html"><code class="docutils literal notranslate"><span class="pre">ptpd</span></code> PTP daemon commands</a></li>
<li class="toctree-l3"><a class="reference internal" href="../readline/index.html"><code class="docutils literal notranslate"><span class="pre">readline</span></code> readline() Support</a></li>
<li class="toctree-l3"><a class="reference internal" href="../sched_note/index.html"><code class="docutils literal notranslate"><span class="pre">sched_note</span></code> Scheduler monitor</a></li>
<li class="toctree-l3"><a class="reference internal" href="../setlogmask/index.html"><code class="docutils literal notranslate"><span class="pre">setlogmask</span></code> “setlogmask” command</a></li>
<li class="toctree-l3"><a class="reference internal" href="../spi/index.html"><code class="docutils literal notranslate"><span class="pre">spi</span></code> SPI Tool</a></li>
<li class="toctree-l3"><a class="reference internal" href="../stackmonitor/index.html"><code class="docutils literal notranslate"><span class="pre">stackmonitor</span></code> Stack Monitor</a></li>
<li class="toctree-l3"><a class="reference internal" href="../system/index.html"><code class="docutils literal notranslate"><span class="pre">system</span></code> System Command</a></li>
<li class="toctree-l3"><a class="reference internal" href="../taskset/index.html"><code class="docutils literal notranslate"><span class="pre">taskset</span></code> Taskset Command</a></li>
<li class="toctree-l3"><a class="reference internal" href="../tcpdump/index.html"><code class="docutils literal notranslate"><span class="pre">tcpdump</span></code> tcpdump command</a></li>
<li class="toctree-l3"><a class="reference internal" href="../tee/index.html"><code class="docutils literal notranslate"><span class="pre">tee</span></code> Tee Command</a></li>
<li class="toctree-l3"><a class="reference internal" href="../telnet/index.html"><code class="docutils literal notranslate"><span class="pre">telnet</span></code> Telnet chat daemon</a></li>
<li class="toctree-l3"><a class="reference internal" href="../telnetd/index.html"><code class="docutils literal notranslate"><span class="pre">telnetd</span></code> Telnet daemon application</a></li>
<li class="toctree-l3"><a class="reference internal" href="../termcurses/index.html"><code class="docutils literal notranslate"><span class="pre">termcurses</span></code> Terminal Curses control support</a></li>
<li class="toctree-l3"><a class="reference internal" href="../trace/index.html"><code class="docutils literal notranslate"><span class="pre">trace</span></code> Trace command</a></li>
<li class="toctree-l3"><a class="reference internal" href="../ubloxmodem/index.html"><code class="docutils literal notranslate"><span class="pre">ubloxmodem</span></code> u-blox modem configuration tool</a></li>
<li class="toctree-l3"><a class="reference internal" href="../uniqueid/index.html"><code class="docutils literal notranslate"><span class="pre">uniqueid</span></code> “uniqueid” command</a></li>
<li class="toctree-l3"><a class="reference internal" href="../uorb/index.html"><code class="docutils literal notranslate"><span class="pre">uorb</span></code> uorb(micro object request broker)</a></li>
<li class="toctree-l3"><a class="reference internal" href="../usbmsc/index.html"><code class="docutils literal notranslate"><span class="pre">usbmsc</span></code> USB Mass Storage Device Commands</a></li>
<li class="toctree-l3"><a class="reference internal" href="../vi/index.html"><code class="docutils literal notranslate"><span class="pre">vi</span></code> VI Work-Alike Text Editor</a></li>
<li class="toctree-l3"><a class="reference internal" href="../ymodem/index.html"><code class="docutils literal notranslate"><span class="pre">ymodem</span></code> YMODEM</a></li>
<li class="toctree-l3"><a class="reference internal" href="../zlib/index.html"><code class="docutils literal notranslate"><span class="pre">zlib</span></code> zlib data compression library</a></li>
<li class="toctree-l3 current"><a class="current reference internal" href="#"><code class="docutils literal notranslate"><span class="pre">zmodem</span></code> Zmodem Commands</a><ul>
<li class="toctree-l4"><a class="reference internal" href="#contents">Contents</a></li>
<li class="toctree-l4"><a class="reference internal" href="#buffering-notes">Buffering Notes</a><ul>
<li class="toctree-l5"><a class="reference internal" href="#hardware-flow-control">Hardware Flow Control</a></li>
<li class="toctree-l5"><a class="reference internal" href="#software-flow-control">Software Flow Control</a></li>
<li class="toctree-l5"><a class="reference internal" href="#rx-buffer-size">RX Buffer Size</a></li>
<li class="toctree-l5"><a class="reference internal" href="#buffer-recommendations">Buffer Recommendations</a></li>
</ul>
</li>
<li class="toctree-l4"><a class="reference internal" href="#using-nuttx-zmodem-with-a-linux-host">Using NuttX ZModem with a Linux Host</a><ul>
<li class="toctree-l5"><a class="reference internal" href="#sending-files-from-the-target-to-the-linux-host-pc">Sending Files from the Target to the Linux Host PC</a></li>
<li class="toctree-l5"><a class="reference internal" href="#receiving-files-on-the-target-from-the-linux-host-pc">Receiving Files on the Target from the Linux Host PC</a></li>
</ul>
</li>
<li class="toctree-l4"><a class="reference internal" href="#building-the-zmodem-tools-to-run-under-linux">Building the ZModem Tools to Run Under Linux</a></li>
<li class="toctree-l4"><a class="reference internal" href="#status">Status</a></li>
</ul>
</li>
</ul>
</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="../../../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"><a href="../index.html">System Libraries and NSH Add-Ons</a></li>
<li class="breadcrumb-item active"><code class="docutils literal notranslate"><span class="pre">zmodem</span></code> Zmodem Commands</li>
<li class="wy-breadcrumbs-aside">
<a href="../../../_sources/applications/system/zmodem/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="zmodem-zmodem-commands">
<h1><code class="docutils literal notranslate"><span class="pre">zmodem</span></code> Zmodem Commands<a class="headerlink" href="#zmodem-zmodem-commands" title="Permalink to this heading"></a></h1>
<section id="contents">
<h2>Contents<a class="headerlink" href="#contents" title="Permalink to this heading"></a></h2>
<ul class="simple">
<li><p>Buffering Notes</p>
<ul>
<li><p>Hardware Flow Control</p></li>
<li><p>RX Buffer Size</p></li>
<li><p>Buffer Recommendations</p></li>
</ul>
</li>
<li><p>Using NuttX ZModem with a Linux Host</p>
<ul>
<li><p>Sending Files from the Target to the Linux Host PC</p></li>
<li><p>Receiving Files on the Target from the Linux Host PC</p></li>
</ul>
</li>
<li><p>Building the ZModem Tools to Run Under Linux</p></li>
<li><p>Status</p></li>
</ul>
</section>
<section id="buffering-notes">
<h2>Buffering Notes<a class="headerlink" href="#buffering-notes" title="Permalink to this heading"></a></h2>
<section id="hardware-flow-control">
<h3>Hardware Flow Control<a class="headerlink" href="#hardware-flow-control" title="Permalink to this heading"></a></h3>
<p>Hardware flow control must be enabled in serial drivers in order to prevent data
overrun. However, in the most NuttX serial drivers, hardware flow control only
protects the hardware RX FIFO: Data will not be lost in the hardware FIFO but
can still be lost when it is taken from the FIFO. We can still overflow the
serial driver’s RX buffer even with hardware flow control enabled! That is
probably a bug. But the workaround solution that I have used is to use lower
data rates and a large serial driver RX buffer.</p>
<p>Those measures should be unnecessary if buffering and hardware flow control are
set up and working correctly.</p>
</section>
<section id="software-flow-control">
<h3>Software Flow Control<a class="headerlink" href="#software-flow-control" title="Permalink to this heading"></a></h3>
<p>The ZModem protocol has <code class="docutils literal notranslate"><span class="pre">XON/XOFF</span></code> flow control built into it. The protocol
permits <code class="docutils literal notranslate"><span class="pre">XON</span></code> or <code class="docutils literal notranslate"><span class="pre">XOFF</span></code> characters placed at certain parts of messages. If
software flow control is enabled on the receiving end it will consume the <code class="docutils literal notranslate"><span class="pre">XON</span></code> s
and <code class="docutils literal notranslate"><span class="pre">XOFF</span></code> s. Otherwise they will be ignored in the data by the ZModem logic.</p>
<p>NuttX, however, does not implement <code class="docutils literal notranslate"><span class="pre">XON/XOFF</span></code> flow control so these do nothing.
On NuttX you will have to use hardware flow control in most cases.</p>
<p>The <code class="docutils literal notranslate"><span class="pre">XON</span></code> / <code class="docutils literal notranslate"><span class="pre">XOFF</span></code> controls built into ZModem could be used if you enabled
software flow control in the host. But that would only work in one direction: If
would prevent the host from overrunning the the target Rx buffering. So you
should be able to do host-to-target software flow control. But there would still
be no target-to-host flow control. That might not be an issue because the host
is usually so much faster than that target.</p>
</section>
<section id="rx-buffer-size">
<h3>RX Buffer Size<a class="headerlink" href="#rx-buffer-size" title="Permalink to this heading"></a></h3>
<p>The ZModem protocol supports a message that informs the file sender of the
maximum size of data that you can buffer (<code class="docutils literal notranslate"><span class="pre">ZRINIT</span></code>). However, my experience is
that the Linux sz ignores this setting and always sends file data at the maximum
size (<code class="docutils literal notranslate"><span class="pre">1024</span></code>) no matter what size of buffer you report. That is unfortunate
because that, combined with the possibilities of data overrun mean that you must
use quite large buffering for ZModem file receipt to be reliable (none of these
issues effect sending of files).</p>
</section>
<section id="buffer-recommendations">
<h3>Buffer Recommendations<a class="headerlink" href="#buffer-recommendations" title="Permalink to this heading"></a></h3>
<p>Based on the limitations of NuttX hardware flow control and of the Linux sz
behavior, I have been testing with the following configuration (assuming <code class="docutils literal notranslate"><span class="pre">UART1</span></code>
is the ZModem device):</p>
<ol class="arabic">
<li><p>This setting determines that maximum size of a data packet frame:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>CONFIG_SYSTEM_ZMODEM_PKTBUFSIZE=1024
</pre></div>
</div>
</li>
<li><p>Input Buffering. If the input buffering is set to a full frame, then data
overflow is less likely:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>CONFIG_UART1_RXBUFSIZE=1024
</pre></div>
</div>
</li>
<li><p>With a larger driver input buffer, the ZModem receive I/O buffer can be
smaller:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>CONFIG_SYSTEM_ZMODEM_RCVBUFSIZE=256
</pre></div>
</div>
</li>
<li><p>Output buffering. Overrun cannot occur on output (on the NuttX side) so there
is no need to be so careful:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>CONFIG_SYSTEM_ZMODEM_SNDBUFSIZE=512
CONFIG_UART1_TXBUFSIZE=256
</pre></div>
</div>
</li>
</ol>
</section>
</section>
<section id="using-nuttx-zmodem-with-a-linux-host">
<h2>Using NuttX ZModem with a Linux Host<a class="headerlink" href="#using-nuttx-zmodem-with-a-linux-host" title="Permalink to this heading"></a></h2>
<section id="sending-files-from-the-target-to-the-linux-host-pc">
<h3>Sending Files from the Target to the Linux Host PC<a class="headerlink" href="#sending-files-from-the-target-to-the-linux-host-pc" title="Permalink to this heading"></a></h3>
<p>The NuttX ZModem commands have been verified against the rzsz programs running
on a Linux PC. To send a file to the PC, first make sure that the serial port is
configured to work with the board (Assuming you are using 9600 baud for the data
transfers - high rates may result in data overruns):</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>$ sudo stty -F /dev/ttyS0 9600 # Select 9600 BAUD
$ sudo stty -F /dev/ttyS0 crtscts # Enables CTS/RTS handshaking *
$ sudo stty -F /dev/ttyS0 raw # Puts the TTY in raw mode
$ sudo stty -F /dev/ttyS0 # Show the TTY configuration
</pre></div>
</div>
<p>Only if hardware flow control is enabled.</p>
<p>Start <code class="docutils literal notranslate"><span class="pre">rz</span></code> on the Linux host (using <code class="docutils literal notranslate"><span class="pre">/dev/ttyS0</span></code> as an example):</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>$ sudo rz &lt; /dev/ttyS0 &gt; /dev/ttyS0
</pre></div>
</div>
<p>You can add the <code class="docutils literal notranslate"><span class="pre">rz</span> <span class="pre">-v</span></code> option multiple times, each increases the level of debug
output. If you want to capture the Linux <code class="docutils literal notranslate"><span class="pre">rz</span></code> output, then re-direct <code class="docutils literal notranslate"><span class="pre">stderr</span></code> to
a log file by adding <code class="docutils literal notranslate"><span class="pre">2&gt;rz.log</span></code> to the end of the <code class="docutils literal notranslate"><span class="pre">rz</span></code> command.</p>
<p><strong>Note</strong>: The NuttX ZModem does sends <code class="docutils literal notranslate"><span class="pre">rz\n</span></code> when it starts in compliance with
the ZModem specification. On Linux this, however, seems to start some other,
incompatible version of <code class="docutils literal notranslate"><span class="pre">rz</span></code>. You need to start <code class="docutils literal notranslate"><span class="pre">rz</span></code> manually to make sure that
the correct version is selected. You can tell when this evil <code class="docutils literal notranslate"><span class="pre">rz</span></code>/<code class="docutils literal notranslate"><span class="pre">sz</span></code> has
inserted itself because you will see the <code class="docutils literal notranslate"><span class="pre">^</span></code> (<code class="docutils literal notranslate"><span class="pre">0x5e</span></code>) character replacing the
standard ZModem <code class="docutils literal notranslate"><span class="pre">ZDLE</span></code> character (<code class="docutils literal notranslate"><span class="pre">0x19</span></code>) in the binary data stream.</p>
<p>If you don’t have the <code class="docutils literal notranslate"><span class="pre">rz</span></code> command on your Linux box, the package to install
<code class="docutils literal notranslate"><span class="pre">rzsz</span></code> (or possibly <code class="docutils literal notranslate"><span class="pre">lrzsz</span></code>).</p>
<p>Then on the target (using <code class="docutils literal notranslate"><span class="pre">/dev/ttyS1</span></code> as an example):</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>nsh&gt; sz -d /dev/ttyS1 &lt;filename&gt;
</pre></div>
</div>
<p>Where filename is the full path to the file to send (i.e., it begins with the
<code class="docutils literal notranslate"><span class="pre">/</span></code> character). <code class="docutils literal notranslate"><span class="pre">/dev/ttyS1</span></code> or whatever device you select <strong>must</strong> support
Hardware flow control in order to throttle therates of data transfer to fit
within the allocated buffers.</p>
</section>
<section id="receiving-files-on-the-target-from-the-linux-host-pc">
<h3>Receiving Files on the Target from the Linux Host PC<a class="headerlink" href="#receiving-files-on-the-target-from-the-linux-host-pc" title="Permalink to this heading"></a></h3>
<p><strong>Note</strong>: There are issues with using the Linux <code class="docutils literal notranslate"><span class="pre">sz</span></code> command with the NuttX <code class="docutils literal notranslate"><span class="pre">rz</span></code>
command. See _Status_ below. It is recommended that you use the NuttX <code class="docutils literal notranslate"><span class="pre">sz</span></code>
command on Linux as described in the next paragraph.</p>
<p>To send a file to the target, first make sure that the serial port on the host
is configured to work with the board (Assuming that you are using <code class="docutils literal notranslate"><span class="pre">9600</span></code> baud
for the data transfers - high rates may result in data overruns):</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>$ sudo stty -F /dev/ttyS0 9600 # Select 9600 (or other) BAUD
$ sudo stty -F /dev/ttyS0 crtscts # Enables CTS/RTS handshaking *
$ sudo stty -F /dev/ttyS0 raw # Puts the TTY in raw mode
$ sudo stty -F /dev/ttyS0 # Show the TTY configuration
</pre></div>
</div>
<p>Only is hardware flow control is enabled.</p>
<p>Start <code class="docutils literal notranslate"><span class="pre">rz</span></code> on the on the target. Here, in this example, we are using
<code class="docutils literal notranslate"><span class="pre">/dev/ttyS1</span></code> to perform the transfer:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>nsh&gt; rz -d /dev/ttyS1
</pre></div>
</div>
<p><code class="docutils literal notranslate"><span class="pre">/dev/ttyS1</span></code> or whatever device you select <strong>must</strong> support Hardware flow
control in order to throttle therates of data transfer to fit within the
allocated buffers.</p>
<p>Then use the <code class="docutils literal notranslate"><span class="pre">sz</span></code> command on Linux to send the file to the target:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>$ sudo sz &lt;filename&gt; [-l nnnn] [-w nnnn] &lt;/dev/ttyS0 &gt;/dev/ttyS0
</pre></div>
</div>
<p>Where <code class="docutils literal notranslate"><span class="pre">&lt;filename&gt;</span></code> is the file that you want to send. If <code class="docutils literal notranslate"><span class="pre">-l</span> <span class="pre">nnnn</span></code> and <code class="docutils literal notranslate"><span class="pre">-w</span> <span class="pre">nnnn</span></code>
is not specified, then there will likely be packet buffer overflow errors.
<code class="docutils literal notranslate"><span class="pre">nnnn</span></code> should be set to a value less than or equal to
<code class="docutils literal notranslate"><span class="pre">CONFIG_SYSTEM_ZMODEM_PKTBUFSIZE</span></code>.</p>
<p>The resulting file will be found where you have configured the ZModem
<strong>sandbox</strong> via <code class="docutils literal notranslate"><span class="pre">CONFIG_SYSTEM_ZMODEM_MOUNTPOINT</span></code>.</p>
<p>You can add the <code class="docutils literal notranslate"><span class="pre">sz</span> <span class="pre">-v</span></code> option multiple times, each increases the level of debug
output. If you want to capture the Linux <code class="docutils literal notranslate"><span class="pre">sz</span></code> output, then re-direct <code class="docutils literal notranslate"><span class="pre">stderr</span></code> to
a log file by adding <code class="docutils literal notranslate"><span class="pre">2&gt;sz.log</span></code> to the end of the <code class="docutils literal notranslate"><span class="pre">sz</span></code> command.</p>
<p>If you don’t have the sz command on your Linux box, the package to install
<code class="docutils literal notranslate"><span class="pre">rzsz</span></code> (or possibly <code class="docutils literal notranslate"><span class="pre">lrzsz</span></code>).</p>
</section>
</section>
<section id="building-the-zmodem-tools-to-run-under-linux">
<h2>Building the ZModem Tools to Run Under Linux<a class="headerlink" href="#building-the-zmodem-tools-to-run-under-linux" title="Permalink to this heading"></a></h2>
<p>Build support has been added so that the NuttX ZModem implementation can be
executed on a Linux host PC. This can be done by</p>
<ul class="simple">
<li><p>Change to the <code class="docutils literal notranslate"><span class="pre">apps/systems/zmodem</span></code> directory</p></li>
<li><p>Make using the special makefile, <code class="docutils literal notranslate"><span class="pre">Makefile.host</span></code></p></li>
</ul>
<p><strong>Notes</strong>:</p>
<ol class="arabic">
<li><p><code class="docutils literal notranslate"><span class="pre">TOPDIR</span></code> and <code class="docutils literal notranslate"><span class="pre">APPDIR</span></code> must be defined on the make command line: <code class="docutils literal notranslate"><span class="pre">TOPDIR</span></code> is
the full path to the <code class="docutils literal notranslate"><span class="pre">nuttx/</span></code> directory; <code class="docutils literal notranslate"><span class="pre">APPDIR</span></code> is the full path to the
<code class="docutils literal notranslate"><span class="pre">apps/</span></code> directory. For example, if you installed nuttx at
<code class="docutils literal notranslate"><span class="pre">/home/me/projects/nuttx</span></code> and apps at <code class="docutils literal notranslate"><span class="pre">/home/me/projects/apps</span></code>, then the
correct make command line would be:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>make -f Makefile.host TOPDIR=/home/me/projects/nuttx APPDIR=/home/me/projects/apps
</pre></div>
</div>
</li>
<li><p>Add <code class="docutils literal notranslate"><span class="pre">CONFIG_DEBUG_FEATURES=1</span></code> to the make command line to enable debug output</p></li>
<li><p>Make sure to clean old target <code class="docutils literal notranslate"><span class="pre">.o</span></code> files before making new host <code class="docutils literal notranslate"><span class="pre">.o</span></code> files.</p></li>
</ol>
<p>This build is has been verified as of <code class="docutils literal notranslate"><span class="pre">2013-7-16</span></code> using Linux to transfer files
with an Olimex LPC1766STK board. It works great and seems to solve all of the
problems found with the Linux <code class="docutils literal notranslate"><span class="pre">sz</span></code>/<code class="docutils literal notranslate"><span class="pre">rz</span></code> implementation.</p>
</section>
<section id="status">
<h2>Status<a class="headerlink" href="#status" title="Permalink to this heading"></a></h2>
<ul>
<li><p><code class="docutils literal notranslate"><span class="pre">2013-7-15</span></code>: Testing against the Linux <code class="docutils literal notranslate"><span class="pre">rz</span></code>/<code class="docutils literal notranslate"><span class="pre">sz</span></code> commands.</p>
<p>I have tested with the <code class="docutils literal notranslate"><span class="pre">boards/arm/lpc17xx_40xx/olimex-lpc1766stk</span></code>
configuration. I have been able to send large and small files with the target
<code class="docutils literal notranslate"><span class="pre">sz</span></code> command. I have been able to receive small files, but there are problems
receiving large files using the Linux <code class="docutils literal notranslate"><span class="pre">sz</span></code> command: The Linux <code class="docutils literal notranslate"><span class="pre">sz</span></code> does not
obey the buffering limits and continues to send data while <code class="docutils literal notranslate"><span class="pre">rz</span></code> is writing the
previously received data to the file and the serial driver’s RX buffer is
overrun by a few bytes while the write is in progress. As a result, when it
reads the next buffer of data, a few bytes may be missing. The symptom of this
missing data is a CRC check failure.</p>
<p>Either (1) we need a more courteous host application, or (2) we need to
greatly improve the target side buffering capability!</p>
<p>My thought now is to implement the NuttX <code class="docutils literal notranslate"><span class="pre">sz</span></code> and <code class="docutils literal notranslate"><span class="pre">rz</span></code> commands as PC side
applications as well. Matching both sides and obeying the handshaking will
solve the issues. Another option might be to fix the serial driver hardware
flow control somehow.</p>
</li>
<li><p><code class="docutils literal notranslate"><span class="pre">2013-7-16</span></code>. More Testing against the Linux <code class="docutils literal notranslate"><span class="pre">rz</span></code>/<code class="docutils literal notranslate"><span class="pre">sz</span></code> commands.</p>
<p>I have verified that with debug off and at lower serial BAUD (<code class="docutils literal notranslate"><span class="pre">2400</span></code>), the
transfers of large files succeed without errors. I do not consider this a
_solution_ to the problem. I also found that the LPC17xx hardware flow control
caused strange hangs; ZModem works better with hardware flow control disabled
on the LPC17xx.</p>
<p>At this lower BAUD, RX buffer sizes could probably be reduced; Or perhaps the
BAUD could be increased. My thought, however, is that tuning in such an
unhealthy situation is not the approach: The best thing to do would be to use
the matching NuttX sz on the Linux host side.</p>
</li>
<li><p><code class="docutils literal notranslate"><span class="pre">2013-7-16</span></code>. More Testing against the NuttX <code class="docutils literal notranslate"><span class="pre">rz</span></code>/<code class="docutils literal notranslate"><span class="pre">sz</span></code> on Both Ends.</p>
<p>The NuttX <code class="docutils literal notranslate"><span class="pre">sz</span></code>/<code class="docutils literal notranslate"><span class="pre">rz</span></code> commands have been modified so that they can be built and
executed under Linux. In this case, there are no transfer problems at all in
either direction and with large or small files. This configuration could
probably run at much higher serial speeds and with much smaller buffers
(although that has not been verified as of this writing).</p>
</li>
<li><p><code class="docutils literal notranslate"><span class="pre">2018-5-27</span></code></p>
<p>Updates to checksum calculations. Verified correct operation with hardware
flow control using the <code class="docutils literal notranslate"><span class="pre">olimex-stm32-p407/zmodem</span></code> configuration. Only the
host-to-target transfer was verified.</p>
<p>This was using the Linux <code class="docutils literal notranslate"><span class="pre">sz</span></code> utility. There appears to still be a problem
using the NuttX <code class="docutils literal notranslate"><span class="pre">sz</span></code> utility running on Linux.</p>
</li>
<li><p><code class="docutils literal notranslate"><span class="pre">2018-5-27</span></code></p>
<p>Verified correct operation with hardware flow control using the
<code class="docutils literal notranslate"><span class="pre">olimex-stm32-p407/zmodem</span></code> configuration with target-to-host transfers was
verified. Again, there are issues remaining if I tried the NuttX <code class="docutils literal notranslate"><span class="pre">rz</span></code> utility
running on Linux.</p>
</li>
<li><p><code class="docutils literal notranslate"><span class="pre">2018-6-26</span></code></p>
<p>With <code class="docutils literal notranslate"><span class="pre">-w</span> <span class="pre">nnnn</span></code> option, the host-to-target transfer can work reliably without
hardware flow control.</p>
</li>
</ul>
</section>
</section>
</div>
</div>
<footer><div class="rst-footer-buttons" role="navigation" aria-label="Footer">
<a href="../zlib/index.html" class="btn btn-neutral float-left" title="zlib zlib data compression library" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a>
<a href="../../testing/index.html" class="btn btn-neutral float-right" title="Testing" 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>