mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] memory commands: Improve command documentation
@ 2021-11-02 13:22 Jules Maselbas
  2021-11-04 19:46 ` Sascha Hauer
  0 siblings, 1 reply; 2+ messages in thread
From: Jules Maselbas @ 2021-11-02 13:22 UTC (permalink / raw)
  To: barebox; +Cc: Jules Maselbas

The quad write flags was missing from memory command usage.
Make the -s/-d options expecting an argument more clean from the usage line.
Reword some command help to make them more easier to use. For instance the
memcpy command help was a bit misleading on the uses for SRC/DEST with a
source/dest file. Some users were being confused by SRC/DEST being offsets.

Signed-off-by: Jules Maselbas <jmaselbas@kalray.eu>
---
 commands/md.c     | 4 ++--
 commands/memcmp.c | 2 +-
 commands/memcpy.c | 6 ++++--
 commands/memset.c | 2 +-
 commands/mm.c     | 2 +-
 commands/mw.c     | 7 ++++++-
 6 files changed, 15 insertions(+), 8 deletions(-)

diff --git a/commands/md.c b/commands/md.c
index d80c7cca0c..7a96634e27 100644
--- a/commands/md.c
+++ b/commands/md.c
@@ -88,7 +88,7 @@ out:
 
 
 BAREBOX_CMD_HELP_START(md)
-BAREBOX_CMD_HELP_TEXT("Display (hex dump) a memory region.")
+BAREBOX_CMD_HELP_TEXT("Display (hex dump) a memory REGION.")
 BAREBOX_CMD_HELP_TEXT("")
 BAREBOX_CMD_HELP_TEXT("Options:")
 BAREBOX_CMD_HELP_OPT ("-b",  "byte access")
@@ -108,7 +108,7 @@ BAREBOX_CMD_HELP_END
 BAREBOX_CMD_START(md)
 	.cmd		= do_mem_md,
 	BAREBOX_CMD_DESC("memory display")
-	BAREBOX_CMD_OPTS("[-bwlsx] REGION")
+	BAREBOX_CMD_OPTS("[-bwlqx] [-s FILE] REGION")
 	BAREBOX_CMD_GROUP(CMD_GRP_MEM)
 	BAREBOX_CMD_HELP(cmd_md_help)
 BAREBOX_CMD_END
diff --git a/commands/memcmp.c b/commands/memcmp.c
index 2b3783d66a..8122b99f17 100644
--- a/commands/memcmp.c
+++ b/commands/memcmp.c
@@ -97,7 +97,7 @@ BAREBOX_CMD_HELP_END
 BAREBOX_CMD_START(memcmp)
 	.cmd		= do_memcmp,
 	BAREBOX_CMD_DESC("memory compare")
-	BAREBOX_CMD_OPTS("[-bwlsd] ADDR1 ADDR2 COUNT")
+	BAREBOX_CMD_OPTS("[-bwlq] [-s FILE] [-d FILE] ADDR1 ADDR2 COUNT")
 	BAREBOX_CMD_GROUP(CMD_GRP_MEM)
 	BAREBOX_CMD_HELP(cmd_memcmp_help)
 BAREBOX_CMD_END
diff --git a/commands/memcpy.c b/commands/memcpy.c
index 2477bba359..1b480f27f0 100644
--- a/commands/memcpy.c
+++ b/commands/memcpy.c
@@ -72,7 +72,9 @@ out:
 }
 
 BAREBOX_CMD_HELP_START(memcpy)
-BAREBOX_CMD_HELP_TEXT("Copy memory at SRC of COUNT bytes to DEST")
+BAREBOX_CMD_HELP_TEXT("Copy memory of COUNT bytes from offsets SRC to DEST.")
+BAREBOX_CMD_HELP_TEXT("If source is a file, COUNT can be left unspecified")
+BAREBOX_CMD_HELP_TEXT("in which case the whole file is copied.")
 BAREBOX_CMD_HELP_TEXT("")
 BAREBOX_CMD_HELP_TEXT("Options:")
 BAREBOX_CMD_HELP_OPT ("-b", "byte access")
@@ -86,7 +88,7 @@ BAREBOX_CMD_HELP_END
 BAREBOX_CMD_START(memcpy)
 	.cmd		= do_memcpy,
 	BAREBOX_CMD_DESC("memory copy")
-	BAREBOX_CMD_OPTS("[-bwlsd] SRC DEST COUNT")
+	BAREBOX_CMD_OPTS("[-bwlq] [-s FILE] [-d FILE] SRC DEST COUNT")
 	BAREBOX_CMD_GROUP(CMD_GRP_MEM)
 	BAREBOX_CMD_HELP(cmd_memcpy_help)
 BAREBOX_CMD_END
diff --git a/commands/memset.c b/commands/memset.c
index 716cba26de..e4412533f1 100644
--- a/commands/memset.c
+++ b/commands/memset.c
@@ -84,7 +84,7 @@ BAREBOX_CMD_HELP_END
 BAREBOX_CMD_START(memset)
 	.cmd		= do_memset,
 	BAREBOX_CMD_DESC("memory fill")
-	BAREBOX_CMD_OPTS("[-bwld] ADDR DATA COUNT")
+	BAREBOX_CMD_OPTS("[-bwlq [-d FILE] ADDR DATA COUNT")
 	BAREBOX_CMD_GROUP(CMD_GRP_MEM)
 	BAREBOX_CMD_HELP(cmd_memset_help)
 BAREBOX_CMD_END
diff --git a/commands/mm.c b/commands/mm.c
index f6d66320fb..9ce8839644 100644
--- a/commands/mm.c
+++ b/commands/mm.c
@@ -116,7 +116,7 @@ BAREBOX_CMD_HELP_END
 BAREBOX_CMD_START(mm)
 	.cmd		= do_mem_mm,
 	BAREBOX_CMD_DESC("memory modify with mask")
-	BAREBOX_CMD_OPTS("[-bwld] ADDR VAL MASK")
+	BAREBOX_CMD_OPTS("[-bwlq] [-d FILE] ADDR VAL MASK")
 	BAREBOX_CMD_GROUP(CMD_GRP_MEM)
 	BAREBOX_CMD_HELP(cmd_mm_help)
 BAREBOX_CMD_END
diff --git a/commands/mw.c b/commands/mw.c
index 5bd4bdd58f..5dcef7e2fc 100644
--- a/commands/mw.c
+++ b/commands/mw.c
@@ -110,12 +110,17 @@ BAREBOX_CMD_HELP_OPT ("-l",  "long access (32 bit)")
 BAREBOX_CMD_HELP_OPT ("-q",  "quad access (64 bit)")
 BAREBOX_CMD_HELP_OPT ("-d FILE",  "write file (default /dev/mem)")
 BAREBOX_CMD_HELP_OPT ("-x",       "swap bytes")
+BAREBOX_CMD_HELP_TEXT("")
+BAREBOX_CMD_HELP_TEXT("Memory regions can be specified in two different forms: START+SIZE")
+BAREBOX_CMD_HELP_TEXT("or START-END, If START is omitted it defaults to 0x100")
+BAREBOX_CMD_HELP_TEXT("Sizes can be specified as decimal, or if prefixed with 0x as hexadecimal.")
+BAREBOX_CMD_HELP_TEXT("An optional suffix of k, M or G is for kbytes, Megabytes or Gigabytes.")
 BAREBOX_CMD_HELP_END
 
 BAREBOX_CMD_START(mw)
 	.cmd		= do_mem_mw,
 	BAREBOX_CMD_DESC("memory write")
-	BAREBOX_CMD_OPTS("[-bwldx] REGION DATA...")
+	BAREBOX_CMD_OPTS("[-bwlqx] [-d FILE] REGION DATA...")
 	BAREBOX_CMD_GROUP(CMD_GRP_MEM)
 	BAREBOX_CMD_HELP(cmd_mw_help)
 BAREBOX_CMD_END
-- 
2.17.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] memory commands: Improve command documentation
  2021-11-02 13:22 [PATCH] memory commands: Improve command documentation Jules Maselbas
@ 2021-11-04 19:46 ` Sascha Hauer
  0 siblings, 0 replies; 2+ messages in thread
From: Sascha Hauer @ 2021-11-04 19:46 UTC (permalink / raw)
  To: Jules Maselbas; +Cc: barebox

On Tue, Nov 02, 2021 at 02:22:47PM +0100, Jules Maselbas wrote:
> The quad write flags was missing from memory command usage.
> Make the -s/-d options expecting an argument more clean from the usage line.
> Reword some command help to make them more easier to use. For instance the
> memcpy command help was a bit misleading on the uses for SRC/DEST with a
> source/dest file. Some users were being confused by SRC/DEST being offsets.
> 
> Signed-off-by: Jules Maselbas <jmaselbas@kalray.eu>
> ---
>  commands/md.c     | 4 ++--
>  commands/memcmp.c | 2 +-
>  commands/memcpy.c | 6 ++++--
>  commands/memset.c | 2 +-
>  commands/mm.c     | 2 +-
>  commands/mw.c     | 7 ++++++-
>  6 files changed, 15 insertions(+), 8 deletions(-)

Applied, thanks

Sascha

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-11-04 19:48 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-02 13:22 [PATCH] memory commands: Improve command documentation Jules Maselbas
2021-11-04 19:46 ` Sascha Hauer

mail archive of the barebox mailing list

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://lore.barebox.org/barebox/0 barebox/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 barebox barebox/ https://lore.barebox.org/barebox \
		barebox@lists.infradead.org
	public-inbox-index barebox

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git