{ pkgs, stdenv, riscv-arch-test }: pkgs.gcc13Stdenv.mkDerivation rec { pname = "rve"; version = "0.1.0"; dontPatch = true; preBuild = '' patchShebangs bin/*.sh ''; installFlags = "PREFIX=${placeholder "out"} VERSION=${version}"; nativeBuildInputs = with pkgs; [ pkg-config cmake ninja ]; buildInputs = with pkgs; [ gdb linuxPackages.perf jq lcov #riscv-pkgs.buildPackages.gcc pkgsCross.riscv32-embedded.buildPackages.gcc pkgsCross.riscv32-embedded.buildPackages.binutils pkgsCross.riscv32-embedded.buildPackages.gdb sail-riscv-rv32 (python3.withPackages (ps: with ps; [ riscof ])) ]; hardeningDisable = [ "all" ]; cmakeFlags = [ "-DCMAKE_EXPORT_COMPILE_COMMANDS=TRUE" "-DCMAKE_BUILD_TYPE=Debug" ]; shellHook = '' export CMAKE_BUILD_TYPE=Debug ln -s build/compile_commands.json compile_commands.json ''; checkPhase = '' export PATH=`pwd`:$PATH cd ../test riscof run --config=config.ini \ --suite=${riscv-arch-test}/riscv-test-suite \ --env=${riscv-arch-test}/riscv-test-suite/env \ --no-browser 2>report.txt # This is needed because `riscof` doesn't return # error code on failed tests if [ ! -z "$(grep ERROR report.txt)" ]; then cat report.txt echo "Some of the RISCOF tests failed" exit 1 fi cd - ''; doCheck = true; src = ./.; }