-
Notifications
You must be signed in to change notification settings - Fork 316
Description
I wanted to play with FemtoRV and LiteX, but my Linux environment won't allow me to install Python modules with pip3 and I need a virtual Python environment.
So here are some commands which helped me get it working in such an environment. Some of the commands come from https://blog.bomorgan.io/hobbies/hardware/fpgas/litex-riscv-ecp5-ulx3s/.
Install System Dependencies
Install the Python venv module:
$ sudo apt-get install python3-venv
Set Up the Python Virtual Environment
Create a virtual Python environment in a new directory (the name isn't important) and activate the environment:
$ mkdir litex-riscv-ulx3s && cd litex-riscv-ulx3s
$ python3 -m venv venv && source venv/bin/activate
$ pip3 install meson ninja
I decided to install meson and ninja at the same time. From now on, until you type deactivate, you are using this virtual Python environment. If, later on, you want to activate this environment again, you need to:
$ cd litex-riscv-ulx3s && source venv/bin/activate
Download and Set Up LiteX
Now, while we are in the litex-riscv-ulx3s directory, we can download and set up LiteX:
$ wget https://raw.githubusercontent.com/enjoy-digital/litex/master/litex_setup.py
$ chmod +x litex_setup.py && ./litex_setup.py --init --install
$ cd ..
Build a Bitstream
LiteX is now installed along with the virtual Python environment.
Now we go to where we have the learn-fpga repository and, for example, build a bitstream for an ULX3S board:
$ cd learn-fpga/LiteX
$ python3 -m boards.radiona_ulx3s_ex --device LFE5U-45F --sdram-module MT48LC16M16 --cpu-type femtorv --cpu-variant petitbateau --build --load --ecppack-compress
Connect to the Board
The above command loads the bitstream on to the ULX3S board. When this is done, you should see the LiteX LED heartbeat on the board. You can then open a terminal on the USB serial port appropriate for you. I use:
$ minicom -D /dev/ttyUSB0
and I see:
--============= Console ================--
litex> sdram_test
Memtest at 0x40000000 (1.0MiB)...
Write: 0x40000000-0x40100000 1.0MiB
Read: 0x40000000-0x40100000 1.0MiB
Memtest OK
litex>