jtag: added build/define options to enable/disable cables support

This commit is contained in:
Gwenhael Goavec-Merou 2025-10-29 09:10:45 +01:00
parent 05f41ac2b5
commit a0f1303063
1 changed files with 37 additions and 2 deletions

View File

@ -12,7 +12,9 @@
#include <vector> #include <vector>
#include <string> #include <string>
#ifdef ENABLE_ANLOGIC_CABLE
#include "anlogicCable.hpp" #include "anlogicCable.hpp"
#endif
#ifdef USE_LIBFTDI #ifdef USE_LIBFTDI
#include "ch552_jtag.hpp" #include "ch552_jtag.hpp"
#endif #endif
@ -31,13 +33,21 @@
#ifdef ENABLE_JETSONNANOGPIO #ifdef ENABLE_JETSONNANOGPIO
#include "jetsonNanoJtagBitbang.hpp" #include "jetsonNanoJtagBitbang.hpp"
#endif #endif
#ifdef ENABLE_JLINK
#include "jlink.hpp" #include "jlink.hpp"
#endif
#ifdef ENABLE_CMSISDAP #ifdef ENABLE_CMSISDAP
#include "cmsisDAP.hpp" #include "cmsisDAP.hpp"
#endif #endif
#ifdef ENABLE_DIRTYJTAG
#include "dirtyJtag.hpp" #include "dirtyJtag.hpp"
#endif
#ifdef ENABLE_ESP_USB_JTAG
#include "esp_usb_jtag.hpp" #include "esp_usb_jtag.hpp"
#endif
#ifdef ENABLE_CH347
#include "ch347jtag.hpp" #include "ch347jtag.hpp"
#endif
#include "part.hpp" #include "part.hpp"
#ifdef ENABLE_REMOTEBITBANG #ifdef ENABLE_REMOTEBITBANG
#include "remoteBitbang_client.hpp" #include "remoteBitbang_client.hpp"
@ -98,7 +108,12 @@ Jtag::Jtag(const cable_t &cable, const jtag_pins_conf_t *pin_conf,
{ {
switch (cable.type) { switch (cable.type) {
case MODE_ANLOGICCABLE: case MODE_ANLOGICCABLE:
#ifdef ENABLE_ANLOGIC_CABLE
_jtag = new AnlogicCable(clkHZ); _jtag = new AnlogicCable(clkHZ);
#else
std::cerr << "Jtag: support for Anlogic cable was not enabled at compile time" << std::endl;
throw std::exception();
#endif
break; break;
#ifdef USE_LIBFTDI #ifdef USE_LIBFTDI
case MODE_FTDI_BITBANG: case MODE_FTDI_BITBANG:
@ -115,24 +130,44 @@ Jtag::Jtag(const cable_t &cable, const jtag_pins_conf_t *pin_conf,
break; break;
#endif #endif
case MODE_CH347: case MODE_CH347:
#ifdef ENABLE_CH347
_jtag = new CH347Jtag(clkHZ, verbose, cable.vid, cable.pid, cable.bus_addr, cable.device_addr); _jtag = new CH347Jtag(clkHZ, verbose, cable.vid, cable.pid, cable.bus_addr, cable.device_addr);
#else
std::cerr << "Jtag: support for CH347 cable was not enabled at compile time" << std::endl;
throw std::exception();
#endif
break; break;
case MODE_DIRTYJTAG: case MODE_DIRTYJTAG:
#ifdef ENABLE_DIRTYJTAG
_jtag = new DirtyJtag(clkHZ, verbose); _jtag = new DirtyJtag(clkHZ, verbose);
#else
std::cerr << "Jtag: support for dirtyJtag cable was not enabled at compile time" << std::endl;
throw std::exception();
#endif
break; break;
#ifdef ENABLE_GOWIN_GWU2X
case MODE_GWU2X: case MODE_GWU2X:
#ifdef ENABLE_GOWIN_GWU2X
_jtag = new GowinGWU2x((cable_t *)&cable, clkHZ, verbose); _jtag = new GowinGWU2x((cable_t *)&cable, clkHZ, verbose);
break;
#else #else
std::cerr << "Jtag: support for Gowin GWU2X was not enabled at compile time" << std::endl; std::cerr << "Jtag: support for Gowin GWU2X was not enabled at compile time" << std::endl;
throw std::exception(); throw std::exception();
#endif #endif
break;
case MODE_JLINK: case MODE_JLINK:
#ifdef ENABLE_JLINK
_jtag = new Jlink(clkHZ, verbose, cable.vid, cable.pid); _jtag = new Jlink(clkHZ, verbose, cable.vid, cable.pid);
#else
std::cerr << "Jtag: support for JLink cable was not enabled at compile time" << std::endl;
throw std::exception();
#endif
break; break;
case MODE_ESP: case MODE_ESP:
#ifdef ENABLE_ESP_USB_JTAG
_jtag = new esp_usb_jtag(clkHZ, verbose, 0x303a, 0x1001); _jtag = new esp_usb_jtag(clkHZ, verbose, 0x303a, 0x1001);
#else
std::cerr << "Jtag: support for esp32s3 cable was not enabled at compile time" << std::endl;
throw std::exception();
#endif
break; break;
case MODE_USBBLASTER: case MODE_USBBLASTER:
#ifdef ENABLE_USBBLASTER #ifdef ENABLE_USBBLASTER