File tree Expand file tree Collapse file tree 1 file changed +42
-0
lines changed Expand file tree Collapse file tree 1 file changed +42
-0
lines changed Original file line number Diff line number Diff line change
1
+ # This file defines two Nix shells, one with a RISC-V 32-bit toolchain, the
2
+ # other is 64-bit. The approach is outlined at
3
+ # https://nixos.wiki/wiki/Cross_Compiling.
4
+ #
5
+ # Usage:
6
+ #
7
+ # nix-shell --attr riscv32
8
+ #
9
+ # then use `riscv32-none-elf-gcc` as compiler, or
10
+ #
11
+ # nix-shell --attr riscv64
12
+ #
13
+ # then use `riscv64-unknown-linux-gnu-gcc` as compiler.
14
+
15
+ { pkgs ? import <nixpkgs> { } } :
16
+
17
+ let
18
+ riscv32-pkgs = import <nixpkgs> {
19
+ crossSystem = ( import <nixpkgs/lib> ) . systems . examples . riscv32-embedded ;
20
+ } ;
21
+
22
+ riscv64-pkgs = import <nixpkgs> {
23
+ crossSystem = ( import <nixpkgs/lib> ) . systems . examples . riscv64 ;
24
+ } ;
25
+
26
+ in
27
+ {
28
+ riscv32 = riscv32-pkgs . mkShell {
29
+ buildInputs = [
30
+ ] ;
31
+ } ;
32
+
33
+ riscv64 = riscv64-pkgs . mkShell {
34
+ buildInputs = [
35
+ ] ;
36
+ nativeBuildInputs = [
37
+ # Uncomment to also bring QEMU, if you don't have it system-wide.
38
+ # riscv64-pkgs.buildPackages.buildPackages.qemu
39
+ riscv64-pkgs . buildPackages . gdb
40
+ ] ;
41
+ } ;
42
+ }
You can’t perform that action at this time.
0 commit comments