Skip to content

sergeiandreyev/riscv-nix

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Full RISC-V + SpinalHDL development environment, powered by Nix

(Basically, a nixified version of https://github.com/sea212/QuantumRisc-VM-Build-Tools)

Includes:

  • Hardware description: Spinal, Verilog, GHDL
  • Synthesis: Yosys, Icestorm toolchains
  • Simulation: GtkWave, Verilator
  • Formal verification: TODO
  • Testing: OpenOCD (including RISC-V forks), JTAG and serial tools
  • RISC-V embedded compiler toolchain for C and Rust

Features:

  • Deterministic thanks to Nix. Guaranteed to work on any machine *.
  • Easy to deploy on existing machines (see below, "Nix shell" or "Overlay") if desired

* at the moment, this only applies to the shell, since the versions in the VM are not pinned.

Installation

Nix can be installed on any machine. A single-user install is recommended for non-NixOS systems, in which the user of the device has to own /nix. This usually requires sudo during installation, but never after that. The installation in /nix is tangential to the FHS and thus does not interfere with any of the existing package managers.

# Run the installation script
curl -L https://nixos.org/nix/install | sh

# You need to call this in you shell to bring `nix` commands into scope. Ideally, put it in your
# ~/.bashrc or equivalent.
source ~/.nix-profile/etc/profile.d/nix.sh

See the manual for more detailed instructions.

GNOME VM (QEMU)

Build a QEMU VM running GNOME with all these tools installed. It can also be deployed on hosts without Nix installation or as a standalone OS. Login: alice:foobar

# Build (must be called in the `riscv-nix` directory)
nix-build -A vm ./default.nix

# Run
./result/bin/run-nixos-vm

GNOME VM (VirtualBox image)

This option has the advantage that the produced image is independent from the host's Nix installation and store. The price is that building the image takes a lot longer and the result is a lot larger.

# Build (must be called in the `riscv-nix` directory)
nix-build -A vm-image ./default.nix

# Now ./result will be a symlink to the built image

Nix shell

Spawn a sub-shell having all these tools in $PATH: nix-shell shell.nix.

Overlay

If you are already on NixOS or using Home-Manager, you can do the following to bring these tools into your global (or user) system environment:

  • add nixpkgs.overlays = [ (import ./overlay.nix) (import (import ./nix/sources.nix).moz-overlay)]; to get all the software (the second one is the Mozially overlay, you need it too)
    • Alternatively, you can use (import ./default.nix).pkgs to get a pinned and configured version of nixpkgs
  • (import ./default.nix).packages pkgs will give you a list of packages. Add it to environment.systemPackages or some equivalent. You need to call it with some pkgs, either use your own or the pinned one as above.
  • Use Niv to manage the dependency on this repository

Maintenance

Run niv update. Manually packaged applications must be checked for updates manually. The pinned Rust nightly toolchain must be updated manually. Test with nix-shell --pure, because that's the one with pinned dependencies. TODO add automatic tests for the different applications.

About

VE-HEP toolchain

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages