From 1f0ac646318af353e46d9405e8a011fda1d17fd9 Mon Sep 17 00:00:00 2001 From: Rodrigo Arias Mallo Date: Mon, 8 Jul 2024 13:32:29 +0200 Subject: [PATCH] Add bitstream to Nix --- JOURNAL.md | 23 +++++++++++++++++++++++ flake.nix | 2 ++ fpga/upload.sh | 1 + lagarto-ox.nix | 3 +++ overlay.nix | 5 +++++ 5 files changed, 34 insertions(+) diff --git a/JOURNAL.md b/JOURNAL.md index c0d3dc2..4f78f26 100644 --- a/JOURNAL.md +++ b/JOURNAL.md @@ -832,3 +832,26 @@ Fran has created another bitstream with two consoles enabled (`ox_u55c_a234c132.bit`), let see if I manage to boot with it. First I will need to enable the consoles on the DTS. + +It doesn't seem to produce any output in the UART. I cannot see OpenSBI while +loading it on each baud rate: + + Type [C-a] [C-h] to see available commands + Terminal ready + + *** baud: 57600 *** + + *** baud: 38400 *** + + *** baud: 19200 *** + + *** baud: 9600 *** + + [...] + + *** baud: 230400 *** + + *** baud: 460800 *** + +Let's keep the bitstream files in a repository, so I can carefully track them +with git too. diff --git a/flake.nix b/flake.nix index 69f22a1..e54b84c 100644 --- a/flake.nix +++ b/flake.nix @@ -107,6 +107,7 @@ INITRD = build.initialRamdisk; ROOTFS = build.sdImage; UBOOT_ENV = syspkgs.uboot-env; + BITSTREAM = syspkgs.bitstream; shellHook = '' echo "Here are the current system pieces:" echo " TOPLEVEL = $TOPLEVEL" @@ -115,6 +116,7 @@ echo " INITRD = $INITRD" echo " ROOTFS = $ROOTFS" echo " UBOOT_ENV = $UBOOT_ENV" + echo " BITSTREAM = $BITSTREAM" ''; }; diff --git a/fpga/upload.sh b/fpga/upload.sh index 783b0ef..e136f3f 100755 --- a/fpga/upload.sh +++ b/fpga/upload.sh @@ -21,6 +21,7 @@ if [ -n "$ROOTFS" ]; then else echo "Skipping rootfs" fi +rsync "$BITSTREAM" "$dst/bitstream.bit" rsync "$UBOOT_ENV" "$dst/uboot.env" echo "Now go to $dst and run ./boot.sh" diff --git a/lagarto-ox.nix b/lagarto-ox.nix index 37543d2..74d9b4b 100644 --- a/lagarto-ox.nix +++ b/lagarto-ox.nix @@ -177,6 +177,9 @@ nativeBuildInputs = [ prev.buildPackages.dtc ]; } "dtc -O dtb -o $out $dtsFile"; + bitstream = "${final.bitstreams}/lagarto-3-ox/gold.bit"; + #bitstream = "${final.bitstreams}/lagarto-3-ox/ox_u55c_a234c132_two_uarts.bit"; + uboot = prev.ubootQemuRiscv64Smode.override { filesToInstall = [ "u-boot.bin" "u-boot-nodtb.bin" ]; #version = "2023.07.02-print-cpu-probe"; diff --git a/overlay.nix b/overlay.nix index 55d58ec..19ca0ec 100644 --- a/overlay.nix +++ b/overlay.nix @@ -36,4 +36,9 @@ final: prev: cp unalign_check $out/bin/ ''; }; + + bitstreams = builtins.fetchGit { + url = "git@bscpm03.bsc.es:rarias/bitstreams.git"; + rev = "57876cea158d8a4a63f7d35d715000092609d88c"; + }; }