We were having some erratic behavior with our ft4232-based boards (detect would fail depending on versions of python and unrelated libraries)
We tracked it down to things addressed here.
bugfix unitialized and improperly initialized fields in ft4232: in init, allocate cable_params with calloc, so its cleared initialized low_byte_dir explicitly, for clarity OR flags into in parms->signals so that both trst and reset can be specified
From d72d15f30db3d115a5a7987c92feda1b8004998f Mon Sep 17 00:00:00 2001 From: Steve Tell <t...@telltronics.org> Date: Thu, 16 May 2019 16:49:03 -0400 Subject: [PATCH] bugfix unitialized and improperly initialized fields in ft4232 init allocate cable_params with calloc, so its cleared initialized low_byte_dir explicitly, for clarity OR flags into in parms->signals so that both trst and reset can be specified --- urjtag/src/tap/cable/ft2232.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/urjtag/src/tap/cable/ft2232.c b/urjtag/src/tap/cable/ft2232.c index 7924d0d..ff1abb2 100644 --- a/urjtag/src/tap/cable/ft2232.c +++ b/urjtag/src/tap/cable/ft2232.c @@ -1135,14 +1135,16 @@ ft4232_generic_init (urj_cable_t *cable) if (urj_tap_usbconn_open (cable->link.usb) != URJ_STATUS_OK) return URJ_STATUS_FAIL; + params->signals = 0; params->low_byte_value = 0; + params->low_byte_dir = 0; if (params->bit_trst > 3) { // do not allow clobbering mpsse bits params->low_byte_dir |= (1<<params->bit_trst); - params->signals = URJ_POD_CS_TRST; + params->signals |= URJ_POD_CS_TRST; } if (params->bit_reset > 3) { params->low_byte_dir |= (1<<params->bit_reset); - params->signals = URJ_POD_CS_RESET; + params->signals |= URJ_POD_CS_RESET; } /* Set Data Bits Low Byte: standard TCK = 0, TMS = 1, TDI = 0 */ @@ -2485,7 +2487,7 @@ ft2232_connect (urj_cable_t *cable, const urj_param_t *params[]) if (urj_tap_cable_generic_usbconn_connect (cable, params) != URJ_STATUS_OK) return URJ_STATUS_FAIL; - cable_params = malloc (sizeof (*cable_params)); + cable_params = calloc (1, sizeof (*cable_params)); if (!cable_params) { urj_error_set (URJ_ERROR_OUT_OF_MEMORY, _("malloc(%zd) fails"), -- 1.8.3.1
_______________________________________________ UrJTAG-development mailing list UrJTAG-development@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/urjtag-development