From ef03cae7b2b1517e04ac2776866d09d1882e6786 Mon Sep 17 00:00:00 2001 From: Daniel Beer Date: Tue, 23 Mar 2010 15:14:04 +1300 Subject: [PATCH] Implemented erase command. --- main.c | 12 ++++++++++++ mspdebug.man | 3 +++ 2 files changed, 15 insertions(+) diff --git a/main.c b/main.c index 9ec6f0b..dc07f45 100644 --- a/main.c +++ b/main.c @@ -585,6 +585,15 @@ static int prog_feed(u_int16_t addr, const u_int8_t *data, int len) 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) { FILE *in = fopen(*arg, "r"); @@ -700,6 +709,9 @@ static const struct command all_commands[] = { {"dis", cmd_dis, "dis
[length]\n" " Disassemble a section of memory.\n"}, + {"erase", cmd_erase, +"erase\n" +" Erase the device under test.\n"}, {"gdb", cmd_gdb, "gdb [port]\n" " Run a GDB remote stub on the given TCP/IP port.\n"}, diff --git a/mspdebug.man b/mspdebug.man index 562168f..3583add 100644 --- a/mspdebug.man +++ b/mspdebug.man @@ -95,6 +95,9 @@ 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 "erase" +Erase the device under test. All code memory is erased (but not +information or boot memory). .IP "gdb [\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.