2 years ago

#52123

test-img

Jagan Sivakumar

RISC-V FPGA Board - increase memory in DTS file

I'm working on updating FPGA board memory available within RISC-V Linux operating system from 120 MB to a higher value. The board currently has a DDR4 2GB memory chip inside it.

The DTS file's current settings for memory is shown below and it is working fine.

  memory@80000000 {
    device_type = "memory";
    reg = <0x00000000 0x80000000 0x00000000 0x10000000>;
  }

When I update the memory settings to double it as shown below, the Linux isn't booting. The DTS file configuration is printed on screen and it hangs after that step.

  memory@80000000 {
    device_type = "memory";
    reg = <0x00000000 0x80000000 0x00000000 0x20000000>;
  }

Please help me understand if I need to update anywhere else to increase the memory accessible within the Linux host.

BBL not working log

Supports F or D or both...
                          The value of mstatus id 00006000(Hex)

                                       ./((*
                                   ,(((((,
                               *((((((,
                          ./(((((((,
                      ./((((((((*
                   *(((((((((/
               .(((((((((((,
            ,((((((((((((/
          ((((((((((((((/
         .((((((((((((((/
             *(((((((((((.
                  /(((((((.
                ,.     *(((/
                    *((,     ,/.
                      ((((((/.
                       ((((((((((/
                        (((((((((((((/
                        ((((((((((((((.
                       ((((((((((((/
                     *((((((((((*
                   ((((((((((.
                /((((((((*
             *(((((((,
          *((((((.
      .(((((.
  ./(((*
  .
                    SHAKTI PROCESSORS
 {
  #address-cells = <0x00000002>;
  #size-cells = <0x00000002>;
  compatible = "shakti,spike-bare-dev";
  model = "shakti,spike-bare";
  cpus {
    #address-cells = <0x00000001>;
    #size-cells = <0x00000000>;
    timebase-frequency = <0x00008000>;
    cpu@0 {
      device_type = "cpu";
      reg = <0x00000000>;
      status = "okay";
      compatible = "riscv";
      riscv,isa = "rv64imafdc";
      mmu-type = "riscv,sv39";
      clock-frequency = <0x02faf080>;
      interrupt-controller {
        #interrupt-cells = <0x00000001>;
        interrupt-controller;
        compatible = "riscv,cpu-intc";
        phandle = <0x00000001>;
      }
    }
  }
  memory@80000000 {
    device_type = "memory";
    reg = <0x00000000 0x80000000 0x00000000 0x20000000>;
  }
  soc {
    #address-cells = <0x00000002>;
    #size-cells = <0x00000002>;
    compatible = "shakti,spike-bare-soc", "simple-bus";
    ranges;
    interrupt-controller@c000000 {
      #interrupt-cells = <0x00000002>;
      compatible = "riscv,plic0";
      interrupt-controller;
      reg = <0x00000000 0x0c000000 0x00000000 0x04000000>;
      interrupts-extended = <0x00000001 0xffffffff 0x00000001 0x00000009>;
      reg-names = "control";
      riscv,max-priority = <0x00000007>;
      riscv,ndev = <0x0000001d>;
      phandle = <0x00000002>;
    }
    ethernet@44000 {
      #address-cells = <0x00000002>;
      #size-cells = <0x00000002>;
      device_type = "network";
      compatible = <0x786c6e78 0x2c787073 0x2d657468 0x65726e65 0x746c6974 0x652d332e 0x30302e61 0x00786c6e 0x782c7870 0x732d6574 0x6865726e 0x65746c69 0x74652d31 0x2e30302e>;
      interrupt-parent = <0x00000002>;
      interrupts = <0x0000001d 0x00000001>;
      local-mac-address = <0x000a3500>;
      phy-handle = <0x00000003>;
      reg = <0x00000000 0x00044000 0x00000000 0x00004000>;
      xlnx,duplex = <0x00000001>;
      xlnx,include-global-buffers = <0x00000001>;
      xlnx,include-internal-loopback = <0x00000001>;
      xlnx,include-mdio = <0x00000001>;
      xlnx,instance = <0x6178695f 0x65746865 0x726e6574 0x6c697465 0x5f696e73>;
      xlnx,rx-ping-pong = <0x00000001>;
      xlnx,s-axi-id-width = <0x00000001>;
      xlnx,tx-ping-pong = <0x00000001>;
      threshold = <0x00000040>;
      sensitivity = <0x00000006>;
      mdio {
        #address-cells = <0x00000001>;
        #size-cells = <0x00000000>;
        phy@1 {
          device_type = "ethernet-phy";
          compatible = <0x65746865 0x726e6574 0x2d706879 0x2d696565 0x65383032 0x2e332d63>;
          ti,rx-internal-delay = <0x3b9aca00>;
          ti,tx-internal-delay = <0x3b9aca00>;
          ti,fifo-depth = <0x00001000>;
          reg = <0x00000001>;
          status = "okay";
          phandle = <0x00000003>;
        }
      }
    }
    oscillator {
      #clock-cells = <0x00000000>;
      compatible = "fixed-clock";
      clock-frequency = <0x02faf080>;
      phandle = <0x00000004>;
    }
    spi@20100 {
      compatible = "shakti,spi1";
      reg = <0x00000000 0x00020100 0x00000000 0x00000100>;
      clocks = <0x00000004>;
      shakti,controller = <0x00000001>;
      shakti,spi-frequency = <0x001e8480>;
      shakti,lsb-first = <0x00000000>;
      shakti,communication-mode = <0x00000003>;
      shakti,cpha = <0x00000000>;
      shakti,cpol = <0x00000000>;
      shakti,cs-high = <0x00000001>;
      shakti,fifo-depth = <0x0000001f>;
      mmc-slot@0 {
        compatible = "mmc-spi-slot";
        reg = <0x00000000>;
        voltage-ranges = <0x00000ce4 0x00000ce4>;
        spi-max-frequency = <0x002625a0>;
      }
    }
    uart@11300 {
      compatible = "shakti,uart0";
      reg = <0x00000000 0x00011300 0x00000000 0x00000100>;
    }
    uart@11400 {
      compatible = "shakti,uart1";
      reg = <0x00000000 0x00011400 0x00000000 0x00000100>;
    }
  }
}
The value of mstatus at the enter of enter_supervisor_mode is 0000000b(Hex)
                                                                           The value of mstatus id 0000280b(Hex)

BBL working log

Supports F or D or both...
                          The value of mstatus id 00006000(Hex)

                                       ./((*
                                   ,(((((,
                               *((((((,
                          ./(((((((,
                      ./((((((((*
                   *(((((((((/
               .(((((((((((,
            ,((((((((((((/
          ((((((((((((((/
         .((((((((((((((/
             *(((((((((((.
                  /(((((((.
                ,.     *(((/
                    *((,     ,/.
                      ((((((/.
                       ((((((((((/
                        (((((((((((((/
                        ((((((((((((((.
                       ((((((((((((/
                     *((((((((((*
                   ((((((((((.
                /((((((((*
             *(((((((,
          *((((((.
      .(((((.
  ./(((*
  .
                    SHAKTI PROCESSORS
 {
  #address-cells = <0x00000002>;
  #size-cells = <0x00000002>;
  compatible = "shakti,spike-bare-dev";
  model = "shakti,spike-bare";
  cpus {
    #address-cells = <0x00000001>;
    #size-cells = <0x00000000>;
    timebase-frequency = <0x00008000>;
    cpu@0 {
      device_type = "cpu";
      reg = <0x00000000>;
      status = "okay";
      compatible = "riscv";
      riscv,isa = "rv64imafdc";
      mmu-type = "riscv,sv39";
      clock-frequency = <0x02faf080>;
      interrupt-controller {
        #interrupt-cells = <0x00000001>;
        interrupt-controller;
        compatible = "riscv,cpu-intc";
        phandle = <0x00000001>;
      }
    }
  }
  memory@80000000 {
    device_type = "memory";
    reg = <0x00000000 0x80000000 0x00000000 0x10000000>;
  }
  soc {
    #address-cells = <0x00000002>;
    #size-cells = <0x00000002>;
    compatible = "shakti,spike-bare-soc", "simple-bus";
    ranges;
    interrupt-controller@c000000 {
      #interrupt-cells = <0x00000002>;
      compatible = "riscv,plic0";
      interrupt-controller;
      reg = <0x00000000 0x0c000000 0x00000000 0x04000000>;
      interrupts-extended = <0x00000001 0xffffffff 0x00000001 0x00000009>;
      reg-names = "control";
      riscv,max-priority = <0x00000007>;
      riscv,ndev = <0x0000001d>;
      phandle = <0x00000002>;
    }
    ethernet@44000 {
      #address-cells = <0x00000002>;
      #size-cells = <0x00000002>;
      device_type = "network";
      compatible = <0x786c6e78 0x2c787073 0x2d657468 0x65726e65 0x746c6974 0x652d332e 0x30302e61 0x00786c6e 0x782c7870 0x732d6574 0x6865726e 0x65746c69 0x74652d31 0x2e30302e>;
      interrupt-parent = <0x00000002>;
      interrupts = <0x0000001d 0x00000001>;
      local-mac-address = <0x000a3500>;
      phy-handle = <0x00000003>;
      reg = <0x00000000 0x00044000 0x00000000 0x00004000>;
      xlnx,duplex = <0x00000001>;
      xlnx,include-global-buffers = <0x00000001>;
      xlnx,include-internal-loopback = <0x00000001>;
      xlnx,include-mdio = <0x00000001>;
      xlnx,instance = <0x6178695f 0x65746865 0x726e6574 0x6c697465 0x5f696e73>;
      xlnx,rx-ping-pong = <0x00000001>;
      xlnx,s-axi-id-width = <0x00000001>;
      xlnx,tx-ping-pong = <0x00000001>;
      threshold = <0x00000040>;
      sensitivity = <0x00000006>;
      mdio {
        #address-cells = <0x00000001>;
        #size-cells = <0x00000000>;
        phy@1 {
          device_type = "ethernet-phy";
          compatible = <0x65746865 0x726e6574 0x2d706879 0x2d696565 0x65383032 0x2e332d63>;
          ti,rx-internal-delay = <0x3b9aca00>;
          ti,tx-internal-delay = <0x3b9aca00>;
          ti,fifo-depth = <0x00001000>;
          reg = <0x00000001>;
          status = "okay";
          phandle = <0x00000003>;
        }
      }
    }
    oscillator {
      #clock-cells = <0x00000000>;
      compatible = "fixed-clock";
      clock-frequency = <0x02faf080>;
      phandle = <0x00000004>;
    }
    spi@20100 {
      compatible = "shakti,spi1";
      reg = <0x00000000 0x00020100 0x00000000 0x00000100>;
      clocks = <0x00000004>;
      shakti,controller = <0x00000001>;
      shakti,spi-frequency = <0x001e8480>;
      shakti,lsb-first = <0x00000000>;
      shakti,communication-mode = <0x00000003>;
      shakti,cpha = <0x00000000>;
      shakti,cpol = <0x00000000>;
      shakti,cs-high = <0x00000001>;
      shakti,fifo-depth = <0x0000001f>;
      mmc-slot@0 {
        compatible = "mmc-spi-slot";
        reg = <0x00000000>;
        voltage-ranges = <0x00000ce4 0x00000ce4>;
        spi-max-frequency = <0x002625a0>;
      }
    }
    uart@11300 {
      compatible = "shakti,uart0";
      reg = <0x00000000 0x00011300 0x00000000 0x00000100>;
    }
    uart@11400 {
      compatible = "shakti,uart1";
      reg = <0x00000000 0x00011400 0x00000000 0x00000100>;
    }
  }
}
The value of mstatus at the enter of enter_supervisor_mode is 0000000b(Hex)
                                                                           The value of mstatus id 0000280b(Hex)
                                                                                                                [    0.000000] OF: fdt: No chosen node found, continuing without
[    0.000000] OF: fdt: Ignoring memory range 0x80000000 - 0x80200000
[    0.000000] Linux version 5.5.0-rc1-00033-gbe72b08baf43 (socv1@socv1-OptiPlex-7450-AIO) (gcc version 11.1.0 (GCC)) #1 Sun Jan 16 22:16:01 IST 2022
[    0.000000] initrd not found or empty - disabling initrd
[    0.000000] Zone ranges:
[    0.000000]   DMA32    [mem 0x0000000080200000-0x000000008fffffff]
[    0.000000]   Normal   empty
[    0.000000] Movable zone start for each node
[    0.000000] Early memory node ranges
[    0.000000]   node   0: [mem 0x0000000080200000-0x000000008fffffff]
[    0.000000] Initmem setup node 0 [mem 0x0000000080200000-0x000000008fffffff]
[    0.000000] software IO TLB: mapped [mem 0x8bc7c000-0x8fc7c000] (64MB)
[    0.000000] elf_hwcap is 0x112d
[    0.000000] Built 1 zonelists, mobility grouping on.  Total pages: 64135
[    0.000000] Kernel command line: 
[    0.000000] Dentry cache hash table entries: 32768 (order: 6, 262144 bytes, linear)
[    0.000000] Inode-cache hash table entries: 16384 (order: 5, 131072 bytes, linear)
[    0.000000] Sorting __ex_table...
[    0.000000] mem auto-init: stack:off, heap alloc:off, heap free:off
[    0.000000] Memory: 174816K/260096K available (3796K kernel code, 196K rwdata, 684K rodata, 10412K init, 233K bss, 85280K reserved, 0K cma-reserved)
[    0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
[    0.000000] NR_IRQS: 0, nr_irqs: 0, preallocated irqs: 0
[    0.000000] plic: mapped 29 interrupts with 1 handlers for 2 contexts.
[    0.000000] riscv_timer_init_dt: Registering clocksource cpuid [0] hartid [0]
[    0.000000] clocksource: riscv_clocksource: mask: 0xffffffffffffffff max_cycles: 0x1ef4687b1, max_idle_ns: 112843571739654 ns
[    0.001098] sched_clock: 64 bits at 32kHz, resolution 30517ns, wraps every 70368744171142ns
[    5.886962] printk: console [hvc0] enabled
[    6.034759] Calibrating delay loop (skipped), value calculated using timer frequency.. 0.06 BogoMIPS (lpj=131)
[    6.390838] pid_max: default: 32768 minimum: 301
[    6.591644] Mount-cache hash table entries: 512 (order: 0, 4096 bytes, linear)
[    6.814727] Mountpoint-cache hash table entries: 512 (order: 0, 4096 bytes, linear)
[    7.330780] devtmpfs: initialized
[    7.723510] random: get_random_bytes called from setup_net+0x54/0x1e4 with crng_init=0
[    7.984283] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 7645041785100000 ns
[    8.305999] futex hash table entries: 256 (order: 0, 6144 bytes, linear)
[    8.595031] NET: Registered protocol family 16
[    9.673400] clocksource: Switched to clocksource riscv_clocksource
[   10.141082] NET: Registered protocol family 2
[   10.359191] tcp_listen_portaddr_hash hash table entries: 256 (order: 0, 4096 bytes, linear)
[   10.652008] TCP established hash table entries: 2048 (order: 2, 16384 bytes, linear)
[   10.929992] TCP bind hash table entries: 2048 (order: 2, 16384 bytes, linear)
[   11.179870] TCP: Hash tables configured (established 2048 bind 2048)
[   11.415313] UDP hash table entries: 256 (order: 1, 8192 bytes, linear)
[   11.634307] UDP-Lite hash table entries: 256 (order: 1, 8192 bytes, linear)
[   11.917968] NET: Registered protocol family 1
[   29.714111] workingset: timestamp_bits=62 max_order=16 bucket_order=0
[   36.863281] ntfs: driver 2.1.32 [Flags: R/W DEBUG].
[   37.198394] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 254)
[   37.448181] io scheduler mq-deadline registered
[   37.595520] io scheduler kyber registered
[   37.829956] io scheduler bfq registered
[   50.317749] shakti_spi 20100.spi: Shakti SPI Driver initialized
[   50.749816] libphy: Fixed MDIO Bus: probed
[   50.889617] xilinx_emaclite 44000.ethernet: Device Tree Probing
[   51.119598] libphy: Xilinx Emaclite MDIO: probed
[   51.293762] xilinx_emaclite 44000.ethernet: MAC address is now 00:0a:35:00:00:00
[   51.678558] xilinx_emaclite 44000.ethernet: Xilinx EmacLite at 0x00044000 mapped to 0x04008000, irq=29
[   52.164031] mmc_spi spi0.0: SD/MMC host mmc0, no DMA, no WP, no poweroff, cd polling
[   52.521148] NET: Registered protocol family 17
[   54.543609] Freeing unused kernel memory: 10412K
[   54.675720] This architecture does not have kernel memory protection.
[   54.921173] Run /init as init process
[   55.446960] mmc0: host does not support reading read-only switch, assuming write-enable
[   55.725402] mmc0: new SDXC card on SPI
[   56.422027] mmcblk0: mmc0:0000 SD64G 59.5 GiB 
[   57.577026]  mmcblk0: p1 p2
Starting syslogd: OK
Starting klogd: OK
Running sysctl: OK
Starting mdev... OK
modprobe: can't change directory to '/lib/modules': No such file or directory
Saving random seed: [  361.256164] random: dd: uninitialized urandom read (512 bytes read)
OK
Starting network plug daemon: /etc/netplug.d/netplug eth0 probe -> pid 68
[  367.193572] xilinx_emaclite 44000.ethernet eth0: Link is Down
/etc/netplug.d/netplug eth1 probe -> pid 69
/etc/netplug.d/netplug eth2 probe -> pid 70
/etc/netplug.d/netplug eth3 probe -> pid 71
/etc/netplug.d/netplug eth4 probe -> pid 72
/etc/netplug.d/netplug eth5 probe -> pid 73
/etc/netplug.d/netplug eth6 probe -> pid 74
/etc/netplug.d/netplug eth7 probe -> pid 75
/etc/netplug.d/netplug eth8 probe -> pid 76
/etc/netplug.d/netplug eth9 probe -> pid 77
/etc/netplug.d/netplug eth10 probe -> pid 78
/etc/netplug.d/netplug eth11 probe -> pid 79
/etc/netplug.d/netplug eth12 probe -> pid 80
[  387.032012] xilinx_emaclite 44000.ethernet eth0: Link is Up - 100Mbps/Full - flow control off
/etc/netplug.d/netplug eth13 probe -> pid 81
/etc/netplug.d/netplug eth14 probe -> pid 82
/etc/netplug.d/netplug eth15 probe -> pid 83

Starting network: OK
Starting dropbear sshd: OK

Welcome to Buildroot

memory

ram

riscv

device-tree

0 Answers

Your Answer

Accepted video resources