From 45706dfb001a2d89d987074bdb4578f34b79d15f Mon Sep 17 00:00:00 2001 From: Fabien Marteau Date: Thu, 23 Jan 2020 13:17:46 +0100 Subject: [PATCH 1/7] move sources files --- INSTALL.md | 7 +++++++ altera.cpp => openFPGALoader/altera.cpp | 0 altera.hpp => openFPGALoader/altera.hpp | 0 bitparser.cpp => openFPGALoader/bitparser.cpp | 0 bitparser.hpp => openFPGALoader/bitparser.hpp | 0 board.hpp => openFPGALoader/board.hpp | 0 cable.hpp => openFPGALoader/cable.hpp | 0 .../configBitstreamParser.cpp | 0 .../configBitstreamParser.hpp | 0 device.cpp => openFPGALoader/device.cpp | 0 device.hpp => openFPGALoader/device.hpp | 0 display.cpp => openFPGALoader/display.cpp | 0 display.hpp => openFPGALoader/display.hpp | 0 epcq.cpp => openFPGALoader/epcq.cpp | 0 epcq.hpp => openFPGALoader/epcq.hpp | 0 fsparser.cpp => openFPGALoader/fsparser.cpp | 0 fsparser.hpp => openFPGALoader/fsparser.hpp | 0 ftdijtag.cpp => openFPGALoader/ftdijtag.cpp | 0 ftdijtag.hpp => openFPGALoader/ftdijtag.hpp | 0 ftdipp_mpsse.cpp => openFPGALoader/ftdipp_mpsse.cpp | 0 ftdipp_mpsse.hpp => openFPGALoader/ftdipp_mpsse.hpp | 0 ftdispi.cpp => openFPGALoader/ftdispi.cpp | 0 ftdispi.hpp => openFPGALoader/ftdispi.hpp | 0 gowin.cpp => openFPGALoader/gowin.cpp | 0 gowin.hpp => openFPGALoader/gowin.hpp | 0 jedParser.cpp => openFPGALoader/jedParser.cpp | 0 jedParser.hpp => openFPGALoader/jedParser.hpp | 0 lattice.cpp => openFPGALoader/lattice.cpp | 0 lattice.hpp => openFPGALoader/lattice.hpp | 0 .../latticeBitParser.cpp | 0 .../latticeBitParser.hpp | 0 main.cpp => openFPGALoader/main.cpp | 0 mcsParser.cpp => openFPGALoader/mcsParser.cpp | 0 mcsParser.hpp => openFPGALoader/mcsParser.hpp | 0 part.hpp => openFPGALoader/part.hpp | 0 progressBar.cpp => openFPGALoader/progressBar.cpp | 0 progressBar.hpp => openFPGALoader/progressBar.hpp | 0 spiFlash.cpp => openFPGALoader/spiFlash.cpp | 0 spiFlash.hpp => openFPGALoader/spiFlash.hpp | 0 svf_jtag.cpp => openFPGALoader/svf_jtag.cpp | 0 svf_jtag.hpp => openFPGALoader/svf_jtag.hpp | 0 xilinx.cpp => openFPGALoader/xilinx.cpp | 0 xilinx.hpp => openFPGALoader/xilinx.hpp | 0 43 files changed, 7 insertions(+) create mode 100644 INSTALL.md rename altera.cpp => openFPGALoader/altera.cpp (100%) rename altera.hpp => openFPGALoader/altera.hpp (100%) rename bitparser.cpp => openFPGALoader/bitparser.cpp (100%) rename bitparser.hpp => openFPGALoader/bitparser.hpp (100%) rename board.hpp => openFPGALoader/board.hpp (100%) rename cable.hpp => openFPGALoader/cable.hpp (100%) rename configBitstreamParser.cpp => openFPGALoader/configBitstreamParser.cpp (100%) rename configBitstreamParser.hpp => openFPGALoader/configBitstreamParser.hpp (100%) rename device.cpp => openFPGALoader/device.cpp (100%) rename device.hpp => openFPGALoader/device.hpp (100%) rename display.cpp => openFPGALoader/display.cpp (100%) rename display.hpp => openFPGALoader/display.hpp (100%) rename epcq.cpp => openFPGALoader/epcq.cpp (100%) rename epcq.hpp => openFPGALoader/epcq.hpp (100%) rename fsparser.cpp => openFPGALoader/fsparser.cpp (100%) rename fsparser.hpp => openFPGALoader/fsparser.hpp (100%) rename ftdijtag.cpp => openFPGALoader/ftdijtag.cpp (100%) rename ftdijtag.hpp => openFPGALoader/ftdijtag.hpp (100%) rename ftdipp_mpsse.cpp => openFPGALoader/ftdipp_mpsse.cpp (100%) rename ftdipp_mpsse.hpp => openFPGALoader/ftdipp_mpsse.hpp (100%) rename ftdispi.cpp => openFPGALoader/ftdispi.cpp (100%) rename ftdispi.hpp => openFPGALoader/ftdispi.hpp (100%) rename gowin.cpp => openFPGALoader/gowin.cpp (100%) rename gowin.hpp => openFPGALoader/gowin.hpp (100%) rename jedParser.cpp => openFPGALoader/jedParser.cpp (100%) rename jedParser.hpp => openFPGALoader/jedParser.hpp (100%) rename lattice.cpp => openFPGALoader/lattice.cpp (100%) rename lattice.hpp => openFPGALoader/lattice.hpp (100%) rename latticeBitParser.cpp => openFPGALoader/latticeBitParser.cpp (100%) rename latticeBitParser.hpp => openFPGALoader/latticeBitParser.hpp (100%) rename main.cpp => openFPGALoader/main.cpp (100%) rename mcsParser.cpp => openFPGALoader/mcsParser.cpp (100%) rename mcsParser.hpp => openFPGALoader/mcsParser.hpp (100%) rename part.hpp => openFPGALoader/part.hpp (100%) rename progressBar.cpp => openFPGALoader/progressBar.cpp (100%) rename progressBar.hpp => openFPGALoader/progressBar.hpp (100%) rename spiFlash.cpp => openFPGALoader/spiFlash.cpp (100%) rename spiFlash.hpp => openFPGALoader/spiFlash.hpp (100%) rename svf_jtag.cpp => openFPGALoader/svf_jtag.cpp (100%) rename svf_jtag.hpp => openFPGALoader/svf_jtag.hpp (100%) rename xilinx.cpp => openFPGALoader/xilinx.cpp (100%) rename xilinx.hpp => openFPGALoader/xilinx.hpp (100%) diff --git a/INSTALL.md b/INSTALL.md new file mode 100644 index 0000000..fc60bc0 --- /dev/null +++ b/INSTALL.md @@ -0,0 +1,7 @@ +== Compile from source == + +``` +$ mkdir build +$ cd build +$ cmake ../openFPGALoader/ +$ cmake --build . diff --git a/altera.cpp b/openFPGALoader/altera.cpp similarity index 100% rename from altera.cpp rename to openFPGALoader/altera.cpp diff --git a/altera.hpp b/openFPGALoader/altera.hpp similarity index 100% rename from altera.hpp rename to openFPGALoader/altera.hpp diff --git a/bitparser.cpp b/openFPGALoader/bitparser.cpp similarity index 100% rename from bitparser.cpp rename to openFPGALoader/bitparser.cpp diff --git a/bitparser.hpp b/openFPGALoader/bitparser.hpp similarity index 100% rename from bitparser.hpp rename to openFPGALoader/bitparser.hpp diff --git a/board.hpp b/openFPGALoader/board.hpp similarity index 100% rename from board.hpp rename to openFPGALoader/board.hpp diff --git a/cable.hpp b/openFPGALoader/cable.hpp similarity index 100% rename from cable.hpp rename to openFPGALoader/cable.hpp diff --git a/configBitstreamParser.cpp b/openFPGALoader/configBitstreamParser.cpp similarity index 100% rename from configBitstreamParser.cpp rename to openFPGALoader/configBitstreamParser.cpp diff --git a/configBitstreamParser.hpp b/openFPGALoader/configBitstreamParser.hpp similarity index 100% rename from configBitstreamParser.hpp rename to openFPGALoader/configBitstreamParser.hpp diff --git a/device.cpp b/openFPGALoader/device.cpp similarity index 100% rename from device.cpp rename to openFPGALoader/device.cpp diff --git a/device.hpp b/openFPGALoader/device.hpp similarity index 100% rename from device.hpp rename to openFPGALoader/device.hpp diff --git a/display.cpp b/openFPGALoader/display.cpp similarity index 100% rename from display.cpp rename to openFPGALoader/display.cpp diff --git a/display.hpp b/openFPGALoader/display.hpp similarity index 100% rename from display.hpp rename to openFPGALoader/display.hpp diff --git a/epcq.cpp b/openFPGALoader/epcq.cpp similarity index 100% rename from epcq.cpp rename to openFPGALoader/epcq.cpp diff --git a/epcq.hpp b/openFPGALoader/epcq.hpp similarity index 100% rename from epcq.hpp rename to openFPGALoader/epcq.hpp diff --git a/fsparser.cpp b/openFPGALoader/fsparser.cpp similarity index 100% rename from fsparser.cpp rename to openFPGALoader/fsparser.cpp diff --git a/fsparser.hpp b/openFPGALoader/fsparser.hpp similarity index 100% rename from fsparser.hpp rename to openFPGALoader/fsparser.hpp diff --git a/ftdijtag.cpp b/openFPGALoader/ftdijtag.cpp similarity index 100% rename from ftdijtag.cpp rename to openFPGALoader/ftdijtag.cpp diff --git a/ftdijtag.hpp b/openFPGALoader/ftdijtag.hpp similarity index 100% rename from ftdijtag.hpp rename to openFPGALoader/ftdijtag.hpp diff --git a/ftdipp_mpsse.cpp b/openFPGALoader/ftdipp_mpsse.cpp similarity index 100% rename from ftdipp_mpsse.cpp rename to openFPGALoader/ftdipp_mpsse.cpp diff --git a/ftdipp_mpsse.hpp b/openFPGALoader/ftdipp_mpsse.hpp similarity index 100% rename from ftdipp_mpsse.hpp rename to openFPGALoader/ftdipp_mpsse.hpp diff --git a/ftdispi.cpp b/openFPGALoader/ftdispi.cpp similarity index 100% rename from ftdispi.cpp rename to openFPGALoader/ftdispi.cpp diff --git a/ftdispi.hpp b/openFPGALoader/ftdispi.hpp similarity index 100% rename from ftdispi.hpp rename to openFPGALoader/ftdispi.hpp diff --git a/gowin.cpp b/openFPGALoader/gowin.cpp similarity index 100% rename from gowin.cpp rename to openFPGALoader/gowin.cpp diff --git a/gowin.hpp b/openFPGALoader/gowin.hpp similarity index 100% rename from gowin.hpp rename to openFPGALoader/gowin.hpp diff --git a/jedParser.cpp b/openFPGALoader/jedParser.cpp similarity index 100% rename from jedParser.cpp rename to openFPGALoader/jedParser.cpp diff --git a/jedParser.hpp b/openFPGALoader/jedParser.hpp similarity index 100% rename from jedParser.hpp rename to openFPGALoader/jedParser.hpp diff --git a/lattice.cpp b/openFPGALoader/lattice.cpp similarity index 100% rename from lattice.cpp rename to openFPGALoader/lattice.cpp diff --git a/lattice.hpp b/openFPGALoader/lattice.hpp similarity index 100% rename from lattice.hpp rename to openFPGALoader/lattice.hpp diff --git a/latticeBitParser.cpp b/openFPGALoader/latticeBitParser.cpp similarity index 100% rename from latticeBitParser.cpp rename to openFPGALoader/latticeBitParser.cpp diff --git a/latticeBitParser.hpp b/openFPGALoader/latticeBitParser.hpp similarity index 100% rename from latticeBitParser.hpp rename to openFPGALoader/latticeBitParser.hpp diff --git a/main.cpp b/openFPGALoader/main.cpp similarity index 100% rename from main.cpp rename to openFPGALoader/main.cpp diff --git a/mcsParser.cpp b/openFPGALoader/mcsParser.cpp similarity index 100% rename from mcsParser.cpp rename to openFPGALoader/mcsParser.cpp diff --git a/mcsParser.hpp b/openFPGALoader/mcsParser.hpp similarity index 100% rename from mcsParser.hpp rename to openFPGALoader/mcsParser.hpp diff --git a/part.hpp b/openFPGALoader/part.hpp similarity index 100% rename from part.hpp rename to openFPGALoader/part.hpp diff --git a/progressBar.cpp b/openFPGALoader/progressBar.cpp similarity index 100% rename from progressBar.cpp rename to openFPGALoader/progressBar.cpp diff --git a/progressBar.hpp b/openFPGALoader/progressBar.hpp similarity index 100% rename from progressBar.hpp rename to openFPGALoader/progressBar.hpp diff --git a/spiFlash.cpp b/openFPGALoader/spiFlash.cpp similarity index 100% rename from spiFlash.cpp rename to openFPGALoader/spiFlash.cpp diff --git a/spiFlash.hpp b/openFPGALoader/spiFlash.hpp similarity index 100% rename from spiFlash.hpp rename to openFPGALoader/spiFlash.hpp diff --git a/svf_jtag.cpp b/openFPGALoader/svf_jtag.cpp similarity index 100% rename from svf_jtag.cpp rename to openFPGALoader/svf_jtag.cpp diff --git a/svf_jtag.hpp b/openFPGALoader/svf_jtag.hpp similarity index 100% rename from svf_jtag.hpp rename to openFPGALoader/svf_jtag.hpp diff --git a/xilinx.cpp b/openFPGALoader/xilinx.cpp similarity index 100% rename from xilinx.cpp rename to openFPGALoader/xilinx.cpp diff --git a/xilinx.hpp b/openFPGALoader/xilinx.hpp similarity index 100% rename from xilinx.hpp rename to openFPGALoader/xilinx.hpp From e97e57fe28dcbda24f3b3ca91ac5af9f3e02ca06 Mon Sep 17 00:00:00 2001 From: Fabien Marteau Date: Thu, 23 Jan 2020 14:42:27 +0100 Subject: [PATCH 2/7] adding CMake configurations files --- openFPGALoader/CMakeLists.txt | 63 ++++++++++++++++++++++++++++++ openFPGALoader/openFPGALoader.h.in | 3 ++ 2 files changed, 66 insertions(+) create mode 100644 openFPGALoader/CMakeLists.txt create mode 100644 openFPGALoader/openFPGALoader.h.in diff --git a/openFPGALoader/CMakeLists.txt b/openFPGALoader/CMakeLists.txt new file mode 100644 index 0000000..da0350d --- /dev/null +++ b/openFPGALoader/CMakeLists.txt @@ -0,0 +1,63 @@ +cmake_minimum_required(VERSION 3.7) + +# set the project name +project(openFPGALoader VERSION 0.1) + +file(GLOB SOURCES *.hpp *.cpp) + +# add the executable +add_executable(openFPGALoader ${SOURCES}) + +find_path(LIBUSB_INCLUDE_DIR + NAMES libusb.h + PATH_SUFFIXES "include" "libusb" "libusb-1.0") + +find_library(LIBUSB_LIBRARY + NAMES usb + PATH_SUFFIXES "lib" "lib32" "lib64") + +find_library(LIBUSB10_LIBRARY + NAMES usb-1.0 + PATH_SUFFIXES "lib" "lib32" "lib64") + +find_library(LIBUDEV_LIBRARY + NAMES udev + PATH_SUFFIXES "lib" "lib32" "lib64") + +find_path(LIBFTDI1_INCLUDE_DIR + NAMES ftdi.h + PATH_SUFFIXES "include" "ftdi" "libftdi1") + +find_library(LIBFTDI1_LIBRARY + NAMES ftdi1 + PATH_SUFFIXES "lib" "lib32" "lib64") + +find_library(LIBFTDIPP1_LIBRARY + NAMES ftdipp1 + PATH_SUFFIXES "lib" "lib32" "lib64") + +find_package(LibFTDI1) + +target_include_directories(openFPGALoader PUBLIC ${LIBUSB_INCLUDE_DIR}) +target_include_directories(openFPGALoader PUBLIC ${LIBFTDI1_INCLUDE_DIR}) +target_link_libraries(openFPGALoader ${LIBUSB_LIBRARY}) +target_link_libraries(openFPGALoader ${LIBFTDI1_LIBRARY}) +target_link_libraries(openFPGALoader ${LIBFTDIPP1_LIBRARY}) +target_link_libraries(openFPGALoader ${LIBUSB10_LIBRARY}) +target_link_libraries(openFPGALoader ${LIBUDEV_LIBRARY}) + +link_libraries(udev usb-1.0) + +#/usr/lib/x86_64-linux-gnu/libftdipp1.so +configure_file(openFPGALoader.h.in openFPGALoader.h) + +target_include_directories(openFPGALoader PUBLIC "${PROJECT_BINARY_DIR}") + +set(CMAKE_SOURCE_DIR openFPGALoader/) + + +set(CMAKE_CXX_FLAGS "-DOLD_FTDI_VERSION=1") + +# specify the C++ standard +set(CMAKE_CXX_STANDARD 11) +set(CMAKE_CXX_STANDARD_REQUIRED True) diff --git a/openFPGALoader/openFPGALoader.h.in b/openFPGALoader/openFPGALoader.h.in new file mode 100644 index 0000000..34196e0 --- /dev/null +++ b/openFPGALoader/openFPGALoader.h.in @@ -0,0 +1,3 @@ +// the configured options and settings for openFPGALoader +#define openFPGALoader_VERSION_MAJOR @openFPGALoader_VERSION_MAJOR@ +#define openFPGALoader_VERSION_MINOR @openFPGALoader_VERSION_MINOR@ From 485ed55aebbff29fc885da6b427a22c7c2b3cd4e Mon Sep 17 00:00:00 2001 From: Fabien Marteau Date: Thu, 23 Jan 2020 14:44:23 +0100 Subject: [PATCH 3/7] useless old Makefile --- Makefile | 32 -------------------------------- 1 file changed, 32 deletions(-) delete mode 100644 Makefile diff --git a/Makefile b/Makefile deleted file mode 100644 index 13e50e0..0000000 --- a/Makefile +++ /dev/null @@ -1,32 +0,0 @@ -EXEC_NAME=openFPGALoader -SRC= $(wildcard *.cpp) -OBJS= $(SRC:.cpp=.o) -LDFLAGS=-lm -g -Wall -std=c++11 $(shell pkg-config --libs libftdipp1 libudev) -CXXFLAGS=-g -Wall -std=c++11 $(shell pkg-config --cflags libftdipp1 libudev) - -# libftdi < 1.4 as no usb_addr -ifeq ($(shell pkg-config --atleast-version=1.4 libftdipp1 && echo 1),) -CXXFLAGS+=-DOLD_FTDI_VERSION=1 -else -CXXFLAGS+=-DOLD_FTDI_VERSION=0 -endif - -all:$(EXEC_NAME) - -$(EXEC_NAME):$(OBJS) - $(CXX) -o $@ $^ $(LDFLAGS) - -%.o: %.c - $(CC) $(CFLAGS) -o $@ -c $< - -install: - cp -f openFPGALoader /usr/local/bin - mkdir -p /usr/local/share/openFPGALoader - cp -f test_sfl.svf /usr/local/share/openFPGALoader - cp -f spiOverJtag/*.bit /usr/local/share/openFPGALoader - -clean: - rm -rf *.o - rm -f $(EXEC_NAME) - rm -f *.c~ *.h~ Makefile~ - rm -f out*.dat From 137fad1b70cb9148dce402544e08496a52d6c0d7 Mon Sep 17 00:00:00 2001 From: Fabien Marteau Date: Thu, 23 Jan 2020 14:45:15 +0100 Subject: [PATCH 4/7] nitpick --- INSTALL.md | 1 + 1 file changed, 1 insertion(+) diff --git a/INSTALL.md b/INSTALL.md index fc60bc0..eb331ea 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -5,3 +5,4 @@ $ mkdir build $ cd build $ cmake ../openFPGALoader/ $ cmake --build . +``` From ca1329e707abe66d1184772e857a5687f2f2d71e Mon Sep 17 00:00:00 2001 From: Fabien Marteau Date: Thu, 23 Jan 2020 14:48:44 +0100 Subject: [PATCH 5/7] Update INSTALL.md --- INSTALL.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/INSTALL.md b/INSTALL.md index eb331ea..c226449 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -1,4 +1,6 @@ -== Compile from source == +# Install instructions + +## Compile from source ``` $ mkdir build From a86eff6b5787ad70dd04e97507b6234eba8458e9 Mon Sep 17 00:00:00 2001 From: Fabien Marteau Date: Mon, 27 Jan 2020 09:47:42 +0100 Subject: [PATCH 6/7] Update cmake according to trabucayre request https://github.com/trabucayre/openFPGALoader/pull/17 --- CMakeLists.txt | 96 +++++++++++++++++++ openFPGALoader/CMakeLists.txt | 63 ------------ {openFPGALoader => src}/altera.cpp | 0 {openFPGALoader => src}/altera.hpp | 0 {openFPGALoader => src}/bitparser.cpp | 0 {openFPGALoader => src}/bitparser.hpp | 0 {openFPGALoader => src}/board.hpp | 0 {openFPGALoader => src}/cable.hpp | 0 .../configBitstreamParser.cpp | 0 .../configBitstreamParser.hpp | 0 {openFPGALoader => src}/device.cpp | 0 {openFPGALoader => src}/device.hpp | 0 {openFPGALoader => src}/display.cpp | 0 {openFPGALoader => src}/display.hpp | 0 {openFPGALoader => src}/epcq.cpp | 0 {openFPGALoader => src}/epcq.hpp | 0 {openFPGALoader => src}/fsparser.cpp | 0 {openFPGALoader => src}/fsparser.hpp | 0 {openFPGALoader => src}/ftdijtag.cpp | 0 {openFPGALoader => src}/ftdijtag.hpp | 0 {openFPGALoader => src}/ftdipp_mpsse.cpp | 0 {openFPGALoader => src}/ftdipp_mpsse.hpp | 0 {openFPGALoader => src}/ftdispi.cpp | 0 {openFPGALoader => src}/ftdispi.hpp | 0 {openFPGALoader => src}/gowin.cpp | 0 {openFPGALoader => src}/gowin.hpp | 0 {openFPGALoader => src}/jedParser.cpp | 0 {openFPGALoader => src}/jedParser.hpp | 0 {openFPGALoader => src}/lattice.cpp | 0 {openFPGALoader => src}/lattice.hpp | 0 {openFPGALoader => src}/latticeBitParser.cpp | 0 {openFPGALoader => src}/latticeBitParser.hpp | 0 {openFPGALoader => src}/main.cpp | 0 {openFPGALoader => src}/mcsParser.cpp | 0 {openFPGALoader => src}/mcsParser.hpp | 0 {openFPGALoader => src}/openFPGALoader.h.in | 0 {openFPGALoader => src}/part.hpp | 0 {openFPGALoader => src}/progressBar.cpp | 0 {openFPGALoader => src}/progressBar.hpp | 0 {openFPGALoader => src}/spiFlash.cpp | 0 {openFPGALoader => src}/spiFlash.hpp | 0 {openFPGALoader => src}/svf_jtag.cpp | 0 {openFPGALoader => src}/svf_jtag.hpp | 0 {openFPGALoader => src}/xilinx.cpp | 0 {openFPGALoader => src}/xilinx.hpp | 0 45 files changed, 96 insertions(+), 63 deletions(-) create mode 100644 CMakeLists.txt delete mode 100644 openFPGALoader/CMakeLists.txt rename {openFPGALoader => src}/altera.cpp (100%) rename {openFPGALoader => src}/altera.hpp (100%) rename {openFPGALoader => src}/bitparser.cpp (100%) rename {openFPGALoader => src}/bitparser.hpp (100%) rename {openFPGALoader => src}/board.hpp (100%) rename {openFPGALoader => src}/cable.hpp (100%) rename {openFPGALoader => src}/configBitstreamParser.cpp (100%) rename {openFPGALoader => src}/configBitstreamParser.hpp (100%) rename {openFPGALoader => src}/device.cpp (100%) rename {openFPGALoader => src}/device.hpp (100%) rename {openFPGALoader => src}/display.cpp (100%) rename {openFPGALoader => src}/display.hpp (100%) rename {openFPGALoader => src}/epcq.cpp (100%) rename {openFPGALoader => src}/epcq.hpp (100%) rename {openFPGALoader => src}/fsparser.cpp (100%) rename {openFPGALoader => src}/fsparser.hpp (100%) rename {openFPGALoader => src}/ftdijtag.cpp (100%) rename {openFPGALoader => src}/ftdijtag.hpp (100%) rename {openFPGALoader => src}/ftdipp_mpsse.cpp (100%) rename {openFPGALoader => src}/ftdipp_mpsse.hpp (100%) rename {openFPGALoader => src}/ftdispi.cpp (100%) rename {openFPGALoader => src}/ftdispi.hpp (100%) rename {openFPGALoader => src}/gowin.cpp (100%) rename {openFPGALoader => src}/gowin.hpp (100%) rename {openFPGALoader => src}/jedParser.cpp (100%) rename {openFPGALoader => src}/jedParser.hpp (100%) rename {openFPGALoader => src}/lattice.cpp (100%) rename {openFPGALoader => src}/lattice.hpp (100%) rename {openFPGALoader => src}/latticeBitParser.cpp (100%) rename {openFPGALoader => src}/latticeBitParser.hpp (100%) rename {openFPGALoader => src}/main.cpp (100%) rename {openFPGALoader => src}/mcsParser.cpp (100%) rename {openFPGALoader => src}/mcsParser.hpp (100%) rename {openFPGALoader => src}/openFPGALoader.h.in (100%) rename {openFPGALoader => src}/part.hpp (100%) rename {openFPGALoader => src}/progressBar.cpp (100%) rename {openFPGALoader => src}/progressBar.hpp (100%) rename {openFPGALoader => src}/spiFlash.cpp (100%) rename {openFPGALoader => src}/spiFlash.hpp (100%) rename {openFPGALoader => src}/svf_jtag.cpp (100%) rename {openFPGALoader => src}/svf_jtag.hpp (100%) rename {openFPGALoader => src}/xilinx.cpp (100%) rename {openFPGALoader => src}/xilinx.hpp (100%) diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..b60e599 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,96 @@ + +cmake_minimum_required(VERSION 3.0) + +# set the project name +project(openFPGALoader VERSION 0.1 LANGUAGES CXX) + +## specify the C++ standard +set(CMAKE_CXX_STANDARD 11) +set(CMAKE_CXX_STANDARD_REQUIRED True) +set(CMAKE_CXX_FLAGS_DEBUG "-g -Wall -Wextra") + +find_package(PkgConfig REQUIRED) +pkg_check_modules(LIBFTDI REQUIRED libftdi1) +pkg_check_modules(LIBFTDIPP REQUIRED libftdipp1) +pkg_check_modules(LIBUSB REQUIRED libusb) +pkg_check_modules(LIBUDEV REQUIRED libudev) + +set(OPENFPGALOADER_SOURCE + src/spiFlash.cpp + src/epcq.cpp + src/svf_jtag.cpp + src/jedParser.cpp + src/display.cpp + src/ftdijtag.cpp + src/configBitstreamParser.cpp + src/ftdipp_mpsse.cpp + src/xilinx.cpp + src/main.cpp + src/latticeBitParser.cpp + src/gowin.cpp + src/device.cpp + src/lattice.cpp + src/progressBar.cpp + src/fsparser.cpp + src/mcsParser.cpp + src/ftdispi.cpp + src/altera.cpp + src/bitparser.cpp +) + +set(OPENFPGALOADER_HEADERS + src/altera.hpp + src/progressBar.hpp + src/bitparser.hpp + src/ftdijtag.hpp + src/fsparser.hpp + src/part.hpp + src/board.hpp + src/jedParser.hpp + src/display.hpp + src/mcsParser.hpp + src/ftdipp_mpsse.hpp + src/spiFlash.hpp + src/epcq.hpp + src/svf_jtag.hpp + src/xilinx.hpp + src/configBitstreamParser.hpp + src/device.hpp + src/gowin.hpp + src/cable.hpp + src/ftdispi.hpp + src/lattice.hpp + src/latticeBitParser.hpp +) + +add_executable(openFPGALoader + ${OPENFPGALOADER_SOURCE} + ${OPENFPGALOADER_HEADERS} +) + +include_directories(${LIBUDEV_INCLUDE_DIRS} + ${LIBUSB_INCLUDE_DIRS} + ${LIBFTDI_INCLUDE_DIRS} + ${LIBFTDIPP_INCLUDE_DIRS} +) + +target_link_libraries(openFPGALoader + ${LIBUDEV_LIBRARIES} + ${LIBUSB_LIBRARIES} + ${LIBFTDI_LIBRARIES} + ${LIBFTDIPP_LIBRARIES} +) + +# libftdi < 1.4 as no usb_addr +if (${LIBFTDI_VERSION} VERSION_LESS 1.4) + set(CMAKE_CXX_FLAGS "-DOLD_FTDI_VERSION=1") +else() + set(CMAKE_CXX_FLAGS "-DOLD_FTDI_VERSION=0") +endif() + +install(TARGETS openFPGALoader DESTINATION bin) +install(FILES + test_sfl.svf + spiOverJtag/spiOverJtag_xc7a35.bit + DESTINATION share/openFPGALoader +) diff --git a/openFPGALoader/CMakeLists.txt b/openFPGALoader/CMakeLists.txt deleted file mode 100644 index da0350d..0000000 --- a/openFPGALoader/CMakeLists.txt +++ /dev/null @@ -1,63 +0,0 @@ -cmake_minimum_required(VERSION 3.7) - -# set the project name -project(openFPGALoader VERSION 0.1) - -file(GLOB SOURCES *.hpp *.cpp) - -# add the executable -add_executable(openFPGALoader ${SOURCES}) - -find_path(LIBUSB_INCLUDE_DIR - NAMES libusb.h - PATH_SUFFIXES "include" "libusb" "libusb-1.0") - -find_library(LIBUSB_LIBRARY - NAMES usb - PATH_SUFFIXES "lib" "lib32" "lib64") - -find_library(LIBUSB10_LIBRARY - NAMES usb-1.0 - PATH_SUFFIXES "lib" "lib32" "lib64") - -find_library(LIBUDEV_LIBRARY - NAMES udev - PATH_SUFFIXES "lib" "lib32" "lib64") - -find_path(LIBFTDI1_INCLUDE_DIR - NAMES ftdi.h - PATH_SUFFIXES "include" "ftdi" "libftdi1") - -find_library(LIBFTDI1_LIBRARY - NAMES ftdi1 - PATH_SUFFIXES "lib" "lib32" "lib64") - -find_library(LIBFTDIPP1_LIBRARY - NAMES ftdipp1 - PATH_SUFFIXES "lib" "lib32" "lib64") - -find_package(LibFTDI1) - -target_include_directories(openFPGALoader PUBLIC ${LIBUSB_INCLUDE_DIR}) -target_include_directories(openFPGALoader PUBLIC ${LIBFTDI1_INCLUDE_DIR}) -target_link_libraries(openFPGALoader ${LIBUSB_LIBRARY}) -target_link_libraries(openFPGALoader ${LIBFTDI1_LIBRARY}) -target_link_libraries(openFPGALoader ${LIBFTDIPP1_LIBRARY}) -target_link_libraries(openFPGALoader ${LIBUSB10_LIBRARY}) -target_link_libraries(openFPGALoader ${LIBUDEV_LIBRARY}) - -link_libraries(udev usb-1.0) - -#/usr/lib/x86_64-linux-gnu/libftdipp1.so -configure_file(openFPGALoader.h.in openFPGALoader.h) - -target_include_directories(openFPGALoader PUBLIC "${PROJECT_BINARY_DIR}") - -set(CMAKE_SOURCE_DIR openFPGALoader/) - - -set(CMAKE_CXX_FLAGS "-DOLD_FTDI_VERSION=1") - -# specify the C++ standard -set(CMAKE_CXX_STANDARD 11) -set(CMAKE_CXX_STANDARD_REQUIRED True) diff --git a/openFPGALoader/altera.cpp b/src/altera.cpp similarity index 100% rename from openFPGALoader/altera.cpp rename to src/altera.cpp diff --git a/openFPGALoader/altera.hpp b/src/altera.hpp similarity index 100% rename from openFPGALoader/altera.hpp rename to src/altera.hpp diff --git a/openFPGALoader/bitparser.cpp b/src/bitparser.cpp similarity index 100% rename from openFPGALoader/bitparser.cpp rename to src/bitparser.cpp diff --git a/openFPGALoader/bitparser.hpp b/src/bitparser.hpp similarity index 100% rename from openFPGALoader/bitparser.hpp rename to src/bitparser.hpp diff --git a/openFPGALoader/board.hpp b/src/board.hpp similarity index 100% rename from openFPGALoader/board.hpp rename to src/board.hpp diff --git a/openFPGALoader/cable.hpp b/src/cable.hpp similarity index 100% rename from openFPGALoader/cable.hpp rename to src/cable.hpp diff --git a/openFPGALoader/configBitstreamParser.cpp b/src/configBitstreamParser.cpp similarity index 100% rename from openFPGALoader/configBitstreamParser.cpp rename to src/configBitstreamParser.cpp diff --git a/openFPGALoader/configBitstreamParser.hpp b/src/configBitstreamParser.hpp similarity index 100% rename from openFPGALoader/configBitstreamParser.hpp rename to src/configBitstreamParser.hpp diff --git a/openFPGALoader/device.cpp b/src/device.cpp similarity index 100% rename from openFPGALoader/device.cpp rename to src/device.cpp diff --git a/openFPGALoader/device.hpp b/src/device.hpp similarity index 100% rename from openFPGALoader/device.hpp rename to src/device.hpp diff --git a/openFPGALoader/display.cpp b/src/display.cpp similarity index 100% rename from openFPGALoader/display.cpp rename to src/display.cpp diff --git a/openFPGALoader/display.hpp b/src/display.hpp similarity index 100% rename from openFPGALoader/display.hpp rename to src/display.hpp diff --git a/openFPGALoader/epcq.cpp b/src/epcq.cpp similarity index 100% rename from openFPGALoader/epcq.cpp rename to src/epcq.cpp diff --git a/openFPGALoader/epcq.hpp b/src/epcq.hpp similarity index 100% rename from openFPGALoader/epcq.hpp rename to src/epcq.hpp diff --git a/openFPGALoader/fsparser.cpp b/src/fsparser.cpp similarity index 100% rename from openFPGALoader/fsparser.cpp rename to src/fsparser.cpp diff --git a/openFPGALoader/fsparser.hpp b/src/fsparser.hpp similarity index 100% rename from openFPGALoader/fsparser.hpp rename to src/fsparser.hpp diff --git a/openFPGALoader/ftdijtag.cpp b/src/ftdijtag.cpp similarity index 100% rename from openFPGALoader/ftdijtag.cpp rename to src/ftdijtag.cpp diff --git a/openFPGALoader/ftdijtag.hpp b/src/ftdijtag.hpp similarity index 100% rename from openFPGALoader/ftdijtag.hpp rename to src/ftdijtag.hpp diff --git a/openFPGALoader/ftdipp_mpsse.cpp b/src/ftdipp_mpsse.cpp similarity index 100% rename from openFPGALoader/ftdipp_mpsse.cpp rename to src/ftdipp_mpsse.cpp diff --git a/openFPGALoader/ftdipp_mpsse.hpp b/src/ftdipp_mpsse.hpp similarity index 100% rename from openFPGALoader/ftdipp_mpsse.hpp rename to src/ftdipp_mpsse.hpp diff --git a/openFPGALoader/ftdispi.cpp b/src/ftdispi.cpp similarity index 100% rename from openFPGALoader/ftdispi.cpp rename to src/ftdispi.cpp diff --git a/openFPGALoader/ftdispi.hpp b/src/ftdispi.hpp similarity index 100% rename from openFPGALoader/ftdispi.hpp rename to src/ftdispi.hpp diff --git a/openFPGALoader/gowin.cpp b/src/gowin.cpp similarity index 100% rename from openFPGALoader/gowin.cpp rename to src/gowin.cpp diff --git a/openFPGALoader/gowin.hpp b/src/gowin.hpp similarity index 100% rename from openFPGALoader/gowin.hpp rename to src/gowin.hpp diff --git a/openFPGALoader/jedParser.cpp b/src/jedParser.cpp similarity index 100% rename from openFPGALoader/jedParser.cpp rename to src/jedParser.cpp diff --git a/openFPGALoader/jedParser.hpp b/src/jedParser.hpp similarity index 100% rename from openFPGALoader/jedParser.hpp rename to src/jedParser.hpp diff --git a/openFPGALoader/lattice.cpp b/src/lattice.cpp similarity index 100% rename from openFPGALoader/lattice.cpp rename to src/lattice.cpp diff --git a/openFPGALoader/lattice.hpp b/src/lattice.hpp similarity index 100% rename from openFPGALoader/lattice.hpp rename to src/lattice.hpp diff --git a/openFPGALoader/latticeBitParser.cpp b/src/latticeBitParser.cpp similarity index 100% rename from openFPGALoader/latticeBitParser.cpp rename to src/latticeBitParser.cpp diff --git a/openFPGALoader/latticeBitParser.hpp b/src/latticeBitParser.hpp similarity index 100% rename from openFPGALoader/latticeBitParser.hpp rename to src/latticeBitParser.hpp diff --git a/openFPGALoader/main.cpp b/src/main.cpp similarity index 100% rename from openFPGALoader/main.cpp rename to src/main.cpp diff --git a/openFPGALoader/mcsParser.cpp b/src/mcsParser.cpp similarity index 100% rename from openFPGALoader/mcsParser.cpp rename to src/mcsParser.cpp diff --git a/openFPGALoader/mcsParser.hpp b/src/mcsParser.hpp similarity index 100% rename from openFPGALoader/mcsParser.hpp rename to src/mcsParser.hpp diff --git a/openFPGALoader/openFPGALoader.h.in b/src/openFPGALoader.h.in similarity index 100% rename from openFPGALoader/openFPGALoader.h.in rename to src/openFPGALoader.h.in diff --git a/openFPGALoader/part.hpp b/src/part.hpp similarity index 100% rename from openFPGALoader/part.hpp rename to src/part.hpp diff --git a/openFPGALoader/progressBar.cpp b/src/progressBar.cpp similarity index 100% rename from openFPGALoader/progressBar.cpp rename to src/progressBar.cpp diff --git a/openFPGALoader/progressBar.hpp b/src/progressBar.hpp similarity index 100% rename from openFPGALoader/progressBar.hpp rename to src/progressBar.hpp diff --git a/openFPGALoader/spiFlash.cpp b/src/spiFlash.cpp similarity index 100% rename from openFPGALoader/spiFlash.cpp rename to src/spiFlash.cpp diff --git a/openFPGALoader/spiFlash.hpp b/src/spiFlash.hpp similarity index 100% rename from openFPGALoader/spiFlash.hpp rename to src/spiFlash.hpp diff --git a/openFPGALoader/svf_jtag.cpp b/src/svf_jtag.cpp similarity index 100% rename from openFPGALoader/svf_jtag.cpp rename to src/svf_jtag.cpp diff --git a/openFPGALoader/svf_jtag.hpp b/src/svf_jtag.hpp similarity index 100% rename from openFPGALoader/svf_jtag.hpp rename to src/svf_jtag.hpp diff --git a/openFPGALoader/xilinx.cpp b/src/xilinx.cpp similarity index 100% rename from openFPGALoader/xilinx.cpp rename to src/xilinx.cpp diff --git a/openFPGALoader/xilinx.hpp b/src/xilinx.hpp similarity index 100% rename from openFPGALoader/xilinx.hpp rename to src/xilinx.hpp From e52daaff4e7441f7cc2f01c9397995860f1a7741 Mon Sep 17 00:00:00 2001 From: Fabien Marteau Date: Tue, 28 Jan 2020 10:41:55 +0100 Subject: [PATCH 7/7] some fixes according to trabucayre comment --- CMakeLists.txt | 2 +- INSTALL.md | 2 +- README.md | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b60e599..b62eeb0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -12,7 +12,7 @@ set(CMAKE_CXX_FLAGS_DEBUG "-g -Wall -Wextra") find_package(PkgConfig REQUIRED) pkg_check_modules(LIBFTDI REQUIRED libftdi1) pkg_check_modules(LIBFTDIPP REQUIRED libftdipp1) -pkg_check_modules(LIBUSB REQUIRED libusb) +pkg_check_modules(LIBUSB REQUIRED libusb-1.0) pkg_check_modules(LIBUDEV REQUIRED libudev) set(OPENFPGALOADER_SOURCE diff --git a/INSTALL.md b/INSTALL.md index c226449..ad217ff 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -5,6 +5,6 @@ ``` $ mkdir build $ cd build -$ cmake ../openFPGALoader/ +$ cmake ../src/ $ cmake --build . ``` diff --git a/README.md b/README.md index 9c8796d..fde2e82 100644 --- a/README.md +++ b/README.md @@ -28,7 +28,7 @@ __Supported cables:__ This application uses **libftdi1**, so this library must be installed (and, depending of the distribution, headers too) ```bash -apt-get install libftdi1-2 libftdi1-dev libftdipp1-3 libftdipp1-dev libudev-dev +apt-get install libftdi1-2 libftdi1-dev libftdipp1-3 libftdipp1-dev libudev-dev cmake ``` and if not already done, install **pkg-config**, **make** and **g++**.