From: Tomas Vanek Date: Fri, 7 Dec 2018 16:51:49 +0000 (+0100) Subject: target/cortex_m: fix cortex_m reset_config help and check for syntax error X-Git-Tag: v0.11.0-rc1~903 X-Git-Url: https://review.openocd.org/gitweb?p=openocd.git;a=commitdiff_plain;h=936dc7cbd93492c1df567c0727bee251427ac270 target/cortex_m: fix cortex_m reset_config help and check for syntax error Remove option 'srst' which is not recognized from on-line help and texi. Check parameter and return syntax error if wrong option is entered. Change-Id: I87daa423a9f53193a0b015080594820b933628f5 Signed-off-by: Tomas Vanek Reviewed-on: http://openocd.zylin.com/4795 Tested-by: jenkins Reviewed-by: Spencer Oliver --- diff --git a/doc/openocd.texi b/doc/openocd.texi index bc24aedb62..aa901e6e49 100644 --- a/doc/openocd.texi +++ b/doc/openocd.texi @@ -3458,6 +3458,7 @@ How long (in milliseconds) OpenOCD should wait after deasserting nTRST (active-low JTAG TAP reset) before starting new JTAG operations. @end deffn +@anchor {reset_config} @deffn {Command} reset_config mode_flag ... This command displays or modifies the reset configuration of your combination of JTAG board and target in target @@ -8994,13 +8995,13 @@ must also be explicitly enabled. This finishes by listing the current vector catch configuration. @end deffn -@deffn Command {cortex_m reset_config} (@option{srst}|@option{sysresetreq}|@option{vectreset}) -Control reset handling. The default @option{srst} is to use srst if fitted, -otherwise fallback to @option{vectreset}. +@deffn Command {cortex_m reset_config} (@option{sysresetreq}|@option{vectreset}) +Control reset handling if hardware srst is not fitted +@xref{reset_config,,reset_config}. + @itemize @minus -@item @option{srst} use hardware srst if fitted otherwise fallback to @option{vectreset}. -@item @option{sysresetreq} use NVIC SYSRESETREQ to reset system. -@item @option{vectreset} use NVIC VECTRESET to reset system. +@item @option{sysresetreq} use AIRCR SYSRESETREQ to reset system. +@item @option{vectreset} use AIRCR VECTRESET to reset system (default). @end itemize Using @option{vectreset} is a safe option for Cortex-M3, M4 and M7 cores. diff --git a/src/target/cortex_m.c b/src/target/cortex_m.c index bb8c06d0f6..4ce776cd0d 100644 --- a/src/target/cortex_m.c +++ b/src/target/cortex_m.c @@ -2436,7 +2436,9 @@ COMMAND_HANDLER(handle_cortex_m_reset_config_command) LOG_WARNING("VECTRESET is not supported on your Cortex-M core!"); else cortex_m->soft_reset_config = CORTEX_M_RESET_VECTRESET; - } + + } else + return ERROR_COMMAND_SYNTAX_ERROR; } switch (cortex_m->soft_reset_config) { @@ -2478,7 +2480,7 @@ static const struct command_registration cortex_m_exec_command_handlers[] = { .handler = handle_cortex_m_reset_config_command, .mode = COMMAND_ANY, .help = "configure software reset handling", - .usage = "['srst'|'sysresetreq'|'vectreset']", + .usage = "['sysresetreq'|'vectreset']", }, COMMAND_REGISTRATION_DONE };