This is an automated email from Gerrit. "ahmed BOUDJELIDA <aboudjel...@nanoxplore.com>" just uploaded a new patch set to Gerrit, which you can find at https://review.openocd.org/c/openocd/+/7975
-- gerrit commit a15aaab5b59c858939cacfee06c3054089d1d662 Author: Ahmed BOUDJELIDA <aboudjel...@nanoxplore.com> Date: Mon Nov 6 09:53:24 2023 +0100 jtag/drivers: make ANGIE adapter re-program in every execution ANGIE will be reprogrammed before every execution so we can re-initialize the FX2 microcontroller in case of wrong start. Add new LOG INFO comments. Change-Id: I02f3ac6d5cd3f949e4b286b098b4a46188d2ced1 Signed-off-by: Ahmed BOUDJELIDA <aboudjel...@nanoxplore.com> diff --git a/src/jtag/drivers/angie.c b/src/jtag/drivers/angie.c index 9cc086599c..f387b997a6 100644 --- a/src/jtag/drivers/angie.c +++ b/src/jtag/drivers/angie.c @@ -259,8 +259,10 @@ static int angie_usb_open(struct angie *device) int ret = jtag_libusb_open(vids, pids, &usb_device_handle, NULL); - if (ret != ERROR_OK) + if (ret != ERROR_OK) { + LOG_INFO("Error libusb open"); return ret; + } device->usb_device_handle = usb_device_handle; device->type = ANGIE; @@ -278,8 +280,10 @@ static int angie_usb_open(struct angie *device) static int angie_usb_close(struct angie *device) { if (device->usb_device_handle) { - if (libusb_release_interface(device->usb_device_handle, 0) != 0) + if (libusb_release_interface(device->usb_device_handle, 0) != 0) { + LOG_INFO("Error libusb release interface"); return ERROR_FAIL; + } jtag_libusb_close(device->usb_device_handle); device->usb_device_handle = NULL; @@ -446,7 +450,7 @@ static int angie_load_bitstream(struct angie *device, const char *filename) int actual_length = 0; ret = jtag_libusb_bulk_write(device->usb_device_handle, 0x02, bitstream_data, bitstream_size, 1000, &actual_length); if (ret != ERROR_OK) { - LOG_ERROR("Failed to send bitstream data: %s", libusb_strerror(ret)); + LOG_ERROR("Failed to send bitstream data"); free(bitstream_data); fclose(bitstream_file); return ERROR_FAIL; @@ -2134,8 +2138,6 @@ static int angie_speed_div(int speed, int *khz) static int angie_init(void) { int ret, transferred; - char str_manufacturer[20]; - bool download_firmware = false; char dummy[64]; uint8_t input_signals, output_signals; @@ -2154,38 +2156,22 @@ static int angie_init(void) return ret; } - /* Get String Descriptor to determine if firmware needs to be loaded */ - ret = libusb_get_string_descriptor_ascii(angie_handle->usb_device_handle, 1, (unsigned char *)str_manufacturer, 20); - if (ret < 0) { - /* Could not get descriptor -> Unconfigured or original Keil firmware */ - download_firmware = true; - } else { - /* We got a String Descriptor, check if it is the correct one */ - if (strncmp(str_manufacturer, "NanoXplore, SAS.", 16) != 0) - download_firmware = true; - } - - if (download_firmware) { - LOG_INFO("Loading ANGIE firmware. This is reversible by power-cycling ANGIE device."); - - if (libusb_claim_interface(angie_handle->usb_device_handle, 0) != ERROR_OK) - LOG_ERROR("Could not claim interface"); + LOG_INFO("Loading ANGIE firmware. This is reversible by power-cycling ANGIE device."); - ret = angie_load_firmware_and_renumerate(angie_handle, - ANGIE_FIRMWARE_FILE, ANGIE_RENUMERATION_DELAY_US); - if (ret != ERROR_OK) { - LOG_ERROR("Could not download firmware and re-numerate ANGIE"); - angie_quit(); - return ret; - } - ret = angie_load_bitstream(angie_handle, ANGIE_BITSTREAM_FILE); - if (ret != ERROR_OK) { - LOG_ERROR("Could not download bitstream"); - angie_quit(); - return ret; - } - } else { - LOG_INFO("ANGIE device is already running ANGIE firmware"); + if (libusb_claim_interface(angie_handle->usb_device_handle, 0) != ERROR_OK) + LOG_ERROR("Could not claim interface"); + ret = angie_load_firmware_and_renumerate(angie_handle, + ANGIE_FIRMWARE_FILE, ANGIE_RENUMERATION_DELAY_US); + if (ret != ERROR_OK) { + LOG_ERROR("Could not download binary and re-numerate"); + angie_quit(); + return ret; + } + ret = angie_load_bitstream(angie_handle, ANGIE_BITSTREAM_FILE); + if (ret != ERROR_OK) { + LOG_ERROR("Could not download bitstream"); + angie_quit(); + return ret; } /* Get ANGIE USB IN/OUT endpoints and claim the interface */ --