Thursday, August 1, 2019

Installing Litex

Litex website says that timvideos litex-buildenv should be used by newcomers - but that web starts about installing debian packages, so it seems to be immediate dead end for Windows users.

Let's try the regular way:
python litex_setup.py init install

some github repos are pulled in, then error that python3 is not found comes..

starting migen install manually, something happening.. done without errors? good!

Idea lets copy python.exe to python3.exe and try again main install and see what happens?

no errors, does it mean it is installed??

aa there is document how to install litex on windows, but it requires Windows 10 and linux subsystem so it really is not working on Windows native?

Thats not good news. Litex seems to be written in python, and python runs everywhere so it should run on Windows too right? If I only want to add new platforms to litex then it should be possible?

trying setup.py again something happens and voila I  have a file named EGG about 30Mbyte large. What can I do with it? And how todo anything with litex? litex web says, run installer, then:

go to: boards/targets and execute target you want?

But what command should I enter to execute a target?

cd litex\boards\targets

python arty.py

erorr not finding risc-v compiler ? that's not so bad, as the compiler was not built so this error is kind of expected, but what if I want to build the hardware with no SoftCPU ?

25 minutes later, here comes full HOWTO litex on Windows:

1) make copy of python.exe to python3.exe
2) python litex_setup.py init install
3) python setup.py install
4) cd litex\boards\targets\

create a new target :)
create a famous DO.BAT with 2 lines:

set path=X:\Xilinx\Vivado\2019.1\bin\;%path%
python s7mini.py --cpu-type=None

And this does indeed run without error until bitstream - as you see I am trying to build for Kevin Hubbard's Spartan-7 mini board.

At least some bitfile did come out, of course I used wrong platform file, but at least now it is possible to start working and add new platforms to litex

all you need is proper DO.BAT

:)

All done huh? Adding new platform python file, changing the new platform and trying to build:

error: can not import s7mini from the EGG ?? What egg ?

So how to I get the new local file into the egg?
RTFM
python setup.py build

and the EGG is updated cooool!

almost there, both platform and target file are listed as part of EGG inside egg-info but when trying to build with new platform it still throws an error..

seems that getting litex to work in one day is not possible :(

not giving up yet, manual copy of the platform file to C:\python3\lib\site-packages seems to work as temporary workaround

... building for s7 minim done, programming FPGA, LED is ON

it works, the complete flow

and we have blinking LED as well..

and Vexriscv Litex BIOS starts as well, cool very cool..

NOTE: if you do not have the same toolchain installed you may have to patch in


C:\Python37\Lib\site-packages\litex-0.2.dev0-py3.7.egg\litex\soc\cores\cpu\vexriscv

file core.py:

#        return ("riscv64-unknown-elf", "riscv32-unknown-elf")
        return ("riscv-none-embed", "riscv-none-embed")


thats all folks!














2 comments:

  1. there is no need to patch core.py any more

    ReplyDelete
    Replies
    1. I tried installing. But when I try executing the .py files inside core/phy/tlp..etc.... am getting an error, litepcie: no module found or litex: no module found. Please guide me through it.

      Delete