CMakeLists.txt,main.cpp: option to enable/disable svf_jtag support

This commit is contained in:
Gwenhael Goavec-Merou 2026-01-29 16:16:40 +01:00
parent cc1dc3c868
commit e78b5e2995
2 changed files with 16 additions and 2 deletions

View File

@ -37,6 +37,7 @@ option(ENABLE_JLINK "enable JLink cable (requires libUSB)" ${
option(ENABLE_DFU "enable DFU support (requires libUSB)" ${ENABLE_CABLE_ALL}) option(ENABLE_DFU "enable DFU support (requires libUSB)" ${ENABLE_CABLE_ALL})
option(ENABLE_FTDI_BASED_CABLE "enable cables based on FTDI (requires libFTDI" ${ENABLE_CABLE_ALL}) option(ENABLE_FTDI_BASED_CABLE "enable cables based on FTDI (requires libFTDI" ${ENABLE_CABLE_ALL})
option(ENABLE_GOWIN_GWU2X "enable Gowin GWU2X interface" ${ENABLE_CABLE_ALL}) option(ENABLE_GOWIN_GWU2X "enable Gowin GWU2X interface" ${ENABLE_CABLE_ALL})
option(ENABLE_SVF_JTAG "enable SVF support" ${ENABLE_CABLE_ALL})
option(ENABLE_USB_BLASTERI "enable Altera USB Blaster I support" ${ENABLE_CABLE_ALL}) option(ENABLE_USB_BLASTERI "enable Altera USB Blaster I support" ${ENABLE_CABLE_ALL})
option(ENABLE_USB_BLASTERII "enable Altera USB Blaster II support" ${ENABLE_CABLE_ALL}) option(ENABLE_USB_BLASTERII "enable Altera USB Blaster II support" ${ENABLE_CABLE_ALL})
@ -257,7 +258,6 @@ list(APPEND OPENFPGALOADER_SOURCE
src/spiFlash.cpp src/spiFlash.cpp
src/spiInterface.cpp src/spiInterface.cpp
src/epcq.cpp src/epcq.cpp
src/svf_jtag.cpp
src/jtag.cpp src/jtag.cpp
) )
@ -268,7 +268,6 @@ list(APPEND OPENFPGALOADER_HEADERS
src/spiFlashdb.hpp src/spiFlashdb.hpp
src/epcq.hpp src/epcq.hpp
src/spiInterface.hpp src/spiInterface.hpp
src/svf_jtag.hpp
) )
# FTDI Based cables # FTDI Based cables
@ -504,6 +503,13 @@ list (APPEND OPENFPGALOADER_SOURCE src/remoteBitbang_client.cpp)
list (APPEND OPENFPGALOADER_HEADERS src/remoteBitbang_client.hpp) list (APPEND OPENFPGALOADER_HEADERS src/remoteBitbang_client.hpp)
endif() endif()
# SVF JTAG file type support
if (ENABLE_SVF_JTAG)
list (APPEND OPENFPGALOADER_SOURCE src/svf_jtag.cpp)
list (APPEND OPENFPGALOADER_HEADERS src/svf_jtag.hpp)
add_definitions(-DENABLE_SVF_JTAG)
endif()
# Xilinx Virtual Cable # Xilinx Virtual Cable
if (ENABLE_XILINX_VIRTUAL_CABLE) if (ENABLE_XILINX_VIRTUAL_CABLE)
list (APPEND OPENFPGALOADER_SOURCE src/xvc_client.cpp src/xvc_server.cpp) list (APPEND OPENFPGALOADER_SOURCE src/xvc_client.cpp src/xvc_server.cpp)

View File

@ -59,7 +59,9 @@
#ifdef ENABLE_XILINX_SUPPORT #ifdef ENABLE_XILINX_SUPPORT
#include "xilinx.hpp" #include "xilinx.hpp"
#endif #endif
#ifdef ENABLE_SVF_JTAG
#include "svf_jtag.hpp" #include "svf_jtag.hpp"
#endif
#ifdef ENABLE_XVC #ifdef ENABLE_XVC
#include "xvc_server.hpp" #include "xvc_server.hpp"
#endif #endif
@ -622,6 +624,7 @@ int main(int argc, char **argv)
/* detect svf file and program the device */ /* detect svf file and program the device */
if (!args.file_type.compare("svf") || if (!args.file_type.compare("svf") ||
args.bit_file.find(".svf") != string::npos) { args.bit_file.find(".svf") != string::npos) {
#ifdef ENABLE_SVF_JTAG
SVF_jtag *svf = new SVF_jtag(jtag, args.verbose); SVF_jtag *svf = new SVF_jtag(jtag, args.verbose);
try { try {
svf->parse(args.bit_file); svf->parse(args.bit_file);
@ -629,6 +632,11 @@ int main(int argc, char **argv)
return EXIT_FAILURE; return EXIT_FAILURE;
} }
return EXIT_SUCCESS; return EXIT_SUCCESS;
#else
printError("Support for SVF Jtag was not enabled at compile time");
delete(jtag);
return EXIT_FAILURE;
#endif
} }
/* check if selected device is supported /* check if selected device is supported