We need to make sure that srst is asserted before we attempt to switch into
jtag or swd mode otherwise we receive a error (-9) - invalid device id.
Change-Id: I625166c751cfba8e8a5290f40122bb9afc9dbb39
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/1315
Tested-by: jenkins
+static int stlink_usb_assert_srst(void *handle, int srst);
+
-static int stlink_usb_init_mode(void *handle)
+static int stlink_usb_init_mode(void *handle, bool connect_under_reset)
+ if (connect_under_reset) {
+ res = stlink_usb_assert_srst(handle, 0);
+ if (res != ERROR_OK)
+ return res;
+ }
+
res = stlink_usb_mode_enter(handle, emode);
if (res != ERROR_OK)
res = stlink_usb_mode_enter(handle, emode);
if (res != ERROR_OK)
h->jtag_api = api;
/* initialize the debug hardware */
h->jtag_api = api;
/* initialize the debug hardware */
- err = stlink_usb_init_mode(h);
+ err = stlink_usb_init_mode(h, param->connect_under_reset);
if (err != ERROR_OK) {
LOG_ERROR("init mode failed");
if (err != ERROR_OK) {
LOG_ERROR("init mode failed");
#include <target/target.h>
#include <target/target.h>
-static struct hl_interface_s hl_if = { {0, 0, 0, 0, 0, 0, 0}, 0, 0 };
+static struct hl_interface_s hl_if = { {0, 0, 0, 0, 0, HL_TRANSPORT_UNKNOWN, 0, false}, 0, 0 };
int hl_interface_open(enum hl_transports tr)
{
LOG_DEBUG("hl_interface_open");
int hl_interface_open(enum hl_transports tr)
{
LOG_DEBUG("hl_interface_open");
+ enum reset_types jtag_reset_config = jtag_get_reset_config();
+
+ if (jtag_reset_config & RESET_CNCT_UNDER_SRST) {
+ if (jtag_reset_config & RESET_SRST_NO_GATING)
+ hl_if.param.connect_under_reset = true;
+ else
+ LOG_WARNING("\'srst_nogate\' reset_config option is required");
+ }
+
/* set transport mode */
hl_if.param.transport = tr;
/* set transport mode */
hl_if.param.transport = tr;
int hl_interface_init_reset(void)
{
int hl_interface_init_reset(void)
{
- enum reset_types jtag_reset_config = jtag_get_reset_config();
-
- if (jtag_reset_config & RESET_CNCT_UNDER_SRST) {
- if (jtag_reset_config & RESET_SRST_NO_GATING) {
- jtag_add_reset(0, 1);
- hl_if.layout->api->assert_srst(hl_if.fd, 0);
- } else
- LOG_WARNING("\'srst_nogate\' reset_config option is required");
+ /* incase the adapter has not already handled asserting srst
+ * we will attempt it again */
+ if (hl_if.param.connect_under_reset) {
+ jtag_add_reset(0, 1);
+ hl_if.layout->api->assert_srst(hl_if.fd, 0);
enum hl_transports transport;
/** */
int max_buffer;
enum hl_transports transport;
/** */
int max_buffer;
+ /** */
+ bool connect_under_reset;
};
struct hl_interface_s {
};
struct hl_interface_s {
Linking to existing account procedure
If you already have an account and want to add another login method
you
MUST first sign in with your existing account and
then change URL to read
https://review.openocd.org/login/?link
to get to this page again but this time it'll work for linking. Thank you.
SSH host keys fingerprints
1024 SHA256:YKx8b7u5ZWdcbp7/4AeXNaqElP49m6QrwfXaqQGJAOk gerrit-code-review@openocd.zylin.com (DSA)
384 SHA256:jHIbSQa4REvwCFG4cq5LBlBLxmxSqelQPem/EXIrxjk gerrit-code-review@openocd.org (ECDSA)
521 SHA256:UAOPYkU9Fjtcao0Ul/Rrlnj/OsQvt+pgdYSZ4jOYdgs gerrit-code-review@openocd.org (ECDSA)
256 SHA256:A13M5QlnozFOvTllybRZH6vm7iSt0XLxbA48yfc2yfY gerrit-code-review@openocd.org (ECDSA)
256 SHA256:spYMBqEYoAOtK7yZBrcwE8ZpYt6b68Cfh9yEVetvbXg gerrit-code-review@openocd.org (ED25519)
+--[ED25519 256]--+
|=.. |
|+o.. . |
|*.o . . |
|+B . . . |
|Bo. = o S |
|Oo.+ + = |
|oB=.* = . o |
| =+=.+ + E |
|. .=o . o |
+----[SHA256]-----+
2048 SHA256:0Onrb7/PHjpo6iVZ7xQX2riKN83FJ3KGU0TvI0TaFG4 gerrit-code-review@openocd.zylin.com (RSA)