Re: [PATCH 1/1] cmd: loads man-page

2023-06-26 Thread Simon Glass
On Sun, 25 Jun 2023 at 22:27, Heinrich Schuchardt
 wrote:
>
> Provide a man-page for the loads command.
>
> Signed-off-by: Heinrich Schuchardt 
> ---
>  doc/usage/cmd/loads.rst | 96 +
>  doc/usage/index.rst |  1 +
>  2 files changed, 97 insertions(+)
>  create mode 100644 doc/usage/cmd/loads.rst

Reviewed-by: Simon Glass 


[PATCH 1/1] cmd: loads man-page

2023-06-25 Thread Heinrich Schuchardt
Provide a man-page for the loads command.

Signed-off-by: Heinrich Schuchardt 
---
 doc/usage/cmd/loads.rst | 96 +
 doc/usage/index.rst |  1 +
 2 files changed, 97 insertions(+)
 create mode 100644 doc/usage/cmd/loads.rst

diff --git a/doc/usage/cmd/loads.rst b/doc/usage/cmd/loads.rst
new file mode 100644
index 00..5dd0ed70b6
--- /dev/null
+++ b/doc/usage/cmd/loads.rst
@@ -0,0 +1,96 @@
+.. SPDX-License-Identifier: GPL-2.0+:
+
+loads command
+=
+
+Synopsis
+
+
+::
+
+loads [offset [baud]]
+
+Description
+---
+
+The loads command is used to transfer a file to the device via the serial line
+using the Motorola S-record file format.
+
+offset
+offset added to the addresses in the S-record file
+
+baud
+baud rate to use for download. This parameter is only available if
+CONFIG_SYS_LOADS_BAUD_CHANGE=y
+
+Example
+---
+
+As example file to be transferred we use a script printing 'hello s-record'.
+Here are the commands to create the S-record file:
+
+.. code-block:: bash
+
+$ echo 'echo hello s-record' > script.txt
+$ mkimage -T script -d script.txt script.scr
+Image Name:
+Created:  Sun Jun 25 10:35:02 2023
+Image Type:   PowerPC Linux Script (gzip compressed)
+Data Size:28 Bytes = 0.03 KiB = 0.00 MiB
+Load Address: 
+Entry Point:  
+Contents:
+   Image 0: 20 Bytes = 0.02 KiB = 0.00 MiB
+$ srec_cat script.scr -binary -CRLF -Output script.srec
+$ echo -e "S903FC\r" >> script.srec
+$ cat script.srec
+S022687474703A2F2F737265636F72642E736F75726365666F7267652E6E65742F1D
+S123270519566D773EB6649815E300173DE3D97005070601E2
+S1230020BC
+S11A004F68656C6C6F20732D7265636F72640A39
+S5030003F9
+S903FC
+$
+
+The load address in the first S1 record is 0x.
+
+The terminal emulation program picocom is invoked with *cat* as the send
+command to transfer the file.
+
+.. code-block::
+
+picocom --send-cmd 'cat' --baud 115200 /dev/ttyUSB0
+
+After entering the *loads* command the key sequence  is used to
+let picocom prompt for the file name. Picocom invokes the program *cat* for the
+file transfer. The loaded script is executed using the *source* command.
+
+.. code-block::
+
+=> loads $scriptaddr
+## Ready for S-Record download ...
+
+*** file: script.srec
+$ cat script.srec
+
+*** exit status: 0 ***
+
+## First Load Addr = 0x4FC0
+## Last  Load Addr = 0x4FC0005B
+## Total Size  = 0x005C = 92 Bytes
+## Start Addr  = 0x
+=> source $scriptaddr
+## Executing script at 4fc0
+hello s-record
+=> 
+
+Configuration
+-
+
+The command is only available if CONFIG_CMD_LOADS=y. The parameter to set the
+baud rate is only available if CONFIG_SYS_LOADS_BAUD_CHANGE=y
+
+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 29ae8a176e..ef3e87fed0 100644
--- a/doc/usage/index.rst
+++ b/doc/usage/index.rst
@@ -68,6 +68,7 @@ Shell commands
cmd/load
cmd/loadb
cmd/loadm
+   cmd/loads
cmd/loadx
cmd/loady
cmd/mbr
-- 
2.40.1