在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称(OpenSource Name):litex-hub/linux-on-litex-vexriscv开源软件地址(OpenSource Url):https://github.com/litex-hub/linux-on-litex-vexriscv开源编程语言(OpenSource Language):Python 90.5%开源软件介绍(OpenSource Introduction):
[> IntroThis 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. [> Demolitex_acorn_baseboard_linux.mp4[> Supported boardsAll boards supported in LiteX-Boards with...:
... could run this project. The board support is directly imported from LiteX-Boards and the configuration is just adapted for the project in The current list of boards that have been tested and are supported can be obtained by running
Adding support for another board from LiteX-Boards satisfying the requirements should only be a matter of adding a few lines to
[> 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 imagesPre-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 Verilator (only needed for simulation)$ sudo apt install verilator
$ sudo apt install libevent-dev libjson-c-dev [> 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$ ./sim.py You should see Linux booting and be able to interact with it:
[> Running on hardwareBuild 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:
Once installed, build the bitstream with: $ ./make.py --board=XXYY --cpu-count=X --build
Load the FPGA bitstreamTo load the bitstream to you board, run: $ ./make.py --board=XXYY --cpu-count=X --load
Load the Linux images over SerialAll 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 The images should load and you should see Linux booting :)
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 EthernetFor 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 SDCardFor 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 :)
Configure/Use the peripheralsPlease 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/. [> 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/. [> Generating the OpenSBI binary (optional)$ git clone https://github.com/litex-hub/opensbi --branch 0.8-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 |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论