aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAntonio Borneo <borneo.antonio@gmail.com>2021-10-07 22:28:30 +0200
committerAntonio Borneo <borneo.antonio@gmail.com>2021-11-28 10:57:22 +0000
commitb1afd3dba4f046843d0c7c583c0b4ed56122d757 (patch)
tree9cba56d6181c303c24467703769b6d47d6904dbd
parent52b94977243b500b2f6c051710dc8d88fdab78a0 (diff)
downloadriscv-openocd-b1afd3dba4f046843d0c7c583c0b4ed56122d757.zip
riscv-openocd-b1afd3dba4f046843d0c7c583c0b4ed56122d757.tar.gz
riscv-openocd-b1afd3dba4f046843d0c7c583c0b4ed56122d757.tar.bz2
jtag/ftdi: switch to command 'adapter serial'
The driver ftdi defines the command 'ftdi serial' to specify the serial string of the adapter. Remove and deprecate the driver command, and use 'adapter serial'. Change-Id: Ia5b1f325b9fab8f58b5ea70f8b807e50b148b939 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/6651 Tested-by: jenkins
-rw-r--r--doc/openocd.texi13
-rw-r--r--src/jtag/drivers/ftdi.c23
-rw-r--r--src/jtag/startup.tcl10
-rw-r--r--tcl/interface/ftdi/flossjtag.cfg2
4 files changed, 12 insertions, 36 deletions
diff --git a/doc/openocd.texi b/doc/openocd.texi
index 2891f35..5b9d650 100644
--- a/doc/openocd.texi
+++ b/doc/openocd.texi
@@ -2371,9 +2371,9 @@ This command is only available if your libusb1 is at least version 1.0.16.
Specifies the @var{serial_string} of the adapter to use.
If this command is not specified, serial strings are not checked.
Only the following adapter drivers use the serial string from this command:
-cmsis_dap, ft232r.
+cmsis_dap, ft232r, ftdi.
The following adapters have their own command to specify the serial string:
-ftdi, hla, jlink, kitprog, presto, st-link, vsllink, xds110.
+hla, jlink, kitprog, presto, st-link, vsllink, xds110.
@end deffn
@section Interface Drivers
@@ -2512,15 +2512,6 @@ of the adapter. If not specified, the device description is ignored
during device selection.
@end deffn
-@deffn {Config Command} {ftdi serial} serial-number
-Specifies the @var{serial-number} of the adapter to use,
-in case the vendor provides unique IDs and more than one adapter
-is connected to the host.
-If not specified, serial numbers are not considered.
-(Note that USB serial numbers can be arbitrary Unicode strings,
-and are not restricted to containing only decimal digits.)
-@end deffn
-
@deffn {Config Command} {ftdi channel} channel
Selects the channel of the FTDI device to use for MPSSE operations. Most
adapters use the default, channel 0, but there are exceptions.
diff --git a/src/jtag/drivers/ftdi.c b/src/jtag/drivers/ftdi.c
index 8366774..7671cee 100644
--- a/src/jtag/drivers/ftdi.c
+++ b/src/jtag/drivers/ftdi.c
@@ -90,7 +90,6 @@
#define SWD_MODE (LSB_FIRST | POS_EDGE_IN | NEG_EDGE_OUT)
static char *ftdi_device_desc;
-static char *ftdi_serial;
static uint8_t ftdi_channel;
static uint8_t ftdi_jtag_mode = JTAG_MODE;
@@ -672,7 +671,7 @@ static int ftdi_initialize(void)
for (int i = 0; ftdi_vid[i] || ftdi_pid[i]; i++) {
mpsse_ctx = mpsse_open(&ftdi_vid[i], &ftdi_pid[i], ftdi_device_desc,
- ftdi_serial, adapter_usb_get_location(), ftdi_channel);
+ adapter_get_required_serial(), adapter_usb_get_location(), ftdi_channel);
if (mpsse_ctx)
break;
}
@@ -717,7 +716,6 @@ static int ftdi_quit(void)
}
free(ftdi_device_desc);
- free(ftdi_serial);
free(swd_cmd_queue);
@@ -736,18 +734,6 @@ COMMAND_HANDLER(ftdi_handle_device_desc_command)
return ERROR_OK;
}
-COMMAND_HANDLER(ftdi_handle_serial_command)
-{
- if (CMD_ARGC == 1) {
- free(ftdi_serial);
- ftdi_serial = strdup(CMD_ARGV[0]);
- } else {
- return ERROR_COMMAND_SYNTAX_ERROR;
- }
-
- return ERROR_OK;
-}
-
COMMAND_HANDLER(ftdi_handle_channel_command)
{
if (CMD_ARGC == 1)
@@ -956,13 +942,6 @@ static const struct command_registration ftdi_subcommand_handlers[] = {
.usage = "description_string",
},
{
- .name = "serial",
- .handler = &ftdi_handle_serial_command,
- .mode = COMMAND_CONFIG,
- .help = "set the serial number of the FTDI device",
- .usage = "serial_string",
- },
- {
.name = "channel",
.handler = &ftdi_handle_channel_command,
.mode = COMMAND_CONFIG,
diff --git a/src/jtag/startup.tcl b/src/jtag/startup.tcl
index b5f4a02..b21ddc6 100644
--- a/src/jtag/startup.tcl
+++ b/src/jtag/startup.tcl
@@ -215,8 +215,8 @@ proc ftdi_device_desc args {
lappend _telnet_autocomplete_skip ftdi_serial
proc ftdi_serial args {
- echo "DEPRECATED! use 'ftdi serial' not 'ftdi_serial'"
- eval ftdi serial $args
+ echo "DEPRECATED! use 'adapter serial' not 'ftdi_serial'"
+ eval adapter serial $args
}
lappend _telnet_autocomplete_skip ftdi_channel
@@ -753,4 +753,10 @@ proc "ft232r serial_desc" {args} {
eval adapter serial $args
}
+lappend _telnet_autocomplete_skip "ftdi serial"
+proc "ftdi serial" {args} {
+ echo "DEPRECATED! use 'adapter serial' not 'ftdi serial'"
+ eval adapter serial $args
+}
+
# END MIGRATION AIDS
diff --git a/tcl/interface/ftdi/flossjtag.cfg b/tcl/interface/ftdi/flossjtag.cfg
index 2e3cfca..c1506a2 100644
--- a/tcl/interface/ftdi/flossjtag.cfg
+++ b/tcl/interface/ftdi/flossjtag.cfg
@@ -20,7 +20,7 @@ echo "so it could be marked as working or fixed."
adapter driver ftdi
ftdi vid_pid 0x0403 0x6010
ftdi device_desc "FLOSS-JTAG"
-#ftdi serial "FJ000001"
+# adapter serial "FJ000001"
ftdi layout_init 0x0008 0x180b
ftdi layout_signal nTRST -data 0x0010 -oe 0x0010