From abc7b61737cac8e0a45292c328948823670084b3 Mon Sep 17 00:00:00 2001 From: Daniel Beer Date: Mon, 13 Sep 2010 11:27:11 +1200 Subject: [PATCH] Added "load" command for programming without erase/symbol import. --- cmddb.c | 8 ++++++++ devcmd.c | 16 +++++++++++++--- devcmd.h | 1 + mspdebug.man | 16 +++++++++++----- 4 files changed, 33 insertions(+), 8 deletions(-) diff --git a/cmddb.c b/cmddb.c index 9e4aabf..37b378c 100644 --- a/cmddb.c +++ b/cmddb.c @@ -88,6 +88,14 @@ const struct cmddb_record commands[] = { "prog \n" " Erase the device and flash the data contained in a binary file.\n" " This command also loads symbols from the file, if available.\n" + }, + { + .name = "load", + .func = cmd_load, + .help = +"load \n" +" Flash the data contained in a binary file. Does not load symbols\n" +" or erase the device.\n" }, { .name = "md", diff --git a/devcmd.c b/devcmd.c index 456b950..24788c3 100644 --- a/devcmd.c +++ b/devcmd.c @@ -457,7 +457,7 @@ static int cmd_prog_feed(void *user_data, address_t addr, return prog_feed((struct prog_data *)user_data, addr, data, len); } -int cmd_prog(char **arg) +static int do_cmd_prog(char **arg, int prog_flags) { FILE *in; struct prog_data prog; @@ -476,14 +476,14 @@ int cmd_prog(char **arg) return -1; } - prog_init(&prog, PROG_WANT_ERASE); + prog_init(&prog, prog_flags); if (binfile_extract(in, cmd_prog_feed, &prog) < 0) { fclose(in); return -1; } - if (binfile_info(in) & BINFILE_HAS_SYMS) { + if (prog_flags && (binfile_info(in) & BINFILE_HAS_SYMS)) { stab_clear(stab_default); binfile_syms(in, stab_default); } @@ -502,6 +502,16 @@ int cmd_prog(char **arg) return 0; } +int cmd_prog(char **arg) +{ + return do_cmd_prog(arg, PROG_WANT_ERASE); +} + +int cmd_load(char **arg) +{ + return do_cmd_prog(arg, 0); +} + int cmd_setbreak(char **arg) { char *addr_text = get_arg(arg); diff --git a/devcmd.h b/devcmd.h index 365c972..7b5bbbc 100644 --- a/devcmd.h +++ b/devcmd.h @@ -30,6 +30,7 @@ int cmd_set(char **arg); int cmd_dis(char **arg); int cmd_hexout(char **arg); int cmd_prog(char **arg); +int cmd_load(char **arg); int cmd_setbreak(char **arg); int cmd_delbreak(char **arg); int cmd_break(char **arg); diff --git a/mspdebug.man b/mspdebug.man index 49b400e..cf2b4f0 100644 --- a/mspdebug.man +++ b/mspdebug.man @@ -246,6 +246,12 @@ Register-indirect mode with auto-increment. .IP "\fB#\fR" Immediate mode. .RE +.IP "\fBload\fR \fIfilename\fR" +Program the device under test using the binary file supplied. This +command is like \fBprog\fR, but it does not load symbols or erase +the device before programming. + +The CPU is reset and halted before and after programming. .IP "\fBmd\fR \fIaddress\fR [\fIlength\fR]" Read the specified section of device memory and display it as a canonical\-style hexdump. Both arguments may be address expressions. If @@ -275,12 +281,12 @@ With just an option name as its argument, it displays the current value of that option. .IP "\fBprog\fR \fIfilename\fR" Erase and reprogram the device under test using the binary file -supplied. The file format will be auto-detected and may be either -Intel HEX or ELF32. +supplied. The file format will be auto-detected and may be any of +the supported file formats. -In the case of an ELF32 file, symbols will be automatically loaded -from the file into the symbol table (discarding any existing symbols), -if they are present. +In the case of a file containing symbols, symbols will be automatically +loaded from the file into the symbol table (discarding any existing +symbols), if they are present. The CPU is reset and halted before and after programming. .IP "\fBread\fR \fIfilename\fR"