Add --force-reset option
Without this option MSP430F5526 fails to reset its registers properly. When the SP register points to a random address and we try to set a breakpoint with gdb, it will try to read all memory locations from SP up to the top of the RAM searching for the return address in the current stack frame. On MSP430F47173 initialization fails when not using reset (command C_IDENT1 failed) and we also need to fall back to using try_open with send_reset = 1. Signed-off-by: Ionut Nicu <ionut.nicu@mindbit.ro>
This commit is contained in:
parent
5c0a57254c
commit
d5ecb69633
1
device.h
1
device.h
|
@ -59,6 +59,7 @@ struct device_breakpoint {
|
|||
#define DEVICE_FLAG_JTAG 0x01 /* default is SBW */
|
||||
#define DEVICE_FLAG_LONG_PW 0x02
|
||||
#define DEVICE_FLAG_TTY 0x04 /* default is USB */
|
||||
#define DEVICE_FLAG_FORCE_RESET 0x08
|
||||
|
||||
struct device_args {
|
||||
int flags;
|
||||
|
|
2
fet.c
2
fet.c
|
@ -978,7 +978,7 @@ int try_open(struct fet_device *dev, const struct device_args *args,
|
|||
if (do_configure(dev, args) < 0)
|
||||
return -1;
|
||||
|
||||
if (send_reset) {
|
||||
if (send_reset || args->flags & DEVICE_FLAG_FORCE_RESET) {
|
||||
printc_dbg("Sending reset...\n");
|
||||
if (xfer(dev, C_RESET, NULL, 0, 3, FET_RESET_ALL, 0, 0) < 0)
|
||||
printc_err("warning: fet: reset failed\n");
|
||||
|
|
7
main.c
7
main.c
|
@ -102,6 +102,8 @@ static void usage(const char *progname)
|
|||
" Override the device ID returned by the FET.\n"
|
||||
" --usb-list\n"
|
||||
" Show a list of available USB devices.\n"
|
||||
" --force-reset\n"
|
||||
" Force target reset in initialization sequence.\n"
|
||||
" --version\n"
|
||||
" Show copyright and version information.\n"
|
||||
"\n"
|
||||
|
@ -169,6 +171,7 @@ static int parse_cmdline_args(int argc, char **argv,
|
|||
{"usb-list", 0, 0, 'I'},
|
||||
{"version", 0, 0, 'V'},
|
||||
{"long-password", 0, 0, 'P'},
|
||||
{"force-reset", 0, 0, 'R'},
|
||||
{NULL, 0, 0, 0}
|
||||
};
|
||||
int want_usb = 0;
|
||||
|
@ -234,6 +237,10 @@ static int parse_cmdline_args(int argc, char **argv,
|
|||
args->devarg.flags |= DEVICE_FLAG_LONG_PW;
|
||||
break;
|
||||
|
||||
case 'R':
|
||||
args->devarg.flags |= DEVICE_FLAG_FORCE_RESET;
|
||||
break;
|
||||
|
||||
case '?':
|
||||
printc_err("Try --help for usage information.\n");
|
||||
return -1;
|
||||
|
|
Loading…
Reference in New Issue