2024-12-16 23:20:53 +00:00
|
|
|
{ pkgs, stdenv, riscv-arch-test }:
|
2024-12-06 19:44:09 +00:00
|
|
|
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 ];
|
|
|
|
|
2024-12-06 22:40:52 +00:00
|
|
|
buildInputs = with pkgs; [
|
|
|
|
gdb
|
|
|
|
linuxPackages.perf
|
|
|
|
jq
|
|
|
|
lcov
|
2024-12-19 02:30:53 +00:00
|
|
|
(SDL2.overrideAttrs {waylandSupport= true;})
|
2024-12-06 22:40:52 +00:00
|
|
|
#riscv-pkgs.buildPackages.gcc
|
|
|
|
pkgsCross.riscv32-embedded.buildPackages.gcc
|
|
|
|
pkgsCross.riscv32-embedded.buildPackages.binutils
|
2024-12-08 23:32:45 +00:00
|
|
|
pkgsCross.riscv32-embedded.buildPackages.gdb
|
2024-12-15 13:50:18 +00:00
|
|
|
sail-riscv-rv32
|
|
|
|
(python3.withPackages (ps: with ps; [
|
|
|
|
riscof
|
|
|
|
]))
|
2024-12-06 22:40:52 +00:00
|
|
|
];
|
2024-12-06 19:44:09 +00:00
|
|
|
|
|
|
|
hardeningDisable = [ "all" ];
|
|
|
|
cmakeFlags = [
|
|
|
|
"-DCMAKE_EXPORT_COMPILE_COMMANDS=TRUE"
|
2024-12-19 19:07:39 +00:00
|
|
|
#"-DCMAKE_BUILD_TYPE=Debug"
|
|
|
|
"-DCMAKE_BUILD_TYPE=RelWithDebInfo"
|
|
|
|
|
|
|
|
# For profiling
|
|
|
|
# "-DCMAKE_CXX_FLAGS=-pg"
|
|
|
|
# "-DCMAKE_EXE_LINKER_FLAGS=-pg"
|
|
|
|
# "-DCMAKE_SHARED_LINKER_FLAGS=-pg"
|
2024-12-06 19:44:09 +00:00
|
|
|
];
|
|
|
|
shellHook = ''
|
|
|
|
export CMAKE_BUILD_TYPE=Debug
|
|
|
|
ln -s build/compile_commands.json compile_commands.json
|
|
|
|
'';
|
|
|
|
|
2024-12-16 23:20:53 +00:00
|
|
|
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 -
|
|
|
|
'';
|
|
|
|
|
2024-12-06 19:44:09 +00:00
|
|
|
doCheck = true;
|
|
|
|
|
|
|
|
src = ./.;
|
|
|
|
|
|
|
|
}
|