Modified erase command to allow mass and segment erase.
This commit is contained in:
parent
b9e5db63d5
commit
0dade4228e
6
cmddb.c
6
cmddb.c
|
@ -124,8 +124,10 @@ const struct cmddb_record commands[] = {
|
|||
.name = "erase",
|
||||
.func = cmd_erase,
|
||||
.help =
|
||||
"erase\n"
|
||||
" Erase the device under test.\n"
|
||||
"erase [all|segment] [address]\n"
|
||||
" Erase the device under test. With no arguments, erases all of main\n"
|
||||
" memory. Specify arguments to perform a mass erase, or to erase\n"
|
||||
" individual segments.\n"
|
||||
},
|
||||
{
|
||||
.name = "step",
|
||||
|
|
29
devcmd.c
29
devcmd.c
|
@ -138,11 +138,38 @@ int cmd_reset(char **arg)
|
|||
|
||||
int cmd_erase(char **arg)
|
||||
{
|
||||
const char *type_text = get_arg(arg);
|
||||
const char *seg_text = get_arg(arg);
|
||||
device_erase_type_t type = DEVICE_ERASE_MAIN;
|
||||
address_t segment = 0;
|
||||
|
||||
if (seg_text && expr_eval(stab_default, seg_text, &segment) < 0) {
|
||||
printc_err("erase: invalid expression: %s\n", seg_text);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (type_text) {
|
||||
if (!strcasecmp(type_text, "all")) {
|
||||
type = DEVICE_ERASE_ALL;
|
||||
} else if (!strcasecmp(type_text, "segment")) {
|
||||
type = DEVICE_ERASE_SEGMENT;
|
||||
if (!seg_text) {
|
||||
printc_err("erase: expected segment "
|
||||
"address\n");
|
||||
return -1;
|
||||
}
|
||||
} else {
|
||||
printc_err("erase: unknown erase type: %s\n",
|
||||
type_text);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
if (device_default->ctl(device_default, DEVICE_CTL_HALT) < 0)
|
||||
return -1;
|
||||
|
||||
printc("Erasing...\n");
|
||||
return device_default->erase(device_default, DEVICE_ERASE_MAIN, 0);
|
||||
return device_default->erase(device_default, type, segment);
|
||||
}
|
||||
|
||||
int cmd_step(char **arg)
|
||||
|
|
11
mspdebug.man
11
mspdebug.man
|
@ -168,9 +168,14 @@ length (64 bytes) is disassembled and shown.
|
|||
|
||||
If symbols are available, then all addresses used as operands are
|
||||
translated into \fIsymbol\fR+\fIoffset\fR form.
|
||||
.IP "\fBerase\fR"
|
||||
Erase the device under test. All code memory is erased (but not
|
||||
information or boot memory).
|
||||
.IP "\fBerase\fR [\fIall\fR|\fIsegment\fR] [\fIaddress\fR]"
|
||||
Erase the device under test. With no arguments, all code memory is erased
|
||||
(but not information or boot memory). With the argument "all", a mass
|
||||
erase is performed (the results may depend on the state of the LOCKA
|
||||
bit in the flash memory controller).
|
||||
|
||||
Specify "segment" and a memory address to erase an individual flash
|
||||
segment.
|
||||
.IP "\fBgdb\fR [\fIport\fR]"
|
||||
Start a GDB remote stub, optionally specifying a TCP port to listen on.
|
||||
If no port is given, the default port is 2000.
|
||||
|
|
Loading…
Reference in New Issue