diff --git a/src/platforms/hosted/bmp_libusb.c b/src/platforms/hosted/bmp_libusb.c index 07b59ca4e82..fb5ad14d925 100644 --- a/src/platforms/hosted/bmp_libusb.c +++ b/src/platforms/hosted/bmp_libusb.c @@ -80,6 +80,10 @@ static const debugger_device_s debugger_devices[] = { {VENDOR_ID_FTDI, PRODUCT_ID_FTDI_FT2232, PROBE_TYPE_FTDI, NULL, "FTDI FT2232"}, {VENDOR_ID_FTDI, PRODUCT_ID_FTDI_FT4232, PROBE_TYPE_FTDI, NULL, "FTDI FT4232"}, {VENDOR_ID_FTDI, PRODUCT_ID_FTDI_FT232, PROBE_TYPE_FTDI, NULL, "FTDI FT232"}, + {VENDOR_ID_OLIMEX, PRODUCT_ID_OLIMEX_ARM_USB_OCD, PROBE_TYPE_FTDI, NULL, "Olimex ARM-USB-OCD"}, + {VENDOR_ID_OLIMEX, PRODUCT_ID_OLIMEX_ARM_USB_TINY, PROBE_TYPE_FTDI, NULL, "Olimex ARM-USB-TINY"}, + {VENDOR_ID_OLIMEX, PRODUCT_ID_OLIMEX_ARM_USB_TINY_H, PROBE_TYPE_FTDI, NULL, "Olimex ARM-USB-TINY-H"}, + {VENDOR_ID_OLIMEX, PRODUCT_ID_OLIMEX_ARM_USB_OCD_H, PROBE_TYPE_FTDI, NULL, "Olimex ARM-USB-OCD-H"}, {0, 0, PROBE_TYPE_NONE, NULL, ""}, }; diff --git a/src/platforms/hosted/ftdi_bmp.c b/src/platforms/hosted/ftdi_bmp.c index e664d466ead..b9915866df4 100644 --- a/src/platforms/hosted/ftdi_bmp.c +++ b/src/platforms/hosted/ftdi_bmp.c @@ -187,13 +187,6 @@ const cable_desc_s cable_desc[] = { .name = "ftdiswd", .description = "FTDISWD", }, - { - .vendor = 0x15b1U, - .product = 0x0003U, - .interface = INTERFACE_A, - .init.dirs[0] = PIN5, - .name = "olimex", - }, { /* * Buffered connection from FTDI to JTAG/SWD. @@ -278,15 +271,17 @@ const cable_desc_s cable_desc[] = { { /* * http://www.olimex.com/dev/pdf/ARM-USB-OCD.pdf. - * DBUS 4 global enables JTAG Buffer. - * TCK and TMS are not independently switchable. - * => SWD is not possible. + * https://www.olimex.com/Products/ARM/JTAG/_resources/ARM-USB-OCD_and_OCD_H_manual.pdf + * DBUS 4 (active low) enables JTAG output buffers. + * TCK and TMS are not independently switchable. => SWD is not possible. + * Because of strstr() matching HS devices against FS cable-desc (full prefix), HS cable-desc should come first. */ .vendor = 0x15baU, .product = 0x002bU, .interface = INTERFACE_A, .init.data = {0, PIN3 | PIN1 | PIN0}, .init.dirs = {PIN4, PIN4 | PIN3 | PIN1 | PIN0}, + .description = "Olimex OpenOCD JTAG ARM-USB-OCD-H", .name = "arm-usb-ocd-h", }, { @@ -362,10 +357,11 @@ const cable_desc_s cable_desc[] = { { /* * https://www.olimex.com/Products/ARM/JTAG/ARM-USB-TINY-H/ + * https://www.olimex.com/Products/ARM/JTAG/_resources/ARM-USB-TINY_and_TINY_H_manual.pdf * * schematics not available */ - .vendor = 0x15b1U, + .vendor = 0x15baU, .product = 0x002aU, .interface = INTERFACE_A, .init.data = {PIN4, PIN2 | PIN4}, @@ -377,6 +373,32 @@ const cable_desc_s cable_desc[] = { .name = "arm-usb-tiny-h", .description = "Olimex OpenOCD JTAG ARM-USB-TINY-H", }, + { + /* + * https://www.olimex.com/Products/ARM/JTAG/_resources/ARM-USB-TINY_and_TINY_H_manual.pdf + * JTAG-only, unbuffered. + */ + .vendor = 0x15baU, + .product = 0x0004U, + .interface = INTERFACE_A, + .description = "Olimex OpenOCD JTAG TINY", + .name = "arm-usb-tiny", + }, + { + /* + * https://www.olimex.com/Products/ARM/JTAG/_resources/ARM-USB-OCD.pdf + * https://www.olimex.com/Products/ARM/JTAG/_resources/ARM-USB-OCD_and_OCD_H_manual.pdf + * DBUS 4 (active-low) enables output buffers. + * DBUS 6 is TSRST in (sense), CBUS 1 is TSRST out. + * CBUS 0 is TRST, CBUS 2 is TRST buffer-enable. CBUS 3 is red LED. + */ + .vendor = 0x15baU, + .product = 0x0003U, + .interface = INTERFACE_A, + .init.dirs[0] = PIN4, + .description = "Olimex OpenOCD JTAG", + .name = "arm-usb-ocd", + }, {0}, }; @@ -416,8 +438,10 @@ bool ftdi_lookup_cable_by_product(bmda_cli_options_s *cl_opts, const char *produ return true; for (const cable_desc_s *cable = &cable_desc[0]; cable->vendor; ++cable) { + /* USB Product string should contain partial BMD description as substring */ if (cable->description && strstr(product, cable->description) != 0) { cl_opts->opt_cable = cable->name; + DEBUG_INFO("%s matched %s: %s\n", __func__, cable->name, cable->description); return true; } } diff --git a/src/platforms/hosted/platform.h b/src/platforms/hosted/platform.h index e220166dffb..57f3086b30e 100644 --- a/src/platforms/hosted/platform.h +++ b/src/platforms/hosted/platform.h @@ -83,6 +83,12 @@ void platform_buffer_flush(void); #define PRODUCT_ID_WCHLINK_DAP 0x8011U /* WCH-Link in mode DAP */ #define PRODUCT_ID_WCHLINKE_DAP 0x8012U /* WCH-LinkE in mode DAP */ +#define VENDOR_ID_OLIMEX 0x15baU +#define PRODUCT_ID_OLIMEX_ARM_USB_OCD 0x0003U +#define PRODUCT_ID_OLIMEX_ARM_USB_TINY 0x0004U +#define PRODUCT_ID_OLIMEX_ARM_USB_TINY_H 0x002aU +#define PRODUCT_ID_OLIMEX_ARM_USB_OCD_H 0x002bU + typedef enum probe_type { PROBE_TYPE_NONE = 0, PROBE_TYPE_BMP,