Compare commits

...

3 Commits

Author SHA1 Message Date
Gwenhael Goavec-Merou ba48d53409 main: added detect_flash in SPI Mode and with a manufacturer 2025-05-24 07:50:51 +02:00
Gwenhael Goavec-Merou e135f1820b ice40: added detect_flash support 2025-05-24 07:48:21 +02:00
Gwenhael Goavec-Merou 10ba59c1ec libusb_ll,ftdipp_mpsse: Bus and Device must be both == 0 to use filter or uses VID/PID 2025-05-24 07:46:58 +02:00
4 changed files with 9 additions and 3 deletions

View File

@ -173,7 +173,7 @@ void FTDIpp_MPSSE::open_device(const std::string &serial, unsigned int baudrate)
throw std::runtime_error(err);
}
if (_bus == 0 || _addr == 0)
if (_bus == 0 && _addr == 0)
ret = ftdi_usb_open_desc_index(_ftdi, _vid, _pid, NULL, serial.empty() ? NULL : serial.c_str(), _index);
else
#if (FTDI_VERSION < 104)

View File

@ -24,6 +24,9 @@ class Ice40: public Device, SPIInterface {
void program(unsigned int offset, bool unprotect_flash) override;
bool program_cram(const uint8_t *data, uint32_t length);
bool dumpFlash(uint32_t base_addr, uint32_t len) override;
bool detect_flash() override {
return SPIInterface::detect_flash();
}
bool protect_flash(uint32_t len) override;
bool unprotect_flash() override;
bool bulk_erase_flash() override;

View File

@ -57,7 +57,7 @@ int libusb_ll::get_devices_list(const cable_t *cable)
bus_addr = cable->bus_addr;
device_addr = cable->device_addr;
vid_pid_filter = (vid != 0) && (pid != 0);
bus_dev_filter = (bus_addr != 0) && (device_addr != 0);
bus_dev_filter = ~(bus_addr == 0 && device_addr == 0);
}
int i = 0;

View File

@ -305,7 +305,10 @@ int main(int argc, char **argv)
} else if ((args.prg_type == Device::WR_FLASH ||
args.prg_type == Device::WR_SRAM) ||
!args.bit_file.empty() || !args.file_type.empty()) {
target->program(args.offset, args.unprotect_flash);
if (args.detect_flash)
target->detect_flash();
else
target->program(args.offset, args.unprotect_flash);
}
if (args.unprotect_flash && args.bit_file.empty())
if (!target->unprotect_flash())