My notes on compiling LiteX-CNC on linuxCNC

More
21 Sep 2022 02:50 #252457 by DePrutser
I've restored my virtual machine, so it's a fresh install of linuxcnc again. I get the same error:

$ sudo apt-get install wget
$ sudo apt-get install python3-pip
$ sudo apt-get install git
$ pip3 install --user meson ninja


$ wget raw.githubusercontent.com/enjoy-digital/...aster/litex_setup.py

$ python3 litex_setup.py --init --install --config=standard --gcc=riscv

$ wget github.com/YosysHQ/oss-cad-suite-build/r...nux-x64-20220920.tgz
$ tar -xvf oss-cad-suite-linux-x64-20220920.tgz
$ mkdir -p ~/bin
$ ln -s ~/oss-cad-suite/bin/* ~/bin/
#start a new bash, so ~/bin is added to the PATH
$ bash --login

$ git clone github.com/Peter-van-Tol/LiteX-CNC.git
$ cd LiteX-CNC/
$ python -m firmware examples/5a-75e.json
Traceback (most recent call last):
File "/usr/lib/python2.7/runpy.py", line 163, in _run_module_as_main
mod_name, _Error)
File "/usr/lib/python2.7/runpy.py", line 111, in _get_module_details
__import__(mod_name) # Do not catch exceptions initializing package
File "firmware/__init__.py", line 20, in <module>
from .soc import LitexCNC_Firmware
File "firmware/soc.py", line 32
baseclass: Type = Field(
^
SyntaxError: invalid syntax

Please Log in or Create an account to join the conversation.

More
21 Sep 2022 08:41 #252488 by TOLP2
Can you verify:
- that pydantic is in requirements.txt
- that 'pip install -r requirements.txt' has been run
- you're in the correct branch (stepgen_improvement)

I've got the feeling that Pydantic is missing somehow.

Please Log in or Create an account to join the conversation.

More
21 Sep 2022 16:51 #252524 by DePrutser
I'm on branch main:
cedric@mill:~/LiteX-CNC$ git status
On branch main
Your branch is up to date with 'origin/main'.

nothing to commit, working tree clean

pydantic is in requirements.txt, but it has no end of line:
cedric@mill:~/LiteX-CNC$ cat requirements.txt
click~=8.0
pydanticcedric@mill:~/LiteX-CNC$

pip has not been run:
$ pip install -r requirements.txt
bash: pip: command not found

pip3 is available:
cedric@mill:~/LiteX-CNC$ pip3 install -r requirements.txt
Collecting click~=8.0 (from -r requirements.txt (line 1))
Downloading files.pythonhosted.org/packages/c2/f1/df...1.3-py3-none-any.whl (96kB)
100% |████████████████████████████████| 102kB 5.0MB/s
Collecting pydantic (from -r requirements.txt (line 2))
Downloading files.pythonhosted.org/packages/d4/ec/23...0.2-py3-none-any.whl (154kB)
100% |████████████████████████████████| 163kB 6.8MB/s
Collecting importlib-metadata; python_version < "3.8" (from click~=8.0->-r requirements.txt (line 1))
Downloading files.pythonhosted.org/packages/d2/a2/8c...2.0-py3-none-any.whl
Collecting typing-extensions>=4.1.0 (from pydantic->-r requirements.txt (line 2))
Downloading files.pythonhosted.org/packages/ed/d6/2a...3.0-py3-none-any.whl
Collecting zipp>=0.5 (from importlib-metadata; python_version < "3.8"->click~=8.0->-r requirements.txt (line 1))
Downloading files.pythonhosted.org/packages/f0/36/63...8.1-py3-none-any.whl
Installing collected packages: typing-extensions, zipp, importlib-metadata, click, pydantic
Successfully installed click-8.1.3 importlib-metadata-4.12.0 pydantic-1.10.2 typing-extensions-4.3.0 zipp-3.8.1

It does not solve the problem though:
cedric@mill:~/LiteX-CNC$ python -m firmware examples/5a-75e.json
Traceback (most recent call last):
File "/usr/lib/python2.7/runpy.py", line 163, in _run_module_as_main
mod_name, _Error)
File "/usr/lib/python2.7/runpy.py", line 111, in _get_module_details
__import__(mod_name) # Do not catch exceptions initializing package
File "firmware/__init__.py", line 20, in <module>
from .soc import LitexCNC_Firmware
File "firmware/soc.py", line 32
baseclass: Type = Field(
^
SyntaxError: invalid syntax


cedric@mill:~/LiteX-CNC$ git checkout stepgen_improvement
Branch 'stepgen_improvement' set up to track remote branch 'stepgen_improvement' from 'origin'.
Switched to a new branch 'stepgen_improvement'

cedric@mill:~/LiteX-CNC$ python -m firmware examples/5a-75e.json
Traceback (most recent call last):
File "/usr/lib/python2.7/runpy.py", line 163, in _run_module_as_main
mod_name, _Error)
File "/usr/lib/python2.7/runpy.py", line 111, in _get_module_details
__import__(mod_name) # Do not catch exceptions initializing package
File "firmware/__init__.py", line 19, in <module>
from . import boards
File "firmware/boards/__init__.py", line 1, in <module>
from .rv901t import RV901T
File "firmware/boards/rv901t.py", line 8, in <module>
from litex.build.generic_platform import *
ImportError: No module named litex.build.generic_platform

So far, not so good :-)

Please Log in or Create an account to join the conversation.

More
21 Sep 2022 17:06 #252526 by DePrutser
On further investigation, the error message has changed.
Does it matter where I run the script "python3 litex_setup.py --init --install --config=standard --gcc=riscv"? I have run it without first creating a folder for it, polluting my home folder.

Please Log in or Create an account to join the conversation.

More
24 Sep 2022 07:31 - 24 Sep 2022 07:51 #252652 by DePrutser
New attempt:
Reinstall linuxcnc (roll back to that snapshot)

$ sudo apt-get install wget
$ sudo apt-get install python3-pip
$ sudo apt-get install git
$ pip3 install --user meson ninja

$ mkdir LiteX
$ cd LiteX
$ wget raw.githubusercontent.com/enjoy-digital/...aster/litex_setup.py
$ python3 litex_setup.py --init --install --config=standard --gcc=riscv
$ cd ..

$ wget github.com/YosysHQ/oss-cad-suite-build/r...nux-x64-20220920.tgz
$ tar -xvf oss-cad-suite-linux-x64-20220920.tgz
$ mkdir -p ~/bin
$ ln -s ~/oss-cad-suite/bin/* ~/bin/
#start a new bash, so ~/bin is added to the PATH
$ bash --login

$ git clone github.com/Peter-van-Tol/LiteX-CNC.git
$ cd LiteX-CNC
$ git checkout stepgen_improvement
$ pip3 install -r requirements.txt

$ python -m firmware examples/5a-75e.json

Nope:
cedric@mill:~/LiteX-CNC$ python -m firmware examples/5a-75e.json
Traceback (most recent call last):
  File "/usr/lib/python2.7/runpy.py", line 163, in _run_module_as_main
    mod_name, _Error)
  File "/usr/lib/python2.7/runpy.py", line 111, in _get_module_details
    __import__(mod_name)  # Do not catch exceptions initializing package
  File "firmware/__init__.py", line 19, in <module>
    from . import boards
  File "firmware/boards/__init__.py", line 1, in <module>
    from .rv901t import RV901T
  File "firmware/boards/rv901t.py", line 8, in <module>
    from litex.build.generic_platform import *
ImportError: No module named litex.build.generic_platform

I think now there's only something missing from the PATH or something small like that:
cedric@mill:~$ echo $PATH
/home/cedric/.local/bin:/home/cedric/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games

 
Last edit: 24 Sep 2022 07:51 by DePrutser. Reason: needed to restore the virtual machine for the next attempt

Please Log in or Create an account to join the conversation.

More
26 Sep 2022 08:02 #252753 by vit74vit
try this:
export PATH="~/oss-cad-suite/bin/:$PATH"

Please Log in or Create an account to join the conversation.

More
26 Sep 2022 16:18 #252782 by DePrutser
Thanks, but that was not it:
cedric@mill:~$ echo $PATH
/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games
cedric@mill:~$ export PATH="~/oss-cad-suite/bin/:$PATH"
cedric@mill:~$ echo $PATH
~/oss-cad-suite/bin/:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games
cedric@mill:~$ cd LiteX-CNC
cedric@mill:~/LiteX-CNC$ python -m firmware examples/5a-75e.json
Traceback (most recent call last):
File "/usr/lib/python2.7/runpy.py", line 163, in _run_module_as_main
mod_name, _Error)
File "/usr/lib/python2.7/runpy.py", line 111, in _get_module_details
__import__(mod_name) # Do not catch exceptions initializing package
File "firmware/__init__.py", line 19, in <module>
from . import boards
File "firmware/boards/__init__.py", line 1, in <module>
from .rv901t import RV901T
File "firmware/boards/rv901t.py", line 8, in <module>
from litex.build.generic_platform import *
ImportError: No module named litex.build.generic_platform
cedric@mill:~/LiteX-CNC$

Please Log in or Create an account to join the conversation.

More
26 Sep 2022 16:24 #252783 by DePrutser
I have found generic platform.py:

cedric@mill:~/LiteX-CNC$
cedric@mill:~/LiteX-CNC$ ls /home/cedric/LiteX/litex/litex/build/
altera __init__.py quicklogic
anlogic io.py sim
dfu.py lattice tools.py
efinix microsemi xilinx
generic_platform.py nextpnr_wrapper.py yosys_nextpnr_toolchain.py
generic_programmer.py openfpgaloader.py yosys_wrapper.py
generic_toolchain.py openocd.py
gowin osfpga
cedric@mill:~/LiteX-CNC$
cedric@mill:~/LiteX-CNC$
cedric@mill:~/LiteX-CNC$ cd /home/cedric/LiteX/litex/
cedric@mill:~/LiteX/litex$ ls
CHANGES doc litex litex_setup.py README.md test
CONTRIBUTORS LICENSE litex.egg-info MANIFEST.in setup.py
cedric@mill:~/LiteX/litex$

Please Log in or Create an account to join the conversation.

More
28 Sep 2022 05:28 #252913 by DePrutser
I've restored my virtual machine again, so it's a fresh install of linuxcnc. Now it works when I specifically run python3

$ sudo apt-get install wget
$ sudo apt-get install python3-pip
$ sudo apt-get install git
$ pip3 install --user meson ninja

$ mkdir LiteX
$ cd LiteX
$ wget raw.githubusercontent.com/enjoy-digital/...aster/litex_setup.py
$ python3 litex_setup.py --init --install --config=standard --gcc=riscv
$ cd ..

$ wget github.com/YosysHQ/oss-cad-suite-build/r...nux-x64-20220920.tgz
$ tar -xvf oss-cad-suite-linux-x64-20220920.tgz
$ mkdir -p ~/bin
$ ln -s ~/oss-cad-suite/bin/* ~/bin/
#start a new bash, so ~/bin is added to the PATH
$ bash --login

$ git clone github.com/Peter-van-Tol/LiteX-CNC.git
$ cd LiteX-CNC
$ git checkout stepgen_improvement
$ pip3 install -r requirements.txt

$ python3 -m firmware examples/5a-75e.json
<module 'firmware' from '/home/cedric/LiteX-CNC/firmware/__init__.py'>
Generated fingerprint (CRC):  2614875155
INFO:SoC:        __   _ __      _  __  
INFO:SoC:       / /  (_) /____ | |/_/  
INFO:SoC:      / /__/ / __/ -_)>  <    
INFO:SoC:     /____/_/\__/\__/_/|_|  
INFO:SoC:  Build your hardware, easily!
INFO:SoC:
INFO:SoC:Creating SoC... (2022-09-28 01:26:07)
INFO:SoC:
INFO:SoC:FPGA device : LFE5U-25F-6BG256C.
INFO:SoC:System clock: 50.000MHz.
INFO:SoCBusHandler:Creating Bus Handler...
INFO:SoCBusHandler:32-bit wishbone Bus, 4.0GiB Address Space.
INFO:SoCBusHandler:Adding reserved Bus Regions...
INFO:SoCBusHandler:Bus Handler created.
INFO:SoCCSRHandler:Creating CSR Handler...
INFO:SoCCSRHandler:32-bit CSR Bus, 32-bit Aligned, 16.0KiB Address Space, 2048B Paging, big Ordering (Up to 32 Locations).
INFO:SoCCSRHandler:Adding reserved CSRs...
INFO:SoCCSRHandler:CSR Handler created.
INFO:SoCIRQHandler:Creating IRQ Handler...
INFO:SoCIRQHandler:IRQ Handler (up to 32 Locations).
INFO:SoCIRQHandler:Adding reserved IRQs...
INFO:SoCIRQHandler:IRQ Handler created.
INFO:SoC:
INFO:SoC:Initial SoC:
INFO:SoC:
INFO:SoC:32-bit wishbone Bus, 4.0GiB Address Space.
INFO:SoC:32-bit CSR Bus, 32-bit Aligned, 16.0KiB Address Space, 2048B Paging, big Ordering (Up to 32 Locations).
INFO:SoC:IRQ Handler (up to 32 Locations).
INFO:SoC:
INFO:SoC:Controller ctrl added.
INFO:SoC:CPU None added.
INFO:SoC:CPU None adding IO Region 0 at 0x00000000 (Size: 0x100000000).
INFO:SoCBusHandler:io0 Region added at Origin: 0x00000000, Size: 0x100000000, Mode: RW, Cached: False Linker: False.
INFO:ECP5PLL:Creating ECP5PLL.
INFO:ECP5PLL:Registering Single Ended ClkIn of 25.00MHz.
INFO:ECP5PLL:Creating ClkOut0 sys of 50.00MHz (+-10000.00ppm).
INFO:ECP5PLL:Creating ClkOut1 sys_ps of 50.00MHz (+-10000.00ppm).
INFO:SoCBusHandler:master0 added as Bus Master.
INFO:SoC:CSR Bridge csr added.
INFO:SoCBusHandler:csr Region added at Origin: 0x00000000, Size: 0x00010000, Mode: RW, Cached: False Linker: False.
INFO:SoCBusHandler:csr added as Bus Slave.
INFO:SoCCSRHandler:csr added as CSR Master.
INFO:SoCBusHandler:Interconnect: InterconnectPointToPoint (1 <-> 1).
INFO:SoCCSRHandler:MMIO_inst CSR allocated at Location 0.
INFO:SoCCSRHandler:ctrl CSR allocated at Location 1.
INFO:SoCCSRHandler:ethphy CSR allocated at Location 2.
INFO:SoCCSRHandler:identifier_mem CSR allocated at Location 3.
INFO:SoC:
INFO:SoC:Finalized SoC:
INFO:SoC:
INFO:SoC:32-bit wishbone Bus, 4.0GiB Address Space.
IO Regions: (1)
io0                 : Origin: 0x00000000, Size: 0x100000000, Mode: RW, Cached: False Linker: False
Bus Regions: (1)
csr                 : Origin: 0x00000000, Size: 0x00010000, Mode: RW, Cached: False Linker: False
Bus Masters: (1)
- master0
Bus Slaves: (1)
- csr
INFO:SoC:32-bit CSR Bus, 32-bit Aligned, 16.0KiB Address Space, 2048B Paging, big Ordering (Up to 32 Locations).
CSR Locations: (4)
- MMIO_inst      : 0
- ctrl           : 1
- ethphy         : 2
- identifier_mem : 3
INFO:SoC:IRQ Handler (up to 32 Locations).
INFO:SoC:
INFO:ECP5PLL:Config:
clki_div   : 1
clkfb      : 2
clko0_freq : 50.00MHz
clko0_div  : 8
clko0_phase: 0.00°
clko1_freq : 50.00MHz
clko1_div  : 8
clko1_phase: 180.00°
clko2_div  : 1
vco        : 400.00MHz
clkfb_div  : 16
cedric@mill:~/LiteX-CNC$

The generated files are in 5a-75e:
$ cd 5a-75e/
$ find
./software
./software/include
./software/include/generated
./software/include/generated/soc.h
./software/include/generated/mem.h
./software/include/generated/git.h
./software/include/generated/csr.h
./gateware
./gateware/colorlight_5a_75e.lpf
./gateware/colorlight_5a_75e.ys
./gateware/colorlight_5a_75e_mem.init
./gateware/build_colorlight_5a_75e.sh
./gateware/colorlight_5a_75e.v
./csr.csv

The .lpf file can be flashed into the FPGA


 
The following user(s) said Thank You: tommylight

Please Log in or Create an account to join the conversation.

More
08 Oct 2022 15:25 #253757 by DePrutser
This is the same procedure on arch linux:

# pacman -S wget
# pacman -S python-pip
# pacman -S git
$ pip3 install --user meson ninja

$ mkdir LiteX
$ cd LiteX
$ wget raw.githubusercontent.com/enjoy-digital/...aster/litex_setup.py
$ python3 litex_setup.py --init --install --config=standard --gcc=riscv
$ cd ..

$ wget github.com/YosysHQ/oss-cad-suite-build/r...nux-x64-20220920.tgz
$ tar -xvf oss-cad-suite-linux-x64-20220920.tgz
$ mkdir -p ~/bin
$ ln -s ~/oss-cad-suite/bin/* ~/bin/
$ bash --login

$ git clone github.com/Peter-van-Tol/LiteX-CNC.git
$ cd LiteX-CNC
$ git checkout stepgen_improvement
$ pip3 install -r requirements.txt
$ python3 -m firmware examples/5a-75e.json

Please Log in or Create an account to join the conversation.

Moderators: PCWjmelson
Time to create page: 0.090 seconds
Powered by Kunena Forum