Provide a man-page for the loadx command.

Signed-off-by: Heinrich Schuchardt <heinrich.schucha...@canonical.com>
---
 doc/usage/cmd/loadx.rst | 77 +++++++++++++++++++++++++++++++++++++++++
 doc/usage/index.rst     |  1 +
 2 files changed, 78 insertions(+)
 create mode 100644 doc/usage/cmd/loadx.rst

diff --git a/doc/usage/cmd/loadx.rst b/doc/usage/cmd/loadx.rst
new file mode 100644
index 0000000000..facca9b969
--- /dev/null
+++ b/doc/usage/cmd/loadx.rst
@@ -0,0 +1,77 @@
+.. SPDX-License-Identifier: GPL-2.0+:
+
+loadx command
+=============
+
+Synopsis
+--------
+
+::
+
+    loadx [addr [baud]]
+
+Description
+-----------
+
+The loadx command is used to transfer a file to the device via the serial line
+using the XMODEM protocol.
+
+The number of transferred bytes is saved in environment variable filesize.
+
+addr
+    load address, defaults to environment variable loadaddr or if loadaddr is
+    not set to configuration variable CONFIG_SYS_LOAD_ADDR
+
+baud
+    baud rate for the ymodem transmission. After the transmission the baud
+    rate is reset to the original value.
+
+Example
+-------
+
+In the example below the terminal emulation program picocom was used to
+transfer a file to the device.
+
+.. code-block::
+
+    picocom --send-cmd 'sx -b vv' --baud 115200 /dev/ttyUSB0
+
+After entering the loadx command the key sequence <CTRL-A><CTRL-S> is used to
+let picocom prompt for the file name. Picocom invokes the program sx for the
+file transfer.
+
+::
+
+    => loadx 60800000 115200
+    ## Ready for binary (xmodem) download to 0x60800000 at 115200 bps...
+    C
+    *** file: helloworld.efi
+    $ sx -b vv helloworld.efi
+    sx: cannot open vv: No such file or directory
+    Sending helloworld.efi, 24 blocks: Give your local XMODEM receive command 
now.
+    Xmodem sectors/kbytes sent:   0/ 0kRetry 0: NAK on sector
+    Bytes Sent:   3072   BPS:1147
+
+    Transfer incomplete
+
+    *** exit status: 1 ***
+    ## Total Size      = 0x00000c00 = 3072 Bytes
+    ## Start Addr      = 0x60800000
+    =>
+
+The transfer can be cancelled by pressing 3 times <CTRL+C> after two seconds
+of inactivity on terminal.
+
+Configuration
+-------------
+
+The command is only available if CONFIG_CMD_LOADB=y.
+
+Initial timeout in seconds while waiting for transfer is configured by
+config option CMD_LOADXY_TIMEOUT or by env variable $loadxy_timeout.
+Setting it to 0 means infinite timeout.
+
+Return value
+------------
+
+The return value $? is 0 (true) on success, 1 (false) otherwise.
diff --git a/doc/usage/index.rst b/doc/usage/index.rst
index f348848fc7..84ef8a9a42 100644
--- a/doc/usage/index.rst
+++ b/doc/usage/index.rst
@@ -65,6 +65,7 @@ Shell commands
    cmd/load
    cmd/loadb
    cmd/loadm
+   cmd/loadx
    cmd/loady
    cmd/mbr
    cmd/md
-- 
2.39.2

Reply via email to