Fix OpenSBI configuration for newer versions

OpenSBI 1.3 an newer require the heap_size to be specified in the
sbi_platform structure, othewise the default 0 value causes a hangg at
the start. I found the problem after bisecting OpenSBI:

  # Bisect opensbi
  version = src.shortRev;
  src = builtins.fetchGit {
    url = "file:///home/Computational/rarias/riscv/opensbi";
    #rev = "908be1b85c8ff0695ea226fbbf0ff24a779cdece"; #good
    #rev = "6bc02dede86c47f87e65293b7099e9caf3b22c29"; #good
    #rev = "bbff53fe3b6cdd3c9bc084d489640d7ee2a3f831"; #bad
    #rev = "8b99a7f7d8294be29e18a667d51e13755ed2c0e0"; #good
    #rev = "bdde2ecd27af1ac158669809f6658376fb5137ab"; #good
    #rev = "5cf9a540164a018a31a679578a27eb964af0340d"; #good
    #rev = "2a04f7037317c6c5b591b160a074c700de9b3378"; #bad
    rev = "40d36a6673131e36075b1df78af4d7ab92e8cc01"; #bad
  };
This commit is contained in:
Rodrigo Arias 2024-07-01 13:28:32 +02:00
parent 14f6528318
commit 65c7eca2c8
2 changed files with 4 additions and 9 deletions

View File

@ -189,19 +189,13 @@
echo 'booti ''${kernel_addr_r} ''${ramdisk_addr_r}:''${ramdisk_size} ''${fdtcontroladdr}' >> $out
'';
# Lagarto OX doesn't work with newer versions of OpenSBI (1.3, 1.4), not
# sure why.
opensbi = prev.opensbi.overrideAttrs (old: rec {
version = "1.2"; # ok
#version = "1.3"; # bad
#version = "1.4"; # bad
version = "1.4";
src = prev.fetchFromGitHub {
owner = "riscv-software-src";
repo = "opensbi";
rev = "v${version}";
hash = "sha256-Zcl+SE2nySMycV/ozsl4AvGipRsMblA5mt3oVZ81Z44="; #1.2
#hash = "sha256-Dr16fVUGLYGnGYHkjAyqpJxt8p95F0CJIU9ESGWKGWo="; #1.3
#hash = "sha256-T8ZeAzjM9aeTXitjE7s+m+jjGGtDo2jK1qO5EuKiVLU="; #1.4
hash = "sha256-T8ZeAzjM9aeTXitjE7s+m+jjGGtDo2jK1qO5EuKiVLU=";
};
#NIX_DEBUG=5;
makeFlags = [

View File

@ -42,7 +42,7 @@ new file mode 100644
index 0000000..a359b34
--- /dev/null
+++ b/platform/fpga/ox_alveo/platform.c
@@ -0,0 +1,121 @@
@@ -0,0 +1,122 @@
+#include <sbi/riscv_asm.h>
+#include <sbi/riscv_encoding.h>
+#include <sbi/sbi_const.h>
@ -162,5 +162,6 @@ index 0000000..a359b34
+ .features = SBI_PLATFORM_DEFAULT_FEATURES,
+ .hart_count = OX_ALVEO_HART_COUNT,
+ .hart_stack_size = SBI_PLATFORM_DEFAULT_HART_STACK_SIZE,
+ .heap_size = SBI_PLATFORM_DEFAULT_HEAP_SIZE(OX_ALVEO_HART_COUNT),
+ .platform_ops_addr = (unsigned long)&ox_alveo_ops
+};