diff options
Diffstat (limited to 'commands/mw.c')
-rw-r--r-- | commands/mw.c | 29 |
1 files changed, 11 insertions, 18 deletions
diff --git a/commands/mw.c b/commands/mw.c index 3ed6c820d0..915f549216 100644 --- a/commands/mw.c +++ b/commands/mw.c @@ -1,19 +1,5 @@ -/* - * Copyright (c) 2011 Sascha Hauer <s.hauer@pengutronix.de>, Pengutronix - * - * See file CREDITS for list of people who contributed to this - * project. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 - * as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - */ +// SPDX-License-Identifier: GPL-2.0-only +// SPDX-FileCopyrightText: © 2011 Sascha Hauer <s.hauer@pengutronix.de>, Pengutronix /* * Memory Functions @@ -53,8 +39,10 @@ static int do_mem_mw(int argc, char *argv[]) adr = strtoull_suffix(argv[optind++], NULL, 0); fd = open_and_lseek(filename, mode | O_WRONLY | O_CREAT, adr); - if (fd < 0) + if (fd < 0) { + printf("Could not open \"%s\": %m\n", filename); return 1; + } while (optind < argc) { u8 val8; @@ -124,12 +112,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 |