diff --git a/src/platforms/pc-stlinkv2/README.md b/src/platforms/pc-stlinkv2/README.md index 2d145ad..ad2f78d 100644 --- a/src/platforms/pc-stlinkv2/README.md +++ b/src/platforms/pc-stlinkv2/README.md @@ -5,11 +5,13 @@ functionality that BMP needs. This branch implements blackmagic debug probe for the STM Stlink as a proof of concept. Use at your own risk, but report or better fix problems. -Run the resulting blackmagic_stlinkv2 executabel to start the gdb server +Run the resulting blackmagic_stlinkv2 executable to start the gdb server -CrosscCompling for windows with mingw succeeds. +Crosscompling for windows with mingw succeeds. -Drawback: JTAG does not work for chains with multiple devices. +Drawback: +- JTAG does not work for chains with multiple devices. +- STLinkV3 does only work on STM32 devices. This branch may get forced push. In case of problems: - git reset --hard master diff --git a/src/platforms/pc-stlinkv2/stlinkv2.c b/src/platforms/pc-stlinkv2/stlinkv2.c index a3ef581..0e1723b 100644 --- a/src/platforms/pc-stlinkv2/stlinkv2.c +++ b/src/platforms/pc-stlinkv2/stlinkv2.c @@ -535,7 +535,7 @@ static int send_recv_retry(uint8_t *txbuf, size_t txsize, gettimeofday(&now, NULL); timersub(&now, &start, &diff); if ((diff.tv_sec >= 1) || (res != STLINK_ERROR_WAIT)) { - DEBUG("write_retry failed"); + DEBUG("write_retry failed. "); return res; } } @@ -558,7 +558,7 @@ static int read_retry(uint8_t *txbuf, size_t txsize, gettimeofday(&now, NULL); timersub(&now, &start, &diff); if ((diff.tv_sec >= 1) || (res != STLINK_ERROR_WAIT)) { - DEBUG("read_retry failed"); + DEBUG("read_retry failed. "); return res; } } @@ -1172,7 +1172,14 @@ bool adiv5_ap_setup(int ap) uint8_t data[2]; send_recv_retry(cmd, 16, data, 2); DEBUG_STLINK("Open AP %d\n", ap); - return (stlink_usb_error_check(data, true))? false: true; + int res = stlink_usb_error_check(data, true); + if (res) { + if (Stlink.ver_hw == 30) { + DEBUG("STLINKV3 only connects to STM8/32!\n"); + } + return false; + } + return true; } void adiv5_ap_cleanup(int ap)