diff --git a/fpga/.gitlab-ci.yml b/fpga/.gitlab-ci.yml index c57867823..3f92f75ce 100644 --- a/fpga/.gitlab-ci.yml +++ b/fpga/.gitlab-ci.yml @@ -72,7 +72,9 @@ test:cppcheck: gpu/ src/ lib/ - tests/unit/ | tee cppcheck.log + tests/unit/ + --suppress=unmatchedSuppression + -igpu/thirdparty | tee cppcheck.log image: ${DOCKER_IMAGE_DEV}:${DOCKER_TAG_DEV} dependencies: - build:source diff --git a/fpga/common b/fpga/common index 1912f2106..51e32a4b9 160000 --- a/fpga/common +++ b/fpga/common @@ -1 +1 @@ -Subproject commit 1912f2106453cea3a20358942ad7f360b2129bc3 +Subproject commit 51e32a4b9164b176da5ba3843b645ad6b49b3ec2 diff --git a/fpga/include/villas/fpga/core.hpp b/fpga/include/villas/fpga/core.hpp index 43c0cbe1e..9614d5f35 100644 --- a/fpga/include/villas/fpga/core.hpp +++ b/fpga/include/villas/fpga/core.hpp @@ -54,12 +54,12 @@ class InterruptController; class IpIdentifier { public: - IpIdentifier(Vlnv vlnv = Vlnv::getWildcard(), std::string name = "") : + IpIdentifier(const Vlnv &vlnv = Vlnv::getWildcard(), const std::string &name = "") : vlnv(vlnv), name(name) { } - IpIdentifier(std::string vlnvString, std::string name = "") : + IpIdentifier(const std::string &vlnvString, const std::string &name = "") : vlnv(vlnvString), name(name) { } diff --git a/fpga/include/villas/fpga/ips/dma.hpp b/fpga/include/villas/fpga/ips/dma.hpp index dcf36d752..892fd66cf 100644 --- a/fpga/include/villas/fpga/ips/dma.hpp +++ b/fpga/include/villas/fpga/ips/dma.hpp @@ -43,7 +43,6 @@ public: virtual bool init() override; - virtual bool reset() override; // Memory-mapped to stream (MM2S) diff --git a/fpga/include/villas/fpga/ips/rtds2gpu.hpp b/fpga/include/villas/fpga/ips/rtds2gpu.hpp index 7dfd8a120..d44fdb330 100644 --- a/fpga/include/villas/fpga/ips/rtds2gpu.hpp +++ b/fpga/include/villas/fpga/ips/rtds2gpu.hpp @@ -56,8 +56,6 @@ public: doorbellRegister = 0; } - static constexpr const char* registerMemory = "Reg"; - std::list getMemoryBlocks() const { return { diff --git a/fpga/include/villas/fpga/vlnv.hpp b/fpga/include/villas/fpga/vlnv.hpp index ac865201d..0f6d1a752 100644 --- a/fpga/include/villas/fpga/vlnv.hpp +++ b/fpga/include/villas/fpga/vlnv.hpp @@ -41,7 +41,7 @@ public: version("") { } - Vlnv(std::string s) + Vlnv(const std::string &s) { parseFromString(s); } diff --git a/fpga/lib/ips/dma.cpp b/fpga/lib/ips/dma.cpp index d159362d1..4b2cb4ad6 100644 --- a/fpga/lib/ips/dma.cpp +++ b/fpga/lib/ips/dma.cpp @@ -207,7 +207,7 @@ bool Dma::reset() Dma::~Dma() { - reset(); + Dma::reset(); } bool Dma::memcpy(const MemoryBlock &src, const MemoryBlock &dst, size_t len) diff --git a/fpga/lib/ips/emc.cpp b/fpga/lib/ips/emc.cpp index 62d4a3cfb..c4eeabba5 100644 --- a/fpga/lib/ips/emc.cpp +++ b/fpga/lib/ips/emc.cpp @@ -113,13 +113,12 @@ EMC::flash(uint32_t offset, uint32_t length, uint8_t *data) int ret = XST_FAILURE; uint32_t start = offset; - uint8_t *verify_data = new uint8_t[length]; - /* Reset the Flash Device. This clears the ret registers and puts * the device in Read mode. */ ret = XFlash_Reset(&xflash); - if (ret != XST_SUCCESS) + if (ret != XST_SUCCESS){ return false; + } /* Perform an unlock operation before the erase operation for the Intel * Flash. The erase operation will result in an error if the block is @@ -128,30 +127,37 @@ EMC::flash(uint32_t offset, uint32_t length, uint8_t *data) (xflash.CommandSet == XFL_CMDSET_INTEL_EXTENDED) || (xflash.CommandSet == XFL_CMDSET_INTEL_G18)) { ret = XFlash_Unlock(&xflash, offset, 0); - if(ret != XST_SUCCESS) + if(ret != XST_SUCCESS){ return false; + } } // Perform the Erase operation. ret = XFlash_Erase(&xflash, start, length); - if (ret != XST_SUCCESS) + if (ret != XST_SUCCESS){; return false; + } // Perform the Write operation. ret = XFlash_Write(&xflash, start, length, data); - if (ret != XST_SUCCESS) + if (ret != XST_SUCCESS){ return false; + } // Perform the read operation. + uint8_t *verify_data = new uint8_t[length]; ret = XFlash_Read(&xflash, start, length, verify_data); if(ret != XST_SUCCESS) { + delete[] verify_data; return false; } // Compare the data read against the data Written. for (unsigned i = 0; i < length; i++) { - if (verify_data[i] != data[i]) + if (verify_data[i] != data[i]){ + delete[] verify_data; return false; + } } delete[] verify_data; diff --git a/fpga/src/pcimem.c b/fpga/src/pcimem.c index 8c3814667..4494f859a 100644 --- a/fpga/src/pcimem.c +++ b/fpga/src/pcimem.c @@ -75,14 +75,14 @@ int main(int argc, char **argv) { PRINT_ERROR; printf("%s opened.\n", filename); - printf("Target offset is %#jx, page size is %lu\n", (intmax_t) target, sysconf(_SC_PAGE_SIZE)); + printf("Target offset is %#jx, page size is %lu\n", (uintmax_t) target, sysconf(_SC_PAGE_SIZE)); fflush(stdout); // Map one page printf("mmap(%d, %lu, %#x, %#x, %d, %#jx)\n", 0, MAP_SIZE, PROT_READ | PROT_WRITE, MAP_SHARED, - fd, (intmax_t) target); + fd, (uintmax_t) target); map_base = mmap(0, MAP_SIZE, PROT_READ | PROT_WRITE, MAP_SHARED, fd, target & ~MAP_MASK); @@ -92,7 +92,7 @@ int main(int argc, char **argv) { printf("PCI Memory mapped to address %p.\n", map_base); fflush(stdout); - virt_addr = map_base + (target & MAP_MASK); + virt_addr = (uint8_t*) map_base + (target & MAP_MASK); switch(access_type) { case 'b': @@ -109,7 +109,7 @@ int main(int argc, char **argv) { exit(2); } - printf("Value at offset %#jx (%p): %#x\n", (intmax_t) target, virt_addr, read_result); + printf("Value at offset %#jx (%p): %#x\n", (uintmax_t) target, virt_addr, read_result); fflush(stdout); if (argc > 4) { diff --git a/fpga/src/villas-fpga-cat.cpp b/fpga/src/villas-fpga-cat.cpp index ace383da7..5b4f54bd7 100644 --- a/fpga/src/villas-fpga-cat.cpp +++ b/fpga/src/villas-fpga-cat.cpp @@ -135,7 +135,7 @@ int main(int argc, char* argv[]) for (size_t i = 0; i*4 < bytesRead; i++) { int32_t ival = mem[cur][i]; - float fval = *((float*)(&ival)); + float fval = *((float*)(&ival)); // cppcheck-suppress invalidPointerCast //std::cerr << std::hex << ival << ","; std::cerr << fval << std::endl; /*int64_t ival = (int64_t)(mem[1] & 0xFFFF) << 48 | diff --git a/fpga/tests/unit/gpu.cpp b/fpga/tests/unit/gpu.cpp index 4a7087274..a8a3a37b2 100644 --- a/fpga/tests/unit/gpu.cpp +++ b/fpga/tests/unit/gpu.cpp @@ -118,11 +118,10 @@ Test(fpga, gpu_dma, .description = "GPU DMA tests") if (dma != nullptr and dma->connectLoopback()) { memcpyFuncs.push_back({ - "DMA memcpy", [&]() { + "DMA memcpy", [&] (){ dma->makeAccesibleFromVA(src.getMemoryBlock()); - dma->makeAccesibleFromVA(dst.getMemoryBlock())); - - dma->memcpy(src.getMemoryBlock(), dst.getMemoryBlock(), len); + dma->makeAccesibleFromVA(dst.getMemoryBlock()); + dma->memcpy(src.getMemoryBlock(), dst.getMemoryBlock(), len); }}); }