Implemented erase command.

This commit is contained in:
Daniel Beer 2010-03-23 15:14:04 +13:00
parent b3afd48c19
commit ef03cae7b2
2 changed files with 15 additions and 0 deletions

12
main.c
View File

@ -585,6 +585,15 @@ static int prog_feed(u_int16_t addr, const u_int8_t *data, int len)
return 0; return 0;
} }
static int cmd_erase(char **arg)
{
if (msp430_dev->control(DEVICE_CTL_HALT) < 0)
return -1;
printf("Erasing...\n");
return msp430_dev->control(DEVICE_CTL_ERASE);
}
static int cmd_prog(char **arg) static int cmd_prog(char **arg)
{ {
FILE *in = fopen(*arg, "r"); FILE *in = fopen(*arg, "r");
@ -700,6 +709,9 @@ static const struct command all_commands[] = {
{"dis", cmd_dis, {"dis", cmd_dis,
"dis <address> [length]\n" "dis <address> [length]\n"
" Disassemble a section of memory.\n"}, " Disassemble a section of memory.\n"},
{"erase", cmd_erase,
"erase\n"
" Erase the device under test.\n"},
{"gdb", cmd_gdb, {"gdb", cmd_gdb,
"gdb [port]\n" "gdb [port]\n"
" Run a GDB remote stub on the given TCP/IP port.\n"}, " Run a GDB remote stub on the given TCP/IP port.\n"},

View File

@ -95,6 +95,9 @@ length (64 bytes) is disassembled and shown.
If symbols are available, then all addresses used as operands are If symbols are available, then all addresses used as operands are
translated into \fIsymbol\fR+\fIoffset\fR form. translated into \fIsymbol\fR+\fIoffset\fR form.
.IP "erase"
Erase the device under test. All code memory is erased (but not
information or boot memory).
.IP "gdb [\fIport\fR]" .IP "gdb [\fIport\fR]"
Start a GDB remote stub, optionally specifying a TCP port to listen on. Start a GDB remote stub, optionally specifying a TCP port to listen on.
If no port is given, the default port is 2000. If no port is given, the default port is 2000.