1 { lib, stdenv, fetchFromGitHub, dtc, pkgsCross }:
3 stdenv.mkDerivation rec {
5 version = "1.1.0-unstable-2024-09-21";
7 src = fetchFromGitHub {
9 repo = "riscv-isa-sim";
10 rev = "de5094a1a901d77ff44f89b38e00fefa15d4018e";
11 sha256 = "sha256-mAgR2VzDgeuIdmPEgrb+MaA89BnWfmNanOVidqn0cgc=";
14 nativeBuildInputs = [ dtc ];
15 enableParallelBuilding = true;
18 patchShebangs scripts/*.sh
23 # To test whether spike is working, we run the RISC-V hello applications using the RISC-V proxy
24 # kernel on the Spike emulator and see whether we get the expected output.
25 doInstallCheck = true;
28 riscvPkgs = pkgsCross.riscv64-embedded;
31 runHook preInstallCheck
33 echo -e "#include<stdio.h>\nint main() {printf(\"Hello, world\");return 0;}" > hello.c
34 ${riscvPkgs.stdenv.cc}/bin/${riscvPkgs.stdenv.cc.targetPrefix}cc -o hello hello.c
35 $out/bin/spike -m64 ${riscvPkgs.riscv-pk}/bin/pk hello | grep -Fq "Hello, world"
37 runHook postInstallCheck
41 description = "RISC-V ISA Simulator";
42 homepage = "https://github.com/riscv/riscv-isa-sim";
43 license = licenses.bsd3;
44 platforms = [ "x86_64-linux" "aarch64-linux" ];
45 maintainers = with maintainers; [ blitz ];