diff --git a/src/jtag.cpp b/src/jtag.cpp index 215959e..3fd9785 100644 --- a/src/jtag.cpp +++ b/src/jtag.cpp @@ -12,7 +12,9 @@ #include #include +#ifdef ENABLE_ANLOGIC_CABLE #include "anlogicCable.hpp" +#endif #ifdef USE_LIBFTDI #include "ch552_jtag.hpp" #endif @@ -31,13 +33,21 @@ #ifdef ENABLE_JETSONNANOGPIO #include "jetsonNanoJtagBitbang.hpp" #endif +#ifdef ENABLE_JLINK #include "jlink.hpp" +#endif #ifdef ENABLE_CMSISDAP #include "cmsisDAP.hpp" #endif +#ifdef ENABLE_DIRTYJTAG #include "dirtyJtag.hpp" +#endif +#ifdef ENABLE_ESP_USB_JTAG #include "esp_usb_jtag.hpp" +#endif +#ifdef ENABLE_CH347 #include "ch347jtag.hpp" +#endif #include "part.hpp" #ifdef ENABLE_REMOTEBITBANG #include "remoteBitbang_client.hpp" @@ -98,7 +108,12 @@ Jtag::Jtag(const cable_t &cable, const jtag_pins_conf_t *pin_conf, { switch (cable.type) { case MODE_ANLOGICCABLE: +#ifdef ENABLE_ANLOGIC_CABLE _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; #ifdef USE_LIBFTDI case MODE_FTDI_BITBANG: @@ -115,24 +130,44 @@ Jtag::Jtag(const cable_t &cable, const jtag_pins_conf_t *pin_conf, break; #endif case MODE_CH347: +#ifdef ENABLE_CH347 _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; case MODE_DIRTYJTAG: +#ifdef ENABLE_DIRTYJTAG _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; -#ifdef ENABLE_GOWIN_GWU2X case MODE_GWU2X: +#ifdef ENABLE_GOWIN_GWU2X _jtag = new GowinGWU2x((cable_t *)&cable, clkHZ, verbose); - break; #else std::cerr << "Jtag: support for Gowin GWU2X was not enabled at compile time" << std::endl; throw std::exception(); #endif + break; case MODE_JLINK: +#ifdef ENABLE_JLINK _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; case MODE_ESP: +#ifdef ENABLE_ESP_USB_JTAG _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; case MODE_USBBLASTER: #ifdef ENABLE_USBBLASTER