litex-hub / linux-on-litex-vexriscv

Linux on LiteX-VexRiscv
BSD 2-Clause "Simplified" License
573 stars 174 forks source link

Support DE2-115 board #250

Closed lapnd closed 2 years ago

lapnd commented 2 years ago

Hi, I would like to try Linux with DE2-115 board and had made a change like

diff --git a/make.py b/make.py
index 339e664..625bc6e 100755
--- a/make.py
+++ b/make.py
@@ -487,6 +487,24 @@ class De0Nano(Board):
             "serial",
         }, bitstream_ext=".sof")

+# DE2-115 support ----------------------------------------------------------------------------------
+
+class De2115(Board):
+    soc_kwargs = {
+        "l2_size" : 2048          # Use Wishbone and L2 for memory accesses.
+    }
+    def __init__(self):
+        from litex_boards.targets import de2_115
+        Board.__init__(self, de2_115.BaseSoC, soc_capabilities={
+            # Communication
+            "serial"
+            #"ethernet",
+            # GPIOs
+            #"leds",
+            # Video, video_terminal
+            #"framebuffer"
+        }, bitstream_ext=".sof")
+
 # QMTECH EP4CE15 support ---------------------------------------------------------------------------

 class Qmtech_EP4CE15(Board):
@@ -540,6 +558,7 @@ supported_boards = {
     # Altera/Intel
     "de0nano":         De0Nano,
     "de10nano":        De10Nano,
+    "de2_115":          De2115,
     "qmtech_ep4ce15":  Qmtech_EP4CE15,
 }

The build and load are ok (no error show)

./make.py --board=de2_115 --cpu-count=1 --build --load

Linux images and bios also downloaded to images directory

ls images
boot.json  Image  opensbi.bin  rootfs.cpio  rv32.dtb

However, when I tried to load Linux via serial, nothing show up

# Load the Linux images over Serial
sudo chmod 0666 /dev/ttyUSB0
sudo lxterm --images=images/boot.json /dev/ttyUSB0 --speed=1e6
# Or sudo lxterm --images=images/boot.json /dev/ttyUSB0 

Or even, I tried with netboot

```sh
# Start tftp server
docker run -itd -p 0.0.0.0:69:69/udp -v $PWD/images:/var/tftpboot -i -t pghalliday/tftp

HOST_IP=192.168.1.125
BOARD_IP=192.168.1.126
BUILD=" --build "
./make.py --board=de2_115 \
          --cpu-count=1 \
          --remote-ip=$HOST_IP \
          --local-ip=$BOARD_IP \
          $BUILD  --load

sudo lxterm  /dev/ttyUSB0 --speed=1e6

Do you know what I'm missing?

Thank!

lapnd commented 2 years ago

After checking source code, I found that the built-in RS232 port is not used. I have to use GPIO Port image

image

image

However, it's still the same. Nothing showing on the console when loading image, even I have tried with smaller baud rate

lxterm --images=images/boot.json /dev/ttyUSB0 --speed=1200
lapnd commented 2 years ago

I got better results now after update the UART pin to use built-in RS232 Lxterm show weird characters

lxterm --images=images/boot.json /dev/ttyUSB0 --speed=1e6
Z1 : hhipep m>
Z1 : hhipep m>
Z1 ;!lhitep m>
Z1 : mhipep m>ls
CommAl`lop Dound

Z1 ;!mlitep>
lapnd commented 2 years ago

It's seem something wrong. If I run target board directly in this guide. The lxterm work fine https://github.com/litex-hub/litex-boards