Code Monkey home page Code Monkey logo

linux-on-litex-vexriscv's Introduction

                                   __   _
                                  / /  (_)__  __ ____ __
                                 / /__/ / _ \/ // /\ \ /
                                /____/_/_//_/\_,_//_\_\
                                      / _ \/ _ \
                      __   _ __      _\___/_//_/ __             _
                     / /  (_) /____ | |/_/__| | / /____ __ ____(_)__ _____  __
                    / /__/ / __/ -_)>  </___/ |/ / -_) \ // __/ (_-</ __/ |/ /
                   /____/_/\__/\__/_/|_|    |___/\__/_\_\/_/ /_/___/\__/|___/

                   Copyright (c) 2019-2022, Linux-on-LiteX-VexRiscv Developers

License

Note: Tested on Ubuntu 18.04/20.04 LTS.

[> Intro

This project is an experiment to run Linux with VexRiscv-SMP CPU, a 32-bits Linux Capable RISC-V CPU written in Spinal HDL. LiteX is used to create the SoC around the VexRiscv-SMP CPU and provides the infrastructure and peripherals (LiteDRAM, LiteEth, LiteSDCard, etc...). All the components used to create the SoC are open-source and the flexibility of Spinal HDL/LiteX allow targeting easily very various FPGA devices/boards: Xilinx, Intel, Lattice, Microsemi, Efinix FPGAs are tested with very various configuration: SDRAM/DDR/DDR2/DDR3/DDR4 or HyperRAM RAMs, RMII/MII/RGMII/1000BASE-X Ethernet PHYs, SDCard (in SPI or SD mode), SATA, PCIe, etc...

On Lattice ECP5 FPGAs, the open source toolchain even allows creating full open-source SoC with open-source cores and toolchain!

This project demonstrates how high level HDLs framework like Spinal HDL, LiteX can enable new possibilities and complement each other. Results shown here are the results of a productive collaboration between various open-source communities.

[> Demo

litex_acorn_baseboard_linux.mp4

[> Supported boards

All boards supported in LiteX-Boards with...:

  • Enough FPGA logic to fit VexRiscv-SMP + LiteX SoC.
  • 32MB of RAM (Reduced to 8MB when rootfs can be put on a SDCard).
  • A UART.

... could run this project.

The board support is directly imported from LiteX-Boards and the configuration is just adapted for the project in make.py.

The current list of boards that have been tested and are supported can be obtained by running ./make.py --help:

├── acorn
├── acorn_pcie
├── alveo_u250
├── alveo_u280
├── arty
├── arty_a7
├── arty_s7
├── butterstick
├── camlink_4k
├── colorlight_i5
├── de0nano
├── de10nano
├── de1soc
├── ecpix5
├── genesys2
├── hadbadge
├── icesugar_pro
├── kc705
├── kcu105
├── machdyne_konfekt
├── machdyne_noir
├── machdyne_schoko
├── minispartan6
├── mnt_rkx7
├── netv2
├── nexys4ddr
├── nexys_video
├── orangecrab
├── pipistrello
├── qmtech_ep4ce15
├── qmtech_ep4ce55
├── qmtech_wukong
├── sds1104xe
├── stlv7325
├── titanium_ti60_f225_dev_kit
├── trellisboard
├── trion_t120_bga576_dev_kit
├── ulx3s
├── vc707
├── versa_ecp5
├── xcu1525
├── zcu104

Adding support for another board from LiteX-Boards satisfying the requirements should only be a matter of adding a few lines to make.py.

Note: Avalanche support can be found in RISC-V - Getting Started Guide thanks to Antmicro.

Note: On FPGA without distributed ram (as Cyclone IV), consider using the --without-out-of-order-decoder option to reduce area.

[> Prerequisites

$ sudo apt install build-essential device-tree-compiler wget git python3-setuptools
$ git clone https://github.com/litex-hub/linux-on-litex-vexriscv
$ cd linux-on-litex-vexriscv

[> Pre-built Bitstreams and Linux/OpenSBI images

Pre-built bistreams for the common boards and pre-built Linux images can be found here and will get you started quickly and easily without the need to compile anything.

[> Installing LiteX

$ wget https://raw.githubusercontent.com/enjoy-digital/litex/master/litex_setup.py
$ chmod +x litex_setup.py
$ ./litex_setup.py --init --install --user (--user to install to user directory)

For more information, please visit: https://github.com/enjoy-digital/litex/wiki/Installation

[> Installing a RISC-V toolchain

$ wget https://static.dev.sifive.com/dev-tools/riscv64-unknown-elf-gcc-8.1.0-2019.01.0-x86_64-linux-ubuntu14.tar.gz
$ tar -xvf riscv64-unknown-elf-gcc-8.1.0-2019.01.0-x86_64-linux-ubuntu14.tar.gz
$ export PATH=$PATH:$PWD/riscv64-unknown-elf-gcc-8.1.0-2019.01.0-x86_64-linux-ubuntu14/bin/

[> Installing SBT (Only required for custom CPU configs)

Some regular VexRiscv-smp configuration are already pregenerated, but for others, it need to run som SpinalHDL hardware generation, which require sbt.

Please visit: https://www.scala-sbt.org/1.x/docs/Installing-sbt-on-Linux.html#Installing+sbt+on+Linux

[> Installing Verilator (only needed for simulation)

$ sudo apt install verilator
$ sudo apt install libevent-dev libjson-c-dev

Check that the installed verilator version is >= 4.2xx. If not, you will have to compile it from sources.

[> Installing OpenOCD (only needed for hardware test)

$ sudo apt install libtool automake pkg-config libusb-1.0-0-dev
$ git clone https://github.com/ntfreak/openocd.git
$ cd openocd
$ ./bootstrap
$ ./configure --enable-ftdi
$ make
$ sudo make install

[> Running the LiteX simulation

You need to extract linux_???.zip from #164 into the images folder first, then :

$ ./sim.py

You should see Linux booting and be able to interact with it:

        __   _ __      _  __
       / /  (_) /____ | |/_/
      / /__/ / __/ -_)>  <
     /____/_/\__/\__/_/|_|

 (c) Copyright 2012-2019 Enjoy-Digital
 (c) Copyright 2012-2015 M-Labs Ltd

 BIOS built on May  2 2019 18:58:54
 BIOS CRC passed (97ea247b)

--============ SoC info ================--
CPU:       VexRiscv @ 1MHz
ROM:       32KB
SRAM:      4KB
MAIN-RAM:  131072KB

--========= Peripherals init ===========--

--========== Boot sequence =============--
Booting from serial...
Press Q or ESC to abort boot completely.
sL5DdSMmkekro
Timeout
Executing booted program at 0x20000000
--============= Liftoff! ===============--
VexRiscv Machine Mode software built May  3 2019 19:33:43
--========== Booting Linux =============--
[    0.000000] No DTB passed to the kernel
[    0.000000] Linux version 5.0.9 (florent@lab) (gcc version 8.3.0 (Buildroot 2019.05-git-00938-g75f9fcd0c9)) #1 Thu May 2 17:43:30 CEST 2019
[    0.000000] Initial ramdisk at: 0x(ptrval) (8388608 bytes)
[    0.000000] Zone ranges:
[    0.000000]   Normal   [mem 0x00000000c0000000-0x00000000c7ffffff]
[    0.000000] Movable zone start for each node
[    0.000000] Early memory node ranges
[    0.000000]   node   0: [mem 0x00000000c0000000-0x00000000c7ffffff]
[    0.000000] Initmem setup node 0 [mem 0x00000000c0000000-0x00000000c7ffffff]
[    0.000000] elf_hwcap is 0x1100
[    0.000000] Built 1 zonelists, mobility grouping on.  Total pages: 32512
[    0.000000] Kernel command line: mem=128M@0x40000000 rootwait console=hvc0 root=/dev/ram0 init=/sbin/init swiotlb=32
[    0.000000] Dentry cache hash table entries: 16384 (order: 4, 65536 bytes)
[    0.000000] Inode-cache hash table entries: 8192 (order: 3, 32768 bytes)
[    0.000000] Sorting __ex_table...
[    0.000000] Memory: 119052K/131072K available (1957K kernel code, 92K rwdata, 317K rodata, 104K init, 184K bss, 12020K 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] clocksource: riscv_clocksource: mask: 0xffffffffffffffff max_cycles: 0x114c1bade8, max_idle_ns: 440795203839 ns
[    0.000155] sched_clock: 64 bits at 75MHz, resolution 13ns, wraps every 2199023255546ns
[    0.001515] Console: colour dummy device 80x25
[    0.008297] printk: console [hvc0] enabled
[    0.009219] Calibrating delay loop (skipped), value calculated using timer frequency.. 150.00 BogoMIPS (lpj=300000)
[    0.009919] pid_max: default: 32768 minimum: 301
[    0.016255] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes)
[    0.016802] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes)
[    0.044297] devtmpfs: initialized
[    0.061343] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 7645041785100000 ns
[    0.061981] futex hash table entries: 256 (order: -1, 3072 bytes)
[    0.117611] clocksource: Switched to clocksource riscv_clocksource
[    0.251970] Unpacking initramfs...
[    2.005474] workingset: timestamp_bits=30 max_order=15 bucket_order=0
[    2.178440] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 254)
[    2.178909] io scheduler mq-deadline registered
[    2.179271] io scheduler kyber registered
[    3.031140] random: get_random_bytes called from init_oops_id+0x4c/0x60 with crng_init=0
[    3.043743] Freeing unused kernel memory: 104K
[    3.044070] This architecture does not have kernel memory protection.
[    3.044472] Run /init as init process
mount: mounting tmpfs on /dev/shm failed: Invalid argument
mount: mounting tmpfs on /tmp failed: Invalid argument
mount: mounting tmpfs on /run failed: Invalid argument
Starting syslogd: OK
Starting klogd: OK
Initializing random number generator... [    4.374589] random: dd: uninitialized urandom read (512 bytes read)
done.
Starting network: ip: socket: Function not implemented
ip: socket: Function not implemented
FAIL


Welcome to Buildroot
buildroot login: root
login[48]: root login on 'hvc0'
# help
Built-in commands:
------------------
  . : [ [[ alias bg break cd chdir command continue echo eval exec
  exit export false fg getopts hash help history jobs kill let
  local printf pwd read readonly return set shift source test times
  trap true type ulimit umask unalias unset wait
#

[> Running on hardware

Build the FPGA bitstream (optional)

The prebuilt bitstreams for the supported boards are provided, so you can just use them for quick testing, if you want to rebuild the bitstreams you will need to install the toolchain for your FPGA:

FPGA family Toolchain
Xilinx Ultrascale Vivado
Xilinx 7-Series Vivado/SymbiFlow*
Xilinx Spartan6 ISE
Lattice ECP5 Yosys+Trellis+Nextpnr
Altera Cyclone4 Quartus Prime

Once installed, build the bitstream with:

$ ./make.py --board=XXYY --cpu-count=X --build

Note: *=to select a different toolchain use the --toolchain option, i.e.:

./make.py --board=arty --toolchain=symbiflow --build

Load the FPGA bitstream

To load the bitstream to you board, run:

$ ./make.py --board=XXYY --cpu-count=X --load

Note: If you are using a Versa board, you will need to change J50 to bypass the iSPclock. Re-arrange the jumpers to connect pins 1-2 and 3-5 (leaving one jumper spare). See p19 of the Versa Board user guide.

Load the Linux images over Serial

All the boards support Serial loading of the Linux images and this is the only way to load them when the board does not have others communications interfaces or storage capability.

To load the Linux images over Serial, use the litex_term terminal/tool provided by LiteX and run:

$ litex_term --images=images/boot.json /dev/ttyUSBX (--safe : In case of CRC Error, slower but should always work)

The images should load and you should see Linux booting :)

Note: litex_term is automatically installed with LiteX.

Note: By default baudrate is set to 115200 bauds. You can use --uart-baudrate argument of make.py to increase it on the board and use --speed argument of litex_term to reflect the change. This is useful to increase upload speed when binaries can only be uploaded over Serial.

Note: Since on some boards JTAG/Serial is shared, when you will run litex_term after loading the board, the BIOS serialboot will already have timed out. You will need to press Enter, see if you have the BIOS prompt and type reboot.

Since loading over Serial is working for all boards, this is the recommended way to do initial tests even if your board has more capabilities.

Load the Linux images over Ethernet

For boards with Ethernet support, the Linux images can be loaded over TFTP. You need to copy the files from images directory to your TFTP root directory. The default Local IP/Remote IP are 192.168.1.50/192.168.1.100 but you can change it with the --local-ip and --remote-ip arguments.

Once the bistream is loaded, the board you try to retrieve the files on the TFTP server. If not successful or if the boot already timed out when you see the BIOS prompt, you can retry with the netboot command.

The images will be loaded to RAM and you should see Linux booting :)

Load the Linux images to SDCard

For boards with SDCard support, the Linux images can be loaded from it. You need to copy the files from images directory to your SDCard root directory (with a FAT partition).

The images will be loaded to RAM and you should see Linux booting :)

Note: For more information about the possible ways to load application code to the CPU with LiteX, please have a look at the LiteX's wiki.

Configure/Use the peripherals

Please visit the HOWTO document to learn how to configure and use the peripherals from Linux.

[> Generating the Linux binaries (optional)

$ git clone http://github.com/buildroot/buildroot
$ cd buildroot
$ make BR2_EXTERNAL=../linux-on-litex-vexriscv/buildroot/ litex_vexriscv_defconfig
$ make

The binaries are located in output/images/ and images/.

[> Generating the Linux binaries with USB host support (optional)

$ git clone http://github.com/buildroot/buildroot
$ cd buildroot
$ make BR2_EXTERNAL=../linux-on-litex-vexriscv/buildroot/ litex_vexriscv_usbhost_defconfig
$ make

The binaries are located in output/images/ and images/.

[> Generating the OpenSBI binary (optional / part of the buildroot build sequence)

$ git clone https://github.com/litex-hub/opensbi --branch 1.3.1-linux-on-litex-vexriscv
$ cd opensbi
$ make CROSS_COMPILE=riscv-none-embed- PLATFORM=litex/vexriscv

The binary will be located at build/platform/litex/vexriscv/firmware/fw_jump.bin.

[> Generating the VexRiscv Linux variant (optional)

If the VexRiscv configuration you ask isn't already generated, you will need to install java and SBT on your machine to enable their local on demande generation.

To install java and SBT see Install VexRiscv requirements: https://github.com/enjoy-digital/VexRiscv-verilog#requirements

[> Udev rules (optional)

Not needed but can make loading/flashing bitstreams easier:

$ git clone https://github.com/litex-hub/litex-buildenv-udev
$ cd litex-buildenv-udev
$ make install
$ make reload

linux-on-litex-vexriscv's People

Contributors

baselsayeh avatar craviee avatar dolu1990 avatar enjoy-digital avatar fkokosinski avatar frantony avatar futaris avatar gatecat avatar geertu avatar guztech avatar inc avatar japm48 avatar kamilrakoczy avatar kazkojima avatar lpawelcz avatar mateusz-holenko avatar megele avatar mglb avatar mithro avatar msloniewski avatar pdp7 avatar rw1nkler avatar sajattack avatar sanadashinken avatar sebeaumont avatar tilk avatar trabucayre avatar troibe avatar wtfuzz avatar zguig52 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

linux-on-litex-vexriscv's Issues

Linux does not boot up

Running Sim.py n Ubuntu 18.04 machine does not boot up the Linux o. It stops at Booting Linux line:

    __   _ __      _  __
   / /  (_) /____ | |/_/
  / /__/ / __/ -_)>  <
 /____/_/\__/\__/_/|_|

(c) Copyright 2012-2019 Enjoy-Digital
(c) Copyright 2007-2015 M-Labs Ltd

BIOS built on Sep 20 2019 18:48:03
BIOS CRC passed (be166f00)

Migen git sha1: 57a7311
LiteX git sha1: 8b7d8217

--============ SoC info ================--
CPU: VexRiscv @ 1MHz
ROM: 32KB
SRAM: 4KB
MAIN-RAM: 32768KB

--========= Peripherals init ===========--

--========== Boot sequence =============--
Booting from serial...
Press Q or ESC to abort boot completely.
sL5DdSMmkekro
Timeout
Executing booted program at 0x20000000
--============= Liftoff! ===============--
VexRiscv Machine Mode software built Sep 20 2019 18:48:01
--========== Booting Linux =============--


 

modify spi flash dummy bytes

Related to litex-hub/litex-boards#35

The hadbadge is using 32MB SDRAM:
Winbond W25Q128JVSIQ 128 Mbit NOR flash chip

It requires 8 dummy clocks:
Screenshot from 2020-02-03 02-00-47

However, SoCLinux is set to use 11 dummy clocks, so I have to change it to 8:

diff --git a/soc_linux.py b/soc_linux.py
index 98f6d7e..8657cf4 100644
--- a/soc_linux.py
+++ b/soc_linux.py
@@ -66,7 +66,7 @@ def SoCLinux(soc_cls, **kwargs):
             spiflash_pads = self.platform.request("spiflash4x")
             self.submodules.spiflash = SpiFlash(
                 spiflash_pads,
-                dummy=11,
+                dummy=8,
                 div=2,
                 with_bitbang=True,
                 endianness=self.cpu.endianness)

Is there a way for me to change this just for hadbadge and not effect other boards?

KeyError: 'ethphy' on kcu105 build

https://travis-ci.com/litex-hub/linux-on-litex-vexriscv/jobs/277668500

make: Leaving directory '/home/travis/build/litex-hub/linux-on-litex-vexriscv/build/kcu105/software/bios'
Traceback (most recent call last):
  File "./json2dts.py", line 144, in <module>
    """.format(ethphy_csr_base=d["csr_bases"]["ethphy"],
KeyError: 'ethphy'
Traceback (most recent call last):
  File "./make.py", line 332, in <module>
    main()
  File "./make.py", line 321, in main
    soc.generate_dts(board_name)
  File "/home/travis/build/litex-hub/linux-on-litex-vexriscv/soc_linux.py", line 158, in generate_dts
    "./json2dts.py {} > {}".format(json, dts), shell=True)
  File "/home/travis/conda/envs/linux-on-litex-vexriscv/lib/python3.7/subprocess.py", line 363, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command './json2dts.py build/kcu105/csr.json > build/kcu105/kcu105.dts' returned non-zero exit status 1.
The command "./make.py --board="$BOARD"" exited with 1.

Linux doesn't boot on KC705 with the generated emulator.bin file

Hi,

The board I'm testing is KC705.

At beginning I followed the steps according the steps in repo's README.

I did the "Pre-built Bitstreams/Linux images" step. i.e.

$ git clone https://github.com/enjoy-digital/linux-on-litex-vexriscv-prebuilt
$ cp -r linux-on-litex-vexriscv-prebuilt/* linux-on-litex-vexriscv

Then I built the bitstream:

$ ./make.py --board=kc705 --build

Then loaded the bitstream to the board.

$ ./make.py --board=kc705 --load

It works fine. Now load Linux Image.

$ lxterm --images=images.json /dev/ttyUSB0 --speed=921600 --no-crc

Note: I changed the baudrate in soc_linux.py (line 97) from 1e6 to 921600 (The maximum baudrate CP2103 listed in its datasheet)

Now press the RESET button, KC705 starts to eat the bits, after the transmission finished, it stopped at this position:

--============= Liftoff! ===============--
VexRiscv Machine Mode software built Sep 25 2019 10:40:12
--========== Booting Linux =============--
[    0.000000] No DT

I then did some experiments. At the end I found that if only copy emulator.bin in the prebuilt folder to overwrite the new one, then execute the "Load the Linux images over Serial" step again, it boots!

$ cp linux-on-litex-vexriscv-prebuilt/emulator/emulator.bin linux-on-litex-vexriscv/emulator/

I'm not sure if this is a bug or not. But it works for me.

SPI Boot fails on Arty7

I have a REVC Arty735T with a 25q125a Flash...

The flash process seems to proceed fine:

[sahaj@fedora-work linux-on-litex-vexriscv]$ ./make.py --board=arty --flash
make: Entering directory '/data/linux-on-litex-vexriscv/build/arty/software/libcompiler_rt'
make: Nothing to be done for 'all'.
make: Leaving directory '/data/linux-on-litex-vexriscv/build/arty/software/libcompiler_rt'
make: Entering directory '/data/linux-on-litex-vexriscv/build/arty/software/libbase'
 CC       exception.o
 CC       system.o
 CC       id.o
 CC       uart.o
 CC       time.o
 CC       spiflash.o
 CC       mdio.o
 AR       libbase.a
 AR       libbase-nofloat.a
make: Leaving directory '/data/linux-on-litex-vexriscv/build/arty/software/libbase'
make: Entering directory '/data/linux-on-litex-vexriscv/build/arty/software/libnet'
 CC       microudp.o
 AR       libnet.a
make: Leaving directory '/data/linux-on-litex-vexriscv/build/arty/software/libnet'
make: Entering directory '/data/linux-on-litex-vexriscv/build/arty/software/bios'
 CC       isr.o
 CC       sdram.o
 CC       main.o
 CC       boot.o
 LD       bios.elf
chmod -x bios.elf
 OBJCOPY  bios.bin
chmod -x bios.bin
python3 -m litex.soc.software.mkmscimg bios.bin --little
make: Leaving directory '/data/linux-on-litex-vexriscv/build/arty/software/bios'
build/arty/arty.dts:142.5-35: Warning (reg_format): /soc/spiflash@f0005000/flash@0:reg: property has invalid length (16 bytes) (#address-cells == 2, #size-cells == 1)
buildroot/rv32.dtb: Warning (pci_device_reg): Failed prerequisite 'reg_format'
buildroot/rv32.dtb: Warning (pci_device_bus_num): Failed prerequisite 'reg_format'
buildroot/rv32.dtb: Warning (simple_bus_reg): Failed prerequisite 'reg_format'
buildroot/rv32.dtb: Warning (i2c_bus_reg): Failed prerequisite 'reg_format'
build/arty/arty.dts:116.29-134.8: Warning (spi_bus_bridge): /soc/spi@f0008000: incorrect #size-cells for SPI bus
buildroot/rv32.dtb: Warning (spi_bus_reg): Failed prerequisite 'reg_format'
buildroot/rv32.dtb: Warning (spi_bus_reg): Failed prerequisite 'spi_bus_bridge'
build/arty/arty.dts:140.19-143.9: Warning (avoid_default_addr_size): /soc/spiflash@f0005000/flash@0: Relying on default #address-cells value
build/arty/arty.dts:140.19-143.9: Warning (avoid_default_addr_size): /soc/spiflash@f0005000/flash@0: Relying on default #size-cells value
buildroot/rv32.dtb: Warning (avoid_unnecessary_addr_size): Failed prerequisite 'avoid_default_addr_size'
buildroot/rv32.dtb: Warning (unique_unit_address): Failed prerequisite 'avoid_default_addr_size'
 CC       isr.o
 CC       framebuffer.o
 CC       main.o
 LD       emulator.elf
chmod -x emulator.elf
 OBJCOPY  emulator.bin
chmod -x emulator.bin
Flashing build/arty/gateware/top.bin at 0x00000000
Open On-Chip Debugger 0.10.0+dev-00985-g2dc88e14 (2019-12-31-14:13)
Licensed under GNU GPL v2
For bug reports, read
	http://openocd.org/doc/doxygen/bugs.html
Info : auto-selecting first available session transport "jtag". To override use 'transport select <transport>'.
fpga_program
Info : ftdi: if you experience problems at higher adapter clocks, try the command "ftdi_tdo_sample_edge falling"
Info : clock speed 25000 kHz
Info : JTAG tap: xc7.tap tap/device found: 0x0362d093 (mfg: 0x049 (Xilinx), part: 0x362d, ver: 0x0)
Info : JTAG tap: xc7.tap tap/device found: 0x0362d093 (mfg: 0x049 (Xilinx), part: 0x362d, ver: 0x0)
Info : Found flash device 'micron n25q128' (ID 0x0018ba20)
Info : Found flash device 'micron n25q128' (ID 0x0018ba20)
Info : Found flash device 'micron n25q128' (ID 0x0018ba20)
Info : Found flash device 'micron n25q128' (ID 0x0018ba20)
Info : sector 0 took 242 ms
Info : sector 1 took 238 ms
Info : sector 2 took 232 ms
Info : sector 3 took 236 ms
Info : sector 4 took 241 ms
Info : sector 5 took 238 ms
Info : sector 6 took 238 ms
Info : sector 7 took 238 ms
Info : sector 8 took 239 ms
Info : sector 9 took 234 ms
Info : sector 10 took 236 ms
Info : sector 11 took 231 ms
Info : sector 12 took 231 ms
Info : sector 13 took 232 ms
Info : sector 14 took 229 ms
Info : sector 15 took 232 ms
Info : sector 16 took 235 ms
Info : sector 17 took 234 ms
Info : sector 18 took 235 ms
Info : sector 19 took 245 ms
Info : sector 20 took 234 ms
Info : sector 21 took 248 ms
Info : sector 22 took 254 ms
Info : sector 23 took 264 ms
Info : sector 24 took 264 ms
Info : sector 25 took 262 ms
Info : sector 26 took 266 ms
Info : sector 27 took 233 ms
Info : sector 28 took 239 ms
Info : sector 29 took 240 ms
Info : sector 30 took 230 ms
Info : sector 31 took 237 ms
Info : sector 32 took 237 ms
Info : sector 33 took 257 ms
Info : Found flash device 'micron n25q128' (ID 0x0018ba20)
Flashing buildroot/Image at 0x00400000
Open On-Chip Debugger 0.10.0+dev-00985-g2dc88e14 (2019-12-31-14:13)
Licensed under GNU GPL v2
For bug reports, read
	http://openocd.org/doc/doxygen/bugs.html
Info : auto-selecting first available session transport "jtag". To override use 'transport select <transport>'.
fpga_program
Info : ftdi: if you experience problems at higher adapter clocks, try the command "ftdi_tdo_sample_edge falling"
Info : clock speed 25000 kHz
Info : JTAG tap: xc7.tap tap/device found: 0x0362d093 (mfg: 0x049 (Xilinx), part: 0x362d, ver: 0x0)
Info : JTAG tap: xc7.tap tap/device found: 0x0362d093 (mfg: 0x049 (Xilinx), part: 0x362d, ver: 0x0)
Info : Found flash device 'micron n25q128' (ID 0x0018ba20)
Info : Found flash device 'micron n25q128' (ID 0x0018ba20)
Info : Found flash device 'micron n25q128' (ID 0x0018ba20)
Info : Found flash device 'micron n25q128' (ID 0x0018ba20)
Info : sector 64 took 271 ms
Info : sector 65 took 260 ms
Info : sector 66 took 265 ms
Info : sector 67 took 270 ms
Info : sector 68 took 269 ms
Info : sector 69 took 269 ms
Info : sector 70 took 273 ms
Info : sector 71 took 265 ms
Info : sector 72 took 269 ms
Info : sector 73 took 267 ms
Info : sector 74 took 266 ms
Info : sector 75 took 274 ms
Info : sector 76 took 266 ms
Info : sector 77 took 265 ms
Info : sector 78 took 273 ms
Info : sector 79 took 267 ms
Info : sector 80 took 266 ms
Info : sector 81 took 270 ms
Info : sector 82 took 267 ms
Info : sector 83 took 270 ms
Info : sector 84 took 268 ms
Info : sector 85 took 267 ms
Info : sector 86 took 266 ms
Info : sector 87 took 266 ms
Info : sector 88 took 266 ms
Info : sector 89 took 266 ms
Info : sector 90 took 269 ms
Info : sector 91 took 268 ms
Info : sector 92 took 265 ms
Info : sector 93 took 268 ms
Info : sector 94 took 268 ms
Info : sector 95 took 269 ms
Info : sector 96 took 272 ms
Info : sector 97 took 264 ms
Info : sector 98 took 268 ms
Info : sector 99 took 268 ms
Info : sector 100 took 271 ms
Info : sector 101 took 268 ms
Info : sector 102 took 272 ms
Info : sector 103 took 271 ms
Info : sector 104 took 268 ms
Info : sector 105 took 268 ms
Info : sector 106 took 270 ms
Info : sector 107 took 264 ms
Info : sector 108 took 271 ms
Info : sector 109 took 269 ms
Info : sector 110 took 269 ms
Info : sector 111 took 269 ms
Info : sector 112 took 269 ms
Info : sector 113 took 269 ms
Info : sector 114 took 268 ms
Info : sector 115 took 268 ms
Info : sector 116 took 265 ms
Info : sector 117 took 264 ms
Info : sector 118 took 264 ms
Info : sector 119 took 257 ms
Info : sector 120 took 263 ms
Info : sector 121 took 264 ms
Info : sector 122 took 270 ms
Info : sector 123 took 263 ms
Info : sector 124 took 267 ms
Info : sector 125 took 271 ms
Info : sector 126 took 266 ms
Info : sector 127 took 254 ms
Info : sector 128 took 270 ms
Info : sector 129 took 269 ms
Info : sector 130 took 268 ms
Info : sector 131 took 268 ms
Info : sector 132 took 265 ms
Info : sector 133 took 270 ms
Info : Found flash device 'micron n25q128' (ID 0x0018ba20)
Flashing buildroot/rootfs.cpio at 0x00800000
Open On-Chip Debugger 0.10.0+dev-00985-g2dc88e14 (2019-12-31-14:13)
Licensed under GNU GPL v2
For bug reports, read
	http://openocd.org/doc/doxygen/bugs.html
Info : auto-selecting first available session transport "jtag". To override use 'transport select <transport>'.
fpga_program
Info : ftdi: if you experience problems at higher adapter clocks, try the command "ftdi_tdo_sample_edge falling"
Info : clock speed 25000 kHz
Info : JTAG tap: xc7.tap tap/device found: 0x0362d093 (mfg: 0x049 (Xilinx), part: 0x362d, ver: 0x0)
Info : JTAG tap: xc7.tap tap/device found: 0x0362d093 (mfg: 0x049 (Xilinx), part: 0x362d, ver: 0x0)
Info : Found flash device 'micron n25q128' (ID 0x0018ba20)
Info : Found flash device 'micron n25q128' (ID 0x0018ba20)
Info : Found flash device 'micron n25q128' (ID 0x0018ba20)
Info : Found flash device 'micron n25q128' (ID 0x0018ba20)
Info : sector 128 took 251 ms
Info : sector 129 took 253 ms
Info : sector 130 took 237 ms
Info : sector 131 took 234 ms
Info : sector 132 took 230 ms
Info : sector 133 took 261 ms
Info : sector 134 took 270 ms
Info : sector 135 took 274 ms
Info : sector 136 took 265 ms
Info : sector 137 took 263 ms
Info : sector 138 took 270 ms
Info : sector 139 took 269 ms
Info : sector 140 took 269 ms
Info : sector 141 took 265 ms
Info : sector 142 took 265 ms
Info : sector 143 took 264 ms
Info : sector 144 took 265 ms
Info : sector 145 took 269 ms
Info : sector 146 took 265 ms
Info : sector 147 took 264 ms
Info : sector 148 took 271 ms
Info : sector 149 took 266 ms
Info : sector 150 took 269 ms
Info : sector 151 took 269 ms
Info : sector 152 took 260 ms
Info : sector 153 took 260 ms
Info : sector 154 took 263 ms
Info : sector 155 took 262 ms
Info : sector 156 took 265 ms
Info : sector 157 took 268 ms
Info : sector 158 took 268 ms
Info : sector 159 took 271 ms
Info : sector 160 took 270 ms
Info : sector 161 took 267 ms
Info : sector 162 took 267 ms
Info : sector 163 took 264 ms
Info : sector 164 took 266 ms
Info : sector 165 took 274 ms
Info : sector 166 took 261 ms
Info : sector 167 took 269 ms
Info : sector 168 took 260 ms
Info : sector 169 took 269 ms
Info : sector 170 took 264 ms
Info : sector 171 took 263 ms
Info : sector 172 took 267 ms
Info : sector 173 took 268 ms
Info : sector 174 took 269 ms
Info : sector 175 took 266 ms
Info : sector 176 took 268 ms
Info : sector 177 took 268 ms
Info : sector 178 took 266 ms
Info : sector 179 took 254 ms
Info : sector 180 took 258 ms
Info : sector 181 took 266 ms
Info : sector 182 took 263 ms
Info : sector 183 took 268 ms
Info : sector 184 took 265 ms
Info : sector 185 took 268 ms
Info : sector 186 took 267 ms
Info : sector 187 took 262 ms
Info : sector 188 took 257 ms
Info : sector 189 took 260 ms
Info : sector 190 took 264 ms
Info : sector 191 took 264 ms
Info : sector 192 took 270 ms
Info : sector 193 took 265 ms
Info : sector 194 took 266 ms
Info : sector 195 took 269 ms
Info : sector 196 took 269 ms
Info : sector 197 took 267 ms
Info : sector 198 took 271 ms
Info : sector 199 took 267 ms
Info : sector 200 took 266 ms
Info : sector 201 took 266 ms
Info : sector 202 took 272 ms
Info : sector 203 took 267 ms
Info : sector 204 took 269 ms
Info : sector 205 took 265 ms
Info : sector 206 took 269 ms
Info : sector 207 took 266 ms
Info : sector 208 took 269 ms
Info : sector 209 took 265 ms
Info : sector 210 took 269 ms
Info : sector 211 took 265 ms
Info : sector 212 took 267 ms
Info : sector 213 took 267 ms
Info : sector 214 took 269 ms
Info : sector 215 took 263 ms
Info : sector 216 took 266 ms
Info : sector 217 took 264 ms
Info : sector 218 took 266 ms
Info : sector 219 took 267 ms
Info : sector 220 took 268 ms
Info : sector 221 took 267 ms
Info : sector 222 took 266 ms
Info : sector 223 took 267 ms
Info : sector 224 took 269 ms
Info : sector 225 took 272 ms
Info : sector 226 took 267 ms
Info : sector 227 took 267 ms
Info : sector 228 took 265 ms
Info : sector 229 took 266 ms
Info : sector 230 took 271 ms
Info : sector 231 took 271 ms
Info : sector 232 took 265 ms
Info : sector 233 took 269 ms
Info : sector 234 took 263 ms
Info : sector 235 took 267 ms
Info : sector 236 took 264 ms
Info : sector 237 took 264 ms
Info : sector 238 took 269 ms
Info : sector 239 took 264 ms
Info : sector 240 took 272 ms
Info : sector 241 took 265 ms
Info : sector 242 took 269 ms
Info : sector 243 took 264 ms
Info : sector 244 took 266 ms
Info : sector 245 took 266 ms
Info : sector 246 took 269 ms
Info : sector 247 took 265 ms
Info : sector 248 took 269 ms
Info : sector 249 took 267 ms
Info : sector 250 took 268 ms
Info : Found flash device 'micron n25q128' (ID 0x0018ba20)
Flashing buildroot/rv32.dtb at 0x00f00000
Open On-Chip Debugger 0.10.0+dev-00985-g2dc88e14 (2019-12-31-14:13)
Licensed under GNU GPL v2
For bug reports, read
	http://openocd.org/doc/doxygen/bugs.html
Info : auto-selecting first available session transport "jtag". To override use 'transport select <transport>'.
fpga_program
Info : ftdi: if you experience problems at higher adapter clocks, try the command "ftdi_tdo_sample_edge falling"
Info : clock speed 25000 kHz
Info : JTAG tap: xc7.tap tap/device found: 0x0362d093 (mfg: 0x049 (Xilinx), part: 0x362d, ver: 0x0)
Info : JTAG tap: xc7.tap tap/device found: 0x0362d093 (mfg: 0x049 (Xilinx), part: 0x362d, ver: 0x0)
Info : Found flash device 'micron n25q128' (ID 0x0018ba20)
Info : Found flash device 'micron n25q128' (ID 0x0018ba20)
Info : Found flash device 'micron n25q128' (ID 0x0018ba20)
Info : Found flash device 'micron n25q128' (ID 0x0018ba20)
Info : sector 240 took 271 ms
Info : Found flash device 'micron n25q128' (ID 0x0018ba20)
Flashing emulator/emulator.bin at 0x00f80000
Open On-Chip Debugger 0.10.0+dev-00985-g2dc88e14 (2019-12-31-14:13)
Licensed under GNU GPL v2
For bug reports, read
	http://openocd.org/doc/doxygen/bugs.html
Info : auto-selecting first available session transport "jtag". To override use 'transport select <transport>'.
fpga_program
Info : ftdi: if you experience problems at higher adapter clocks, try the command "ftdi_tdo_sample_edge falling"
Info : clock speed 25000 kHz
Info : JTAG tap: xc7.tap tap/device found: 0x0362d093 (mfg: 0x049 (Xilinx), part: 0x362d, ver: 0x0)
Info : JTAG tap: xc7.tap tap/device found: 0x0362d093 (mfg: 0x049 (Xilinx), part: 0x362d, ver: 0x0)
Info : Found flash device 'micron n25q128' (ID 0x0018ba20)
Info : Found flash device 'micron n25q128' (ID 0x0018ba20)
Info : Found flash device 'micron n25q128' (ID 0x0018ba20)
Info : Found flash device 'micron n25q128' (ID 0x0018ba20)
Info : sector 248 took 268 ms
Info : Found flash device 'micron n25q128' (ID 0x0018ba20)
[sahaj@fedora-work linux-on-litex-vexriscv]$ 

But it fails to boot

Terminal ready

        __   _ __      _  __
       / /  (_) /____ | |/_/
      / /__/ / __/ -_)>  <
     /____/_/\__/\__/_/|_|

 (c) Copyright 2012-2019 Enjoy-Digital
 (c) Copyright 2007-2015 M-Labs Ltd

 BIOS built on Sep 25 2019 08:12:42
 BIOS CRC passed (bc4f43e5)

 Migen git sha1: f4fcd10
 LiteX git sha1: 1425a68d

--============ SoC info ================--
CPU:       VexRiscv @ 100MHz
ROM:       32KB
SRAM:      32KB
L2:        8KB
MAIN-RAM:  262144KB

--========= Peripherals init ===========--
Initializing SDRAM...
SDRAM now under software control
Read leveling:
m0, b0: |11111000000000000000000000000000| delays: 02+-02
m0, b1: |00000000000011111111100000000000| delays: 16+-04
m0, b2: |00000000000000000000000000001111| delays: 30+-02
m0, b3: |00000000000000000000000000000000| delays: -
m0, b4: |00000000000000000000000000000000| delays: -
m0, b5: |00000000000000000000000000000000| delays: -
m0, b6: |00000000000000000000000000000000| delays: -
m0, b7: |00000000000000000000000000000000| delays: -
best: m0, b1 delays: 16+-04
m1, b0: |11111111100000000000000000000000| delays: 04+-04
m1, b1: |00000000000001111111111110000000| delays: 19+-06
m1, b2: |00000000000000000000000000000011| delays: 31+-01
m1, b3: |00000000000000000000000000000000| delays: -
m1, b4: |00000000000000000000000000000000| delays: -
m1, b5: |00000000000000000000000000000000| delays: -
m1, b6: |00000000000000000000000000000000| delays: -
m1, b7: |00000000000000000000000000000000| delays: -
best: m1, b1 delays: 19+-06
SDRAM now under hardware control
Memtest OK

--========== Boot sequence =============--
Booting from serial...
Press Q or ESC to abort boot completely.
sL5DdSMmkekro
             Timeout
Loading emulator.bin from flash...
Error: Invalid image length 0xffffffff
Booting from flash...
Error: Invalid image length 0xffffffff
Booting from network...
Local IP : 192.168.1.50
Remote IP: 192.168.1.100
Fetching from: UDP/69
Unable to download Image over TFTP
Network boot failed
Unable to download Linux images, falling back to boot.bin
Unable to download boot.bin over TFTP
Network boot failed
No boot medium found

--============= Console ================--
litex> 

Document how to use/test peripherals

Ethernet/SPI/I2C/Framebuffer have been integrated recently, but we haven't added information on how to use/test it. Add that to the README or another documentation file.

run in NEXYS4DDR stalled, and Simulation stalled in boot Linux

Hi everyone, I want to test this project in my Nexys4 DDR. I followed the README, there are no problems during make and install phase. But I met two problems in the last phase.
First, the simulation stopped at booting Linux for too long times during sim.py. Should I still be waiting for it?
image
Second, when I tested it in Nexys4DDR, it stopped at [LXTERM] Starting....
image
I have no idea, can anyone give me some advices? Thanks!

tab completion drawing odd

Running the LiteX simulation
$ ./sim.py

login.. use tab completion, something happens - dupes the line?

root@buildroot:~# cat /proc/cpuin <tab>
root@buildroot:~# cat /proc/cpuinroot@buildroot:~# cat /proc/cpuinfo

cpuinfo processor : 0

                32-bits VexRiscv CPU with MMU integrated in a LiteX SoC
login[48]: root login on 'hvc0'
root@buildroot:~# cat /proc/cpuinfo
processor	: 0
hart		: 0
isa		: rv32ima
mmu		: sv32
uarch		: spinalhdl,vexriscv

booting process

Hi. I'm newbie.

I built KC705 bitstream and I will load it soon.

Before loading it on fpga can you help me to know more about this task?

As I know, general computers load bootloaders from BIOS and bootloaders are loading OS.

Can you teach me a little bit about how this project boot linux at start? ( for example, the address where bootloader or OS exists, or the works of core at the start)

Best regards.

Persistent Files. (Nexys4DDR)

I'm looking for a way to have persistent files booted up with linux.

Is there a way to add files to the linux image that is loaded onto the board? With the sd not currently supported on the nexys4DDR is there another solution?

Error linker when executing simulator

Hello,

I'm not sure this is really an issue or not when invoking the command "python3 sim.py" I got the following error:

g++ veril.o dut_init.o verilated.o verilated_dpi.o verilated_vcd_c.o Vdut__ALL.a -lpthread -ljson-c -lm -lstdc++ -ldl -levent libdylib.o modules.o pads.o parse.o sim.o -o Vdut -lm -lstdc++ 2>&1 | c++filt libdylib.o: In function `platform_raw_open': /home/phuong/Workspace/FPGA/LITEX/mainline/linux-on-litex-vexriscv/litex/litex/build/sim/core/libdylib.c:102: undefined reference to `dlopen' libdylib.o: In function `platform_set_last_error': /home/phuong/Workspace/FPGA/LITEX/mainline/linux-on-litex-vexriscv/litex/litex/build/sim/core/libdylib.c:97: undefined reference to `dlerror' libdylib.o: In function `platform_raw_close': /home/phuong/Workspace/FPGA/LITEX/mainline/linux-on-litex-vexriscv/litex/litex/build/sim/core/libdylib.c:113: undefined reference to `dlclose' libdylib.o: In function `platform_set_last_error': /home/phuong/Workspace/FPGA/LITEX/mainline/linux-on-litex-vexriscv/litex/litex/build/sim/core/libdylib.c:97: undefined reference to `dlerror

Temporally I could fix the compilation error by editing the makefile in a folder:
\linux-on-litex-vexriscv\litex\litex\build\sim\core\Makefile

Replace the bellow line:

- LDFLAGS = -lpthread -ljson-c -lm -lstdc++ -ldl -levent
+ LDFLAGS = -lpthread -Wl,--no-as-needed -ljson-c -lm -lstdc++ -Wl,--no-as-needed -ldl -levent

I'm using ubuntu 16.04 LTS, does anyone run to the same problem with me?

Support the NOMMU port

According to Palmer;

The NOMMU RISC-V port was posted to the Linux Kernel mailing list just this week

I think he is talking about the stuff at https://github.com/chmmn/riscv-uclinux

It would be good to support NOMMU Linux on LiteX for even lower resource usage (and more predictable performance).

Add .gitignore for build artifacts

Should probably add a .gitignore for the repo so that we don't commit build artifacts.

On branch master
Your branch is up to date with 'origin/master'.

Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)

	modified:   emulator/main.c
	modified:   images.json
	modified:   json2dts.py
	modified:   make.py
	modified:   sim.py

Untracked files:
  (use "git add <file>..." to include in what will be committed)

	__pycache__/
	build/
	buildroot/Image
	buildroot/rootfs.cpio
	buildroot/rootfs.tar
	buildroot/rv32.dtb
	emulator/emulator.bin
	emulator/emulator.elf
	emulator/framebuffer.d
	emulator/framebuffer.o
	emulator/isr.d
	emulator/isr.o
	emulator/main.d
	emulator/main.o

Integrate LiteEth

  • 1) Regenerate VexRiscv to have similar interrupts for User/Supervisor mode.
  • 2) Get actual LiteEth Linux driver working (in polling mode).
  • 3) Add interrupt support to software.
  • 4) Review driver, do eventual optimizations, understand limitations.
  • 5) Add DMA support if needed to improve performance.

Add reboot support

We could support reboot by writing 1 to CSR_CTRL_RESET_ADDR register at the end of the Linux reboot sequence to reset the CPU.

build.py: Build system tries to build emulator before board

user@Pazuzu:~/Code/HaD/linux-on-litex-vexriscv$ python3 ./make.py --board ulx3s
 CC       isr.o
 CC       framebuffer.o
 CC       main.o
 LD       emulator.elf
riscv64-unknown-elf-ld: cannot find ../build/ulx3s/software/libbase/crt0-vexriscv-ctr.o: No such file or directory
riscv64-unknown-elf-ld: cannot find -lbase-nofloat
riscv64-unknown-elf-ld: cannot find -lcompiler_rt
Makefile:19: recipe for target 'emulator.elf' failed
make: *** [emulator.elf] Error 1
$

Documents/guides about (net)booting Linux ?

Hi.
Sorry for making noises here.

I've been working around Alpine Linux RV32 port during my day job and I am willing to bring it to VexRiscv (kinda related to #54 ).

As I'm trying to side-load Linux/rootfs/dtb ...... to versa_ecp5 board via network, I'm confused by the instructions in README.

I've setup a tftp server with needed files placed on my laptop, which is hooked up to versa_ecp5 directly. The laptop has been configured the ip address 192.168.1.100 on that NIC properly.

I typed ./make --board=versa_ecp5 --remote-ip=192.168.1.100 --local-ip=192.168.1.50
Judging by the output of command, it seems that the board is correctly loaded with gateware. (Sparkling LEDs went out.)
Yet it seems to fail to fetch kernel and stuffs from my laptop.

Also, I don't understand the meaning of "local-ip" option. Would it be configured by Litex SOC, which has its own BIOS ? If not, then I'm kinda lost about how to set it up.

I tried to find the more detailed documents but in vain.

CSRs: Simplify accessors and try to avoid using ioread32[be]/iowrite32[be]

In the current SoC Controller driver, the scratch value is only checked against little endian value:

+	if (reg == SCRATCH_REG_VALUE) {
+		pr_info("Detected endianness: Little Endian");
+		litex_read_reg = ioread32;
+		litex_write_reg = iowrite32;
+	} else {
+		pr_info("Detected endianness: Big Endian");
+		litex_read_reg = ioread32be;
+		litex_write_reg = iowrite32be;
+	}

It would be good to also check it for the big Endian case and report a failure if not matching any of the cases.

Also once #72 will be added, we should be sure to reset the scratch register before doing this test. It will be possible to do so with enjoy-digital/litex#347.

KC705: Lower uart_baudrate?

The KC705 uses a CP2103 for the UART which is limited to 921600. Check if 1e6 is working or if we need to lower baudrate for this board.

Conflict between csr region and main_ram region

A number of the builds are failing with;

$ ./make.py --board=Genesys2
Traceback (most recent call last):
  File "./make.py", line 332, in <module>
    main()
  File "./make.py", line 283, in main
    soc = SoCLinux(board.soc_cls, **soc_kwargs)
  File "/home/travis/build/mithro/linux-on-litex-vexriscv/soc_linux.py", line 162, in SoCLinux
    return _SoCLinux(**kwargs)
  File "/home/travis/build/mithro/linux-on-litex-vexriscv/soc_linux.py", line 55, in __init__
    soc_cls.__init__(self, cpu_type="vexriscv", cpu_variant=cpu_variant, uart_baudrate=1e6, **kwargs)
  File "/home/travis/build/mithro/linux-on-litex-vexriscv/src/litex-boards/litex_boards/official/targets/genesys2.py", line 74, in __init__
    BaseSoC.__init__(self, **kwargs)
  File "/home/travis/build/mithro/linux-on-litex-vexriscv/src/litex-boards/litex_boards/official/targets/genesys2.py", line 63, in __init__
    timing_settings     = sdram_module.timing_settings)
  File "/home/travis/build/mithro/linux-on-litex-vexriscv/src/litex/litex/soc/integration/soc_sdram.py", line 100, in register_sdram
    self.register_mem("main_ram", self.mem_map["main_ram"], wb_sdram, main_ram_size)
  File "/home/travis/build/mithro/linux-on-litex-vexriscv/src/litex/litex/soc/integration/soc_core.py", line 426, in register_mem
    self.add_memory_region(name, address, size)
  File "/home/travis/build/mithro/linux-on-litex-vexriscv/src/litex/litex/soc/integration/soc_core.py", line 421, in add_memory_region
    o1, self.mem_regions[o1],
ValueError: Memory region conflict between csr (<SoCMemRegion 0xf0000000 0x10000 cached>) and main_ram (<SoCMemRegion 0xc0000000 0x40000000 cached>)
The command "./make.py --board=$BOARD" exited with 1.
$ ./make.py --board=KC705
Traceback (most recent call last):
  File "./make.py", line 332, in <module>
    main()
  File "./make.py", line 283, in main
    soc = SoCLinux(board.soc_cls, **soc_kwargs)
  File "/home/travis/build/mithro/linux-on-litex-vexriscv/soc_linux.py", line 162, in SoCLinux
    return _SoCLinux(**kwargs)
  File "/home/travis/build/mithro/linux-on-litex-vexriscv/soc_linux.py", line 55, in __init__
    soc_cls.__init__(self, cpu_type="vexriscv", cpu_variant=cpu_variant, uart_baudrate=1e6, **kwargs)
  File "/home/travis/build/mithro/linux-on-litex-vexriscv/src/litex-boards/litex_boards/official/targets/kc705.py", line 65, in __init__
    timing_settings = sdram_module.timing_settings)
  File "/home/travis/build/mithro/linux-on-litex-vexriscv/src/litex/litex/soc/integration/soc_sdram.py", line 100, in register_sdram
    self.register_mem("main_ram", self.mem_map["main_ram"], wb_sdram, main_ram_size)
  File "/home/travis/build/mithro/linux-on-litex-vexriscv/src/litex/litex/soc/integration/soc_core.py", line 426, in register_mem
    self.add_memory_region(name, address, size)
  File "/home/travis/build/mithro/linux-on-litex-vexriscv/src/litex/litex/soc/integration/soc_core.py", line 421, in add_memory_region
    o1, self.mem_regions[o1],
ValueError: Memory region conflict between csr (<SoCMemRegion 0xf0000000 0x10000 cached>) and main_ram (<SoCMemRegion 0xc0000000 0x40000000 cached>)
The command "./make.py --board=$BOARD" exited with 1.

See https://travis-ci.com/mithro/linux-on-litex-vexriscv/builds/144890173

Build Error: Nexys Video Ethernet Reset multi-driven net

CRITICAL WARNING: [Synth 8-3352] multi-driven net eth_tx_rst with 1st driver pin 'FDPE_11/Q' [/home/miguel/hdl-playground/litex/linux-on-litex-vexriscv/build/nexys_video/gateware/top.v:18687]
CRITICAL WARNING: [Synth 8-3352] multi-driven net eth_tx_rst with 2nd driver pin 'FDPE_15/Q' [/home/miguel/hdl-playground/litex/linux-on-litex-vexriscv/build/nexys_video/gateware/top.v:18727]
...
ERROR: [DRC MDRV-1] Multiple Driver Nets: Net eth_tx_rst has multiple drivers: FDPE_15/Q, and FDPE_11/Q.
ERROR: [Vivado_Tcl 4-78] Error(s) found during DRC. Opt_design not run.

Thought maybe this was a copy-pasta error, but eth_rx_rst get driven in FDPE_17

Boot stalls on Genesys2 Board

Hi,

I've been trying to boot Linux on my Genesys2 board but it fails early in the boot sequence. This is the output I get:

[LXTERM] Starting....

litex> reboot

    __   _ __      _  __
   / /  (_) /____ | |/_/
  / /__/ / __/ -_)>  <
 /____/_/\__/\__/_/|_|

(c) Copyright 2012-2019 Enjoy-Digital
(c) Copyright 2007-2015 M-Labs Ltd

BIOS built on Sep 25 2019 08:20:57
BIOS CRC passed (afc9b4b4)

Migen git sha1: f4fcd10
LiteX git sha1: 1425a68d

--============ SoC info ================--
CPU: VexRiscv @ 125MHz
ROM: 32KB
SRAM: 32KB
L2: 8KB
MAIN-RAM: 524288KB

--========= Peripherals init ===========--
Initializing SDRAM...
SDRAM now under software control
Write leveling:
m0: |00000000000111111111111000| delay: 11
m1: |00000000000011111111111100| delay: 12
m2: |00000000011111111111100000| delay: 09
m3: |00000000011111111111100000| delay: 09
Read leveling:
m0, b0: |00000000000000000000000000000000| delays: -
m0, b1: |00000000000000000000000000000000| delays: -
m0, b2: |00001111111100000000000000000000| delays: 08+-04
m0, b3: |00000000000000001111111110000000| delays: 20+-04
m0, b4: |00000000000000000000000000000011| delays: 31+-01
m0, b5: |00000000000000000000000000000000| delays: -
m0, b6: |00000000000000000000000000000000| delays: -
m0, b7: |00000000000000000000000000000000| delays: -
best: m0, b3 delays: 20+-04
m1, b0: |00000000000000000000000000000000| delays: -
m1, b1: |00000000000000000000000000000000| delays: -
m1, b2: |00000111111100000000000000000000| delays: 08+-03
m1, b3: |00000000000000000011111100000000| delays: 21+-03
m1, b4: |00000000000000000000000000000001| delays: 31+-00
m1, b5: |00000000000000000000000000000000| delays: -
m1, b6: |00000000000000000000000000000000| delays: -
m1, b7: |00000000000000000000000000000000| delays: -
best: m1, b2 delays: 07+-03
m2, b0: |00000000000000000000000000000000| delays: -
m2, b1: |11100000000000000000000000000000| delays: 01+-01
m2, b2: |00000011111111100000000000000000| delays: 10+-04
m2, b3: |00000000000000000000111111100000| delays: 23+-04
m2, b4: |00000000000000000000000000000000| delays: -
m2, b5: |00000000000000000000000000000000| delays: -
m2, b6: |00000000000000000000000000000000| delays: -
m2, b7: |00000000000000000000000000000000| delays: -
best: m2, b2 delays: 10+-04
m3, b0: |00000000000000000000000000000000| delays: -
m3, b1: |11111000000000000000000000000000| delays: 02+-02
m3, b2: |00000000111111111100000000000000| delays: 12+-04
m3, b3: |00000000000000000000001111111111| delays: 26+-04
m3, b4: |00000000000000000000000000000000| delays: -
m3, b5: |00000000000000000000000000000000| delays: -
m3, b6: |00000000000000000000000000000000| delays: -
m3, b7: |00000000000000000000000000000000| delays: -
best: m3, b2 delays: 12+-04
SDRAM now under hardware control
Memtest OK

--========== Boot sequence =============--
Booting from serial...
Press Q or ESC to abort boot completely.
sL5DdSMmkekro
[LXTERM] Received firmware download request from the device.
[LXTERM] Uploading buildroot/Image to 0xc0000000 (5074340 bytes)...
[LXTERM] Upload complete (90.8KB/s).
[LXTERM] Uploading buildroot/rootfs.cpio to 0xc0800000 (4062720 bytes)...
[LXTERM] Upload complete (92.4KB/s).
[LXTERM] Uploading buildroot/rv32.dtb to 0xc1000000 (1879 bytes)...
[LXTERM] Upload complete (99.4KB/s).
[LXTERM] Uploading emulator/emulator.bin to 0x20000000 (10156 bytes)...
[LXTERM] Upload complete (94.7KB/s).
[LXTERM] Booting the device.
[LXTERM] Done.
KExecuting booted program at 0x20000000
--============= Liftoff! ===============--
VexRiscv Machine Mode software built Jan 30 2020 01:31:37
--========== Booting Linux =============--
[ 0.000000] No DTB

I tried using the prebuild Linux as well as building it myself with the same result. There was a similar issue in this Git (#48 ) which might be related but I am not sure.

Any help is appreciated. Thank you!

Missing `dtc` dependency

user@Pazuzu:~/Code/HaD/linux-on-litex-vexriscv$ python3 ./make.py --board ulx3s
**sh: 1: dtc: not found**
 CC       isr.o
 CC       framebuffer.o
 CC       main.o
 LD       emulator.elf
riscv64-unknown-elf-ld: cannot find ../build/ulx3s/software/libbase/crt0-vexriscv-ctr.o: No such file or directory
riscv64-unknown-elf-ld: cannot find -lbase-nofloat
riscv64-unknown-elf-ld: cannot find -lcompiler_rt
Makefile:19: recipe for target 'emulator.elf' failed
make: *** [emulator.elf] Error 1

finish ULX3S support

ULX3S is alsmot booting, but #4 prevents it to go to user space. When programming the board with OpenOCD, the serial is no longer detected and then prevents using lxterm to load the linux images. When loading the ujprog, the serial is still detected correctly after bitstream is loaded.

        __   _ __      _  __
       / /  (_) /____ | |/_/
      / /__/ / __/ -_)>  <
     /____/_/\__/\__/_/|_|

 (c) Copyright 2012-2019 Enjoy-Digital
 (c) Copyright 2012-2015 M-Labs Ltd

 BIOS built on May  7 2019 09:40:21
 BIOS CRC passed (c64754ab)

--============ SoC info ================--
CPU:       VexRiscv @ 50MHz
ROM:       32KB
SRAM:      4KB
L2:        8KB
MAIN-RAM:  32768KB

--========= Peripherals init ===========--
Initializing SDRAM...
SDRAM now under hardware control
Memtest OK

--========== Boot sequence =============--
Booting from serial...
Press Q or ESC to abort boot completely.
sL5DdSMmkekro
[LXTERM] Received firmware download request from the device.
[LXTERM] Uploading binaries/Image to 0xc0000000 (2726132 bytes)...
[LXTERM] Upload complete (15.3KB/s).
[LXTERM] Uploading binaries/rootfs.cpio to 0xc0800000 (4054528 bytes)...
[LXTERM] Upload complete (15.3KB/s).
[LXTERM] Uploading binaries/rv32.dtb to 0xc1000000 (1618 bytes)...
[LXTERM] Upload complete (14.1KB/s).
[LXTERM] Uploading emulator/emulator.bin to 0x20000000 (9128 bytes)...
[LXTERM] Upload complete (15.0KB/s).
[LXTERM] Booting the device.
[LXTERM] Done.
Executing booted program at 0x20000000
--============= Liftoff! ===============--
VexRiscv Machine Mode software built May  7 2019 10:01:09
--========== Booting Linux =============--
[    0.000000] No DTB passed to the kernel
[    0.000000] Linux version 5.0.9 (florent@lab) (gcc version 8.3.0 (Buildroot 2019.05-git-00938-g75f9fcd0c9)) #1 Thu May 2 17:43:30 CEST 2019
[    0.000000] Initial ramdisk at: 0x(ptrval) (8388608 bytes)
[    0.000000] Zone ranges:
[    0.000000]   Normal   [mem 0x00000000c0000000-0x00000000c7ffffff]
[    0.000000] Movable zone start for each node
[    0.000000] Early memory node ranges
[    0.000000]   node   0: [mem 0x00000000c0000000-0x00000000c7ffffff]
[    0.000000] Initmem setup node 0 [mem 0x00000000c0000000-0x00000000c7ffffff]
[    0.000000] elf_hwcap is 0x1100
[    0.000000] Built 1 zonelists, mobility grouping on.  Total pages: 32512
[    0.000000] Kernel command line: mem=32M@0x40000000 rootwait console=hvc0 root=/dev/ram0 init=/sbin/init swiotlb=32
[    0.000000] Dentry cache hash table entries: 16384 (order: 4, 65536 bytes)
[    0.000000] Inode-cache hash table entries: 8192 (order: 3, 32768 bytes)
[    0.000000] Sorting __ex_table...
[    0.000000] Memory: 119052K/131072K available (1957K kernel code, 92K rwdata, 317K rodata, 104K init, 184K bss, 12020K 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] clocksource: riscv_clocksource: mask: 0xffffffffffffffff max_cycles: 0x114c1bade8, max_idle_ns: 440795203839 ns
[    0.000699] sched_clock: 64 bits at 75MHz, resolution 13ns, wraps every 2199023255546ns
[    0.005987] Console: colour dummy device 80x25
[    0.026123] printk: console [hvc0] enabled
[    0.030423] Calibrating delay loop (skipped), value calculated using timer frequency.. 150.00 BogoMIPS (lpj=300000)
[    0.032373] pid_max: default: 32768 minimum: 301
[    0.067479] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes)
[    0.069751] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes)
[    0.266660] devtmpfs: initialized
[    0.424107] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 7645041785100000 ns
[    0.426071] futex hash table entries: 256 (order: -1, 3072 bytes)
[    0.964934] clocksource: Switched to clocksource riscv_clocksource
[    2.118148] Unpacking initramfs...
[    8.935616] Initramfs unpacking failed: junk in compressed archive
[    9.015373] workingset: timestamp_bits=30 max_order=15 bucket_order=0
[   10.362975] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 254)
[   10.364303] io scheduler mq-deadline registered
[   10.365359] io scheduler kyber registered
[   17.700662] random: get_random_bytes called from init_oops_id+0x4c/0x60 with crng_init=0
[   42.084334] OF: fdt: not creating '/sys/firmware/fdt': CRC check failed
[   42.144834] Freeing unused kernel memory: 104K
[   42.147410] This architecture does not have kernel memory protection.
[   42.148354] Run /init as init process

README: Board names are misleading

The Supported Boards table has a list of board names, but these names are not valid for use with --board:

user@Pazuzu:~/Code/HaD/linux-on-litex-vexriscv$ python3 ./make.py --board ULX3S
Traceback (most recent call last):
  File "./make.py", line 254, in <module>
    main()
  File "./make.py", line 203, in main
    board = supported_boards[board_name]()
KeyError: 'ULX3S'
user@Pazuzu:~/Code/HaD/linux-on-litex-vexriscv$ python3 ./make.py --board "Versa ECP5"
Traceback (most recent call last):
  File "./make.py", line 254, in <module>
    main()
  File "./make.py", line 203, in main
    board = supported_boards[board_name]()
KeyError: 'Versa ECP5'
$

ethernet testing

[ 38.440914] libphy: Fixed MDIO Bus: probed
[ 38.464502] liteeth f0003800.mac: Failed to get IRQ, using polling
[ 38.610547] liteeth f0003800.mac eth0: irq 0, mapped at a0002800

I guess this is normal bootlog, and gives 0 information if the ethernet MAC/PHY is actually working? there are no packets sent out at all..

Integrate LiteSDCard

  • 1) Simplify LiteSDCard to run with a divided clock (will reduce resource usage) and with a vendor agnostic PHY.
  • 2) Allow booting from SD Card in LiteX BIOS. (copy Linux images to RAM and jump to it).
  • 3) Allow having the file system directly on the SD Card in SPI-mode.
  • 4) Allow having the file system directly on the SD Card in SD-mode.

Add Ethernet to Nexys4DDR

Issue booting linux on ArtyA7

Hi,

I tested the flow on the ArtyA7 and got an issue at the moment it liftoff in linux.

Commands used :

git clone https://github.com/enjoy-digital/linux-on-litex-vexriscv.git

git clone https://github.com/enjoy-digital/linux-on-litex-vexriscv-prebuilt
cp -r linux-on-litex-vexriscv-prebuilt/* linux-on-litex-vexriscv

wget https://raw.githubusercontent.com/enjoy-digital/litex/master/litex_setup.py
chmod +x litex_setup.py
sudo ./litex_setup.py init install --user

cd linux-on-litex-vexriscv
./make.py --board=arty --build
sudo ./make.py --board=arty --flash

ttyUSB =>

       / /  (_) /____ | |/_/
      / /__/ / __/ -_)>  <
     /____/_/\__/\__/_/|_|

 (c) Copyright 2012-2019 Enjoy-Digital
 (c) Copyright 2007-2015 M-Labs Ltd

 BIOS built on May 15 2019 14:36:07
 BIOS CRC passed (6772ad38)

--============ SoC info ================--
CPU:       VexRiscv @ 100MHz
ROM:       32KB
SRAM:      32KB
L2:        8KB
MAIN-RAM:  262144KB

--========= Peripherals init ===========--
Initializing SDRAM...
SDRAM now under software control
Read leveling:
m0, b0: |11111110000000000000000000000000| delays: 03+-03
m0, b1: |00000000000000111111111000000000| delays: 18+-04
m0, b2: |00000000000000000000000000000011| delays: 31+-01
m0, b3: |00000000000000000000000000000000| delays: -
m0, b4: |00000000000000000000000000000000| delays: -
m0, b5: |00000000000000000000000000000000| delays: -
m0, b6: |00000000000000000000000000000000| delays: -
m0, b7: |00000000000000000000000000000000| delays: -
best: m0, b1 delays: 18+-04
m1, b0: |11111111111000000000000000000000| delays: 05+-05
m1, b1: |00000000000000111111111111000000| delays: 20+-06
m1, b2: |00000000000000000000000000000011| delays: 31+-01
m1, b3: |00000000000000000000000000000000| delays: -
m1, b4: |00000000000000000000000000000000| delays: -
m1, b5: |00000000000000000000000000000000| delays: -
m1, b6: |00000000000000000000000000000000| delays: -
m1, b7: |00000000000000000000000000000000| delays: -
best: m1, b1 delays: 20+-05
SDRAM now under hardware control
Memtest OK

--========== Boot sequence =============--
Booting from serial...
Press Q or ESC to abort boot completely.
sL5DdSMmkekro
Timeout
Loading Image from flash...
Loading rootfs.cpio from flash...
Loading rv32.dtb from flash...
Loading emulator.bin from flash...
Executing booted program at 0x20000000
--============= Liftoff! ===============--

And that's all.
The ./sim.py work and boot the linux properly.

Currently, i'm not sure where the problem is.
Maybe somebody else can try on their own the same procedure to cross check ?
Or I did something wrong ?

Avoid duplication between targets

The targets are based on LiteX BaseSoC or Ethernet SoC targets and share most of the additional code. We could try to reduce that to reduce duplication between targets.

pre-built bitstream (genesys and kc705)

Hi. I'm newbie to these works.

I wants to build softcore and linux on it. (Maybe KC705 will be used)

Looking at supported boards, I can see the numbers of FPGA device of KC705 and Genesys2 are same. So why are they have same numbers.

In addition, there is pre-built bitstream only for Genesys2 not for KC705. Can I use that for my KC705 board?

Thanks :D

Print console messages as early as possible

With the switch to real LiteX UART driver (4c138ae and 5e4d486), first console messages seem to be buffered until the driver is loaded, so first console message can take up to a few seconds to appear on HW and up to a few minutes on Simulation. This is not convenient, especially for simulation and basic SoC verification (just see if Linux starts booting) since now take a few minutes instead of a few seconds.

readme needs udev

./make.py --board=arty --load
Error: libusb_open() failed with LIBUSB_ERROR_ACCESS

git clone https://github.com/litex-hub/litex-buildenv-udev
cd litex-buildenv-udev
make install
make reload

SoC Controller: add writes/reads check to SoC Controller driver

We are currently using the SoC Controller's scratch register to check endianness, but we should also probably check writes/reads to this scratch controller and report a failure if not working. This would provide a way to detect Wishbone/CSR access issues earlier and make sure that register access functions are working correctly.

litex vexriscv cpu-variant linux not starting

LiteX build seems working properly, 4 different new platforms did all come alive instantly, but in all cases as soon as the cpu-variant is changed from "full" to "linux" then the BIOS prompt does not come any more:
cyclone10LP target (quartus 18.1) - no uart output with "linux" variant
artix-7 target (vivado 2018.3 or 2019.1) - about 10 first characters come out, then stop

any suggestions what can be the issue? I will try to get some more boards and do more testing, but seems weird that until "full" all variants always work with no issues, and then dead comes

Reduce minimum memory requirement to 32MB

Currently, the minimum requirement is 64MB. Reducing the minimum requirement would be interesting to run on less expensive boards: ULX3S, Minispartan6.

An initial test has been done with the following patch:

From 60cabf74713750d0f8aaae969e0eec430a39fa07 Mon Sep 17 00:00:00 2001
From: Florent Kermarrec <[email protected]>
Date: Tue, 7 May 2019 10:20:29 +0200
Subject: [PATCH] try to reduce minimum memory requirement to 32MB

---
 buildroot/board/litex_vexriscv/litex_vexriscv.dts | 6 +++---
 emulator/main.c                                   | 2 +-
 serialboot.json                                   | 4 ++--
 sim.py                                            | 6 +++---
 4 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/buildroot/board/litex_vexriscv/litex_vexriscv.dts b/buildroot/board/litex_vexriscv/litex_vexriscv.dts
index ddbedcc..2cb2c21 100644
--- a/buildroot/board/litex_vexriscv/litex_vexriscv.dts
+++ b/buildroot/board/litex_vexriscv/litex_vexriscv.dts
@@ -7,9 +7,9 @@
 	model = "sifive,hifive-unleashed-a00";
 
 	chosen {
-		bootargs = "mem=128M@0x40000000 rootwait console=hvc0 root=/dev/ram0 init=/sbin/init swiotlb=32";
-		linux,initrd-start = <0xC2000000>;
-		linux,initrd-end = <0xC2800000>; // max 8MB ramdisk image
+		bootargs = "mem=32M@0x40000000 rootwait console=hvc0 root=/dev/ram0 init=/sbin/init swiotlb=32";
+		linux,initrd-start = <0xC0800000>;
+		linux,initrd-end   = <0xC1000000>; // max 8MB ramdisk image
 	};
 
 	cpus {
diff --git a/emulator/main.c b/emulator/main.c
index ed81fd7..9f67ce6 100644
--- a/emulator/main.c
+++ b/emulator/main.c
@@ -15,7 +15,7 @@
 #include "riscv.h"
 
 #define LINUX_IMAGE_BASE 0xC0000000
-#define LINUX_DTB_BASE   0xC3000000
+#define LINUX_DTB_BASE   0xC1000000
 
 #define max(a,b) \
   ({ __typeof__ (a) _a = (a); \
diff --git a/serialboot.json b/serialboot.json
index 039da48..1362b66 100644
--- a/serialboot.json
+++ b/serialboot.json
@@ -1,6 +1,6 @@
 {
 	"binaries/Image":         "0xc0000000",
-	"binaries/rootfs.cpio":   "0xc2000000",
-	"binaries/rv32.dtb":      "0xc3000000",
+	"binaries/rootfs.cpio":   "0xc0800000",
+	"binaries/rv32.dtb":      "0xc1000000",
 	"emulator/emulator.bin":  "0x20000000"
 }
diff --git a/sim.py b/sim.py
index af271ec..37f5cbb 100755
--- a/sim.py
+++ b/sim.py
@@ -78,11 +78,11 @@ class LinuxSoC(SoCCore):
             cpu_type="vexriscv", cpu_variant="linux",
             with_uart=False,
             integrated_rom_size=0x8000,
-            integrated_main_ram_size=0x08000000, # 128MB
+            integrated_main_ram_size=0x02000000, # 32MB
             integrated_main_ram_init=get_mem_data({
                 "binaries/Image":         "0x00000000",
-                "binaries/rootfs.cpio":   "0x02000000",
-                "binaries/rv32.dtb":      "0x03000000"
+                "binaries/rootfs.cpio":   "0x00800000",
+                "binaries/rv32.dtb":      "0x01000000"
                 }, "little"),
             **kwargs)
         self.cpu.use_external_variant("VexRiscv.v")
-- 
2.17.1

But the simulation is not going to user space:

[    0.000000] No DTB passed to the kernel
[    0.000000] Linux version 5.0.9 (florent@lab) (gcc version 8.3.0 (Buildroot 2019.05-git-00938-g75f9fcd0c9)) #1 Thu May 2 17:43:30 CEST 2019
[    0.000000] Initial ramdisk at: 0x(ptrval) (8388608 bytes)
[    0.000000] Zone ranges:
[    0.000000]   Normal   [mem 0x00000000c0000000-0x00000000c7ffffff]
[    0.000000] Movable zone start for each node
[    0.000000] Early memory node ranges
[    0.000000]   node   0: [mem 0x00000000c0000000-0x00000000c7ffffff]
[    0.000000] Initmem setup node 0 [mem 0x00000000c0000000-0x00000000c7ffffff]
[    0.000000] elf_hwcap is 0x1100
[    0.000000] Built 1 zonelists, mobility grouping on.  Total pages: 32512
[    0.000000] Kernel command line: mem=32M@0x40000000 rootwait console=hvc0 root=/dev/ram0 init=/sbin/init swiotlb=32
[    0.000000] Dentry cache hash table entries: 16384 (order: 4, 65536 bytes)
[    0.000000] Inode-cache hash table entries: 8192 (order: 3, 32768 bytes)
[    0.000000] Sorting __ex_table...
[    0.000000] Memory: 119052K/131072K available (1957K kernel code, 92K rwdata, 317K rodata, 104K init, 184K bss, 12020K 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] clocksource: riscv_clocksource: mask: 0xffffffffffffffff max_cycles: 0x114c1bade8, max_idle_ns: 440795203839 ns
[    0.000160] sched_clock: 64 bits at 75MHz, resolution 13ns, wraps every 2199023255546ns
[    0.001527] Console: colour dummy device 80x25
[    0.008146] printk: console [hvc0] enabled
[    0.009202] Calibrating delay loop (skipped), value calculated using timer frequency.. 150.00 BogoMIPS (lpj=300000)
[    0.009881] pid_max: default: 32768 minimum: 301
[    0.016382] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes)
[    0.016920] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes)
[    0.046119] devtmpfs: initialized
[    0.063933] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 7645041785100000 ns
[    0.064558] futex hash table entries: 256 (order: -1, 3072 bytes)
[    0.123433] clocksource: Switched to clocksource riscv_clocksource
[    0.259769] Unpacking initramfs...
[    1.996061] workingset: timestamp_bits=30 max_order=15 bucket_order=0
[    2.168953] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 254)
[    2.169412] io scheduler mq-deadline registered
[    2.169769] io scheduler kyber registered
[    3.033070] random: get_random_bytes called from init_oops_id+0x4c/0x60 with crng_init=0
[   10.056734] OF: fdt: not creating '/sys/firmware/fdt': CRC check failed
[   10.062543] Freeing unused kernel memory: 104K
[   10.062867] This architecture does not have kernel memory protection.
[   10.063256] Run /init as init process
- /home/florent/dev/linux/linux-on-litex-vexriscv/build/gateware/dut.v:1036: Verilog $finish

When running on the ULX3S (32MB SDRAM), the behaviour is seen. Investigation needs to be done with the simulations, ULX3S will probably work after that.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.