summary |
shortlog |
log |
commit | commitdiff |
review |
tree
raw |
patch |
inline | side by side (from parent 1:
861730f)
The API version is hardcoded in the STLINK device and depends on
the specific firmware version. There is no way to switch between
different API. Thus, it make no sense to keep in two separate
variables the current and the max API supported because they are
always equal to "the only" API supported by the specific STLINK.
Collapse h->version.jtag_api_max and h->jtag_api in a single
variable h->version.jtag_api
Remove an extra print of api version; this is already advertised
while printing the STLINK version.
Change-Id: I0519694a34748e5a0aa330932c1256080a6d5f20
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/4712
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
int jtag;
/** */
int swim;
int jtag;
/** */
int swim;
- /** highest supported jtag api version */
- enum stlink_jtag_api_version jtag_api_max;
+ /** jtag api version supported */
+ enum stlink_jtag_api_version jtag_api;
/** one bit for each feature supported. See macros STLINK_F_* */
uint32_t flags;
};
/** one bit for each feature supported. See macros STLINK_F_* */
uint32_t flags;
};
uint16_t vid;
/** */
uint16_t pid;
uint16_t vid;
/** */
uint16_t pid;
- /** this is the currently used jtag api */
- enum stlink_jtag_api_version jtag_api;
/** */
struct {
/** whether SWO tracing is enabled or not */
/** */
struct {
/** whether SWO tracing is enabled or not */
}
/* TODO: no error checking yet on api V1 */
}
/* TODO: no error checking yet on api V1 */
- if (h->jtag_api == STLINK_JTAG_API_V1)
+ if (h->version.jtag_api == STLINK_JTAG_API_V1)
h->databuf[0] = STLINK_DEBUG_ERR_OK;
switch (h->databuf[0]) {
h->databuf[0] = STLINK_DEBUG_ERR_OK;
switch (h->databuf[0]) {
case 1:
/* ST-LINK/V1 from J11 switch to api-v2 (and support SWD) */
if (h->version.jtag >= 11)
case 1:
/* ST-LINK/V1 from J11 switch to api-v2 (and support SWD) */
if (h->version.jtag >= 11)
- h->version.jtag_api_max = STLINK_JTAG_API_V2;
+ h->version.jtag_api = STLINK_JTAG_API_V2;
- h->version.jtag_api_max = STLINK_JTAG_API_V1;
+ h->version.jtag_api = STLINK_JTAG_API_V1;
break;
case 2:
/* all ST-LINK/V2 and ST-Link/V2.1 use api-v2 */
break;
case 2:
/* all ST-LINK/V2 and ST-Link/V2.1 use api-v2 */
- h->version.jtag_api_max = STLINK_JTAG_API_V2;
+ h->version.jtag_api = STLINK_JTAG_API_V2;
/* API for trace from J13 */
/* API for target voltage from J13 */
/* API for trace from J13 */
/* API for target voltage from J13 */
LOG_INFO("STLINK v%d JTAG v%d API v%d SWIM v%d VID 0x%04X PID 0x%04X",
h->version.stlink,
h->version.jtag,
LOG_INFO("STLINK v%d JTAG v%d API v%d SWIM v%d VID 0x%04X PID 0x%04X",
h->version.stlink,
h->version.jtag,
- (h->version.jtag_api_max == STLINK_JTAG_API_V1) ? 1 : 2,
+ (h->version.jtag_api == STLINK_JTAG_API_V1) ? 1 : 2,
h->version.swim,
h->vid,
h->pid);
h->version.swim,
h->vid,
h->pid);
* status
* TODO: we need the test on api V1 too
*/
* status
* TODO: we need the test on api V1 too
*/
- if (h->jtag_api == STLINK_JTAG_API_V2)
+ if (h->version.jtag_api == STLINK_JTAG_API_V2)
rx_size = 2;
stlink_usb_init_buffer(handle, h->rx_ep, rx_size);
rx_size = 2;
stlink_usb_init_buffer(handle, h->rx_ep, rx_size);
switch (type) {
case STLINK_MODE_DEBUG_JTAG:
h->cmdbuf[h->cmdidx++] = STLINK_DEBUG_COMMAND;
switch (type) {
case STLINK_MODE_DEBUG_JTAG:
h->cmdbuf[h->cmdidx++] = STLINK_DEBUG_COMMAND;
- if (h->jtag_api == STLINK_JTAG_API_V1)
+ if (h->version.jtag_api == STLINK_JTAG_API_V1)
h->cmdbuf[h->cmdidx++] = STLINK_DEBUG_APIV1_ENTER;
else
h->cmdbuf[h->cmdidx++] = STLINK_DEBUG_APIV2_ENTER;
h->cmdbuf[h->cmdidx++] = STLINK_DEBUG_APIV1_ENTER;
else
h->cmdbuf[h->cmdidx++] = STLINK_DEBUG_APIV2_ENTER;
break;
case STLINK_MODE_DEBUG_SWD:
h->cmdbuf[h->cmdidx++] = STLINK_DEBUG_COMMAND;
break;
case STLINK_MODE_DEBUG_SWD:
h->cmdbuf[h->cmdidx++] = STLINK_DEBUG_COMMAND;
- if (h->jtag_api == STLINK_JTAG_API_V1)
+ if (h->version.jtag_api == STLINK_JTAG_API_V1)
h->cmdbuf[h->cmdidx++] = STLINK_DEBUG_APIV1_ENTER;
else
h->cmdbuf[h->cmdidx++] = STLINK_DEBUG_APIV2_ENTER;
h->cmdbuf[h->cmdidx++] = STLINK_DEBUG_APIV1_ENTER;
else
h->cmdbuf[h->cmdidx++] = STLINK_DEBUG_APIV2_ENTER;
stlink_usb_init_buffer(handle, h->rx_ep, 2);
h->cmdbuf[h->cmdidx++] = STLINK_DEBUG_COMMAND;
stlink_usb_init_buffer(handle, h->rx_ep, 2);
h->cmdbuf[h->cmdidx++] = STLINK_DEBUG_COMMAND;
- if (h->jtag_api == STLINK_JTAG_API_V1)
+ if (h->version.jtag_api == STLINK_JTAG_API_V1)
h->cmdbuf[h->cmdidx++] = STLINK_DEBUG_APIV1_WRITEDEBUGREG;
else
h->cmdbuf[h->cmdidx++] = STLINK_DEBUG_APIV2_WRITEDEBUGREG;
h->cmdbuf[h->cmdidx++] = STLINK_DEBUG_APIV1_WRITEDEBUGREG;
else
h->cmdbuf[h->cmdidx++] = STLINK_DEBUG_APIV2_WRITEDEBUGREG;
h->reconnect_pending = false;
}
h->reconnect_pending = false;
}
- if (h->jtag_api == STLINK_JTAG_API_V2) {
+ if (h->version.jtag_api == STLINK_JTAG_API_V2) {
res = stlink_usb_v2_get_status(handle);
if (res == TARGET_UNKNOWN)
h->reconnect_pending = true;
res = stlink_usb_v2_get_status(handle);
if (res == TARGET_UNKNOWN)
h->reconnect_pending = true;
h->cmdbuf[h->cmdidx++] = STLINK_DEBUG_COMMAND;
h->cmdbuf[h->cmdidx++] = STLINK_DEBUG_COMMAND;
- if (h->jtag_api == STLINK_JTAG_API_V1)
+ if (h->version.jtag_api == STLINK_JTAG_API_V1)
h->cmdbuf[h->cmdidx++] = STLINK_DEBUG_APIV1_RESETSYS;
else
h->cmdbuf[h->cmdidx++] = STLINK_DEBUG_APIV2_RESETSYS;
h->cmdbuf[h->cmdidx++] = STLINK_DEBUG_APIV1_RESETSYS;
else
h->cmdbuf[h->cmdidx++] = STLINK_DEBUG_APIV2_RESETSYS;
- if (h->jtag_api == STLINK_JTAG_API_V2) {
+ if (h->version.jtag_api == STLINK_JTAG_API_V2) {
res = stlink_usb_write_debug_reg(handle, DCB_DHCSR, DBGKEY|C_DEBUGEN);
return res;
res = stlink_usb_write_debug_reg(handle, DCB_DHCSR, DBGKEY|C_DEBUGEN);
return res;
- if (h->jtag_api == STLINK_JTAG_API_V2) {
+ if (h->version.jtag_api == STLINK_JTAG_API_V2) {
res = stlink_usb_write_debug_reg(handle, DCB_DHCSR, DBGKEY|C_HALT|C_DEBUGEN);
return res;
res = stlink_usb_write_debug_reg(handle, DCB_DHCSR, DBGKEY|C_HALT|C_DEBUGEN);
return res;
- if (h->jtag_api == STLINK_JTAG_API_V2) {
+ if (h->version.jtag_api == STLINK_JTAG_API_V2) {
/* TODO: this emulates the v1 api, it should really use a similar auto mask isr
* that the Cortex-M3 currently does. */
stlink_usb_write_debug_reg(handle, DCB_DHCSR, DBGKEY|C_HALT|C_MASKINTS|C_DEBUGEN);
/* TODO: this emulates the v1 api, it should really use a similar auto mask isr
* that the Cortex-M3 currently does. */
stlink_usb_write_debug_reg(handle, DCB_DHCSR, DBGKEY|C_HALT|C_MASKINTS|C_DEBUGEN);
stlink_usb_init_buffer(handle, h->rx_ep, 84);
h->cmdbuf[h->cmdidx++] = STLINK_DEBUG_COMMAND;
stlink_usb_init_buffer(handle, h->rx_ep, 84);
h->cmdbuf[h->cmdidx++] = STLINK_DEBUG_COMMAND;
- if (h->jtag_api == STLINK_JTAG_API_V1)
+ if (h->version.jtag_api == STLINK_JTAG_API_V1)
h->cmdbuf[h->cmdidx++] = STLINK_DEBUG_APIV1_READALLREGS;
else
h->cmdbuf[h->cmdidx++] = STLINK_DEBUG_APIV2_READALLREGS;
h->cmdbuf[h->cmdidx++] = STLINK_DEBUG_APIV1_READALLREGS;
else
h->cmdbuf[h->cmdidx++] = STLINK_DEBUG_APIV2_READALLREGS;
- stlink_usb_init_buffer(handle, h->rx_ep, h->jtag_api == STLINK_JTAG_API_V1 ? 4 : 8);
+ stlink_usb_init_buffer(handle, h->rx_ep, h->version.jtag_api == STLINK_JTAG_API_V1 ? 4 : 8);
h->cmdbuf[h->cmdidx++] = STLINK_DEBUG_COMMAND;
h->cmdbuf[h->cmdidx++] = STLINK_DEBUG_COMMAND;
- if (h->jtag_api == STLINK_JTAG_API_V1)
+ if (h->version.jtag_api == STLINK_JTAG_API_V1)
h->cmdbuf[h->cmdidx++] = STLINK_DEBUG_APIV1_READREG;
else
h->cmdbuf[h->cmdidx++] = STLINK_DEBUG_APIV2_READREG;
h->cmdbuf[h->cmdidx++] = num;
h->cmdbuf[h->cmdidx++] = STLINK_DEBUG_APIV1_READREG;
else
h->cmdbuf[h->cmdidx++] = STLINK_DEBUG_APIV2_READREG;
h->cmdbuf[h->cmdidx++] = num;
- if (h->jtag_api == STLINK_JTAG_API_V1) {
+ if (h->version.jtag_api == STLINK_JTAG_API_V1) {
res = stlink_usb_xfer(handle, h->databuf, 4);
if (res != ERROR_OK)
return res;
res = stlink_usb_xfer(handle, h->databuf, 4);
if (res != ERROR_OK)
return res;
stlink_usb_init_buffer(handle, h->rx_ep, 2);
h->cmdbuf[h->cmdidx++] = STLINK_DEBUG_COMMAND;
stlink_usb_init_buffer(handle, h->rx_ep, 2);
h->cmdbuf[h->cmdidx++] = STLINK_DEBUG_COMMAND;
- if (h->jtag_api == STLINK_JTAG_API_V1)
+ if (h->version.jtag_api == STLINK_JTAG_API_V1)
h->cmdbuf[h->cmdidx++] = STLINK_DEBUG_APIV1_WRITEREG;
else
h->cmdbuf[h->cmdidx++] = STLINK_DEBUG_APIV2_WRITEREG;
h->cmdbuf[h->cmdidx++] = STLINK_DEBUG_APIV1_WRITEREG;
else
h->cmdbuf[h->cmdidx++] = STLINK_DEBUG_APIV2_WRITEREG;
- if (h->jtag_api == STLINK_JTAG_API_V1)
+ if (h->version.jtag_api == STLINK_JTAG_API_V1)
return ERROR_OK;
stlink_usb_init_buffer(handle, h->rx_ep, 2);
return ERROR_OK;
stlink_usb_init_buffer(handle, h->rx_ep, 2);
{
int err, retry_count = 1;
struct stlink_usb_handle_s *h;
{
int err, retry_count = 1;
struct stlink_usb_handle_s *h;
- enum stlink_jtag_api_version api;
LOG_DEBUG("stlink_usb_open");
LOG_DEBUG("stlink_usb_open");
switch (h->transport) {
case HL_TRANSPORT_SWD:
switch (h->transport) {
case HL_TRANSPORT_SWD:
- if (h->version.jtag_api_max == STLINK_JTAG_API_V1)
+ if (h->version.jtag_api == STLINK_JTAG_API_V1)
err = ERROR_FAIL;
/* fall-through */
case HL_TRANSPORT_JTAG:
err = ERROR_FAIL;
/* fall-through */
case HL_TRANSPORT_JTAG:
- api = h->version.jtag_api_max;
-
- LOG_INFO("using stlink api v%d", api);
-
- /* set the used jtag api, this will default to the newest supported version */
- h->jtag_api = api;
-
/* initialize the debug hardware */
err = stlink_usb_init_mode(h, param->connect_under_reset);
/* initialize the debug hardware */
err = stlink_usb_init_mode(h, param->connect_under_reset);
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)