Bug 654 - dev-env-setup script for symbiflow (arty A7-100T)
Summary: dev-env-setup script for symbiflow (arty A7-100T)
Status: RESOLVED FIXED
Alias: None
Product: Libre-SOC's first SoC
Classification: Unclassified
Component: Documentation (show other bugs)
Version: unspecified
Hardware: PC Linux
: --- enhancement
Assignee: Veera
URL: http://libre-soc.org/HDL_workflow/sym...
Depends on:
Blocks:
 
Reported: 2021-06-28 11:27 BST by Luke Kenneth Casson Leighton
Modified: 2022-08-29 01:29 BST (History)
1 user (show)

See Also:
NLnet milestone: NLNet.2019.10.043.Wishbone
total budget (EUR) for completion of task and all subtasks: 750
budget (EUR) for this task, excluding subtasks' budget: 750
parent task for budget allocation: 384
child tasks for budget allocation:
The table of payments (in EUR) for this task; TOML format:
vklr = { amount = 600, submitted = 2021-11-27, paid = 2021-12-04 } [lkcl] amount = 150 submitted = 2021-12-09 paid = 2021-12-09


Attachments
dpkg list in chroot of debian pacakges installed (75.92 KB, text/plain)
2021-08-18 18:02 BST, Luke Kenneth Casson Leighton
Details
list of pip packages installed in schroot (7.24 KB, text/plain)
2021-08-18 18:04 BST, Luke Kenneth Casson Leighton
Details
Patch to build symbiflow-arch-defs artix-7 (2.18 KB, patch)
2021-09-25 07:10 BST, Veera
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Luke Kenneth Casson Leighton 2021-06-28 11:27:39 BST
version of this needed:
https://carlosedp.medium.com/xilinx-open-source-fpga-toolchain-on-docker-containers-93202650a615

to be added to dev-env-setup:
https://git.libre-soc.org/?p=dev-env-setup.git;a=summary
Comment 1 Luke Kenneth Casson Leighton 2021-08-06 23:36:40 BST
https://twitter.com/gatecatte/status/1163742441272487936
Comment 2 Luke Kenneth Casson Leighton 2021-08-06 23:50:01 BST
looks like archlinux extracted the symbiflow xc7a100t (etc) already,
into an easy package:

https://aur.archlinux.org/packages/symbiflow-arch-defs-nightly-bin-device-xc7a100t/
Comment 3 Luke Kenneth Casson Leighton 2021-08-07 00:50:28 BST
https://symbiflow-examples.readthedocs.io/en/latest/building-examples.html#xilinx-7-series

TARGET="arty_100" make -C counter_test

fails: indicates "symbiflow_synth" command is missing, but there's
no information online how to get - or build - that command (!)

https://github.com/SymbiFlow/symbiflow-arch-defs/blob/master/xc/xc7/toolchain_wrappers/symbiflow_synth
Comment 5 Luke Kenneth Casson Leighton 2021-08-08 15:49:39 BST
https://github.com/SymbiFlow/symbiflow-examples/blob/master/xc7/environment.yml

vtr, prjxray-tools, prjxray-db, symbiflow-yosys-plugins and yosys all were
needed, opencd as well (debian package, there).  not risk5 gcc though.

https://github.com/SymbiFlow/symbiflow-examples/blob/master/xc7/requirements.txt

also needed, some of these also need checking if already
installed.

try _not_ to rely on pip3.  explicit git clone
(and checkout of specific version / tag) is better.
Comment 6 Luke Kenneth Casson Leighton 2021-08-18 17:42:23 BST
veera, i am assuming you'd be happy with another EUR 300 :)
this one is quite big, i did some research already so extra 100
for me.

a wiki page is needed which at the minimum lists all the dependencies
listed in environment.yaml and requirements.txt from comment #5.
thisis quite important because NOWHERE online are these listed!

then a devscript needed, i made some notes already, the notes to be
removed and replaced with the actual script.
Comment 7 Luke Kenneth Casson Leighton 2021-08-18 18:02:14 BST
Created attachment 137 [details]
dpkg list in chroot of debian pacakges installed
Comment 8 Luke Kenneth Casson Leighton 2021-08-18 18:04:14 BST
Created attachment 138 [details]
list of pip packages installed in schroot
Comment 10 Veera 2021-09-25 07:07:26 BST
I have successfully built Symbiflow with support for Xilinx Artix7_100T.
Here it is not using Conda and I have avoided as much as pip3 packages.

I have updated the https://libre-soc.org/HDL_workflow/symbiflow/ page for it.

You need a yosys-proc.patch file which I provide in next comment as attachment.

I use a git commit of Mar 23, 2021 of symbiflow-arch-defs. Latest commits have support for PCIE2, GPT and MMCME2_ADV which are causing build failure. I will further investigate and update to latest.

symbiflow-examples.git arty_100t counter test builds (bitstream) successfully.

As well as included counter test builds successfully both for artix7(a50t) and artix7_100t.

For now I am including in builds, prjxray-db from anaconda litex-hub pkg, though I have to try with database from upstream Symbiflow.
Comment 11 Veera 2021-09-25 07:10:43 BST
Created attachment 143 [details]
Patch to build symbiflow-arch-defs artix-7

This patch is needed for latest yosys to work with symbiflow package commands.

Above comment describes need for it.
Comment 12 Veera 2021-10-09 19:48:37 BST
Successfully built latest stable symbiflow-arch-defs (symbiflow toolchain).

For now Artix7_100t target:

 counter test: pass
 symbiflow-examples; counter test: pass
                     litex demo: pass
                     picosoc demo: pass
                     linux litex demo: pass

I have made a symbiflow-install dev-env-setup script.
uri: https://git.libre-soc.org/?p=dev-env-setup.git;a=blob_plain;f=symbiflow-install;hb=HEAD

Do build, install and test. And review, give feedback. If there are errors, report them, they will be trivial.
Comment 13 Luke Kenneth Casson Leighton 2021-10-09 20:47:50 BST
(In reply to vklr@vkten.in from comment #12)
> Successfully built latest stable symbiflow-arch-defs (symbiflow toolchain).

fantastic.

> Do build, install and test. And review, give feedback. If there are errors,
> report them, they will be trivial.

it's an enormous script, great work.  fetching wget (sigh) did however
timeout on apt-get update to ftp.uk.debian.org IPv6 lookup, which is
my ISP interfering again.  it worked the second time.  there's supposed
to be apt configs that do retries (etc) as part of mk-deb-chroot.

anyway that's not the symbiflow-install scripts' problem.

build underway, currently doing yosys.
Comment 14 Veera 2021-10-09 21:13:51 BST
Other steps are:

1) Building fasm with antlr (15 times faster)
2) vtr with oneTBB
     Though there have beens bugs with tbb but bugs were without it also.
     And Symbiflow team checks before release whether vtr works correctly.
Comment 15 Veera 2021-10-10 08:10:26 BST
Updated symbiflow-install script

Fix for one of vtr file install path, the capnp file missing:

-cp libs/libvtrcapnproto/gen/rr_graph_uxsdcxx.capnp /usr/local/symbiflow/share/vtr
+cp ../libs/libvtrcapnproto/gen/rr_graph_uxsdcxx.capnp /usr/local/symbiflow/share/vtr
Comment 16 Luke Kenneth Casson Leighton 2021-10-10 10:13:41 BST
interesting.

Installing collected packages: pycapnp
  Found existing installation: pycapnp 1.0.0b1
    Uninstalling pycapnp-1.0.0b1:
      Successfully uninstalled pycapnp-1.0.0b1
Successfully installed pycapnp-1.0.0b1
Reading package lists...
Building dependency tree...
Reading state information...
E: Unable to locate package python3-importlib-metadata
E: Unable to locate package python3-pyrsistent
E: Unable to locate package python3-zipp

Collecting python-fpga-interchange (from fasm2bels==0.0.1)
Could not install packages due to an EnvironmentError: 404 Client Error: Not Found for url: https://pypi.org/simple/python-fpga-interchange/

HEAD is now at c2c0f009 Merge pull request #2289 from antmicro/reduce-gh-bot-frequency
M       third_party/qlf-fasm
M       xc/xc7/tests/soc/CMakeLists.txt
CMake Error at CMakeLists.txt:1 (cmake_minimum_required):
  CMake 3.14.0 or higher is required.  You are running version 3.13.4


-- Configuring incomplete, errors occurred!
./symbiflow-install: line 280: cd: xc/xc7/archs/artix7_100t: No such file or directory
make: *** No rule to make target 'install'.  Stop.
make: *** No rule to make target 'PINMAP_INSTALL_arty100t-full_xc7a100t_test_arty100t-full_pinmap.csv'.  Stop.
cp: cannot stat 'arty100t-full_pinmap.csv': No such file or directory
Comment 17 Luke Kenneth Casson Leighton 2021-10-10 10:15:43 BST
drat, buster-backports is missing from the chroot.
not sure how that happened.
Comment 18 Luke Kenneth Casson Leighton 2021-10-10 10:23:13 BST
apt-get upgrade -y

noOoo, definitely don't do that :)

(edit: okok i stopped freaking out.  i added buster-backports)
Comment 19 Luke Kenneth Casson Leighton 2021-10-10 10:28:25 BST
https://github.com/SymbiFlow/python-fpga-interchange

looks like it'll have to be done from that.
best to pick a specific tag
https://github.com/SymbiFlow/python-fpga-interchange/tree/v0.0.18

(edit: added and committed)
Comment 20 Luke Kenneth Casson Leighton 2021-10-10 13:29:34 BST
https://git.libre-soc.org/?p=dev-env-setup.git;a=commitdiff;h=9acff23d8e121186233b1daafaba1645f910ae8e

however now i am at this error:

Generating rr_graph_xc7a100t_test.rr_graph.patched.bin
2021-10-10 10:33:12.641114 Starting routing import
Traceback (most recent call last):
  File "/home/lkcl/src/symbiflow/symbiflow-arch-defs/xc/common/utils/prjxray_routing_import.py", line 1433, in <module>
    main()
  File "/home/lkcl/src/symbiflow/symbiflow-arch-defs/xc/common/utils/prjxray_routing_import.py", line 1322, in main
    output_file_name=args.write_rr_graph,
  File "/home/lkcl/src/symbiflow/symbiflow-arch-defs/utils/lib/rr_graph_capnp/graph2.py", line 298, in __init__
    imports=[os.path.dirname(os.path.dirname(capnp.__file__))]
  File "capnp/lib/capnp.pyx", line 3973, in capnp.lib.capnp.load
  File "capnp/lib/capnp.pyx", line 3216, in capnp.lib.capnp.SchemaParser.load
OSError: File not found: /home/lkcl/src/symbiflow/symbiflow-arch-defs/env/conda/envs/symbiflow_arch_def_base/share/vtr/rr_graph_uxsdcxx.capnp
Comment 21 Luke Kenneth Casson Leighton 2021-10-10 13:38:46 BST
the file actually ended up in:

/usr/local/symbiflow/vtr/share/vtr/rr_graph_uxsdcxx.capnp
Comment 22 Veera 2021-10-10 13:55:43 BST
(In reply to Luke Kenneth Casson Leighton from comment #21)
> the file actually ended up in:
> 
> /usr/local/symbiflow/vtr/share/vtr/rr_graph_uxsdcxx.capnp

see https://bugs.libre-soc.org/show_bug.cgi?id=654#c15
Comment 23 Veera 2021-10-10 14:18:24 BST
(In reply to Luke Kenneth Casson Leighton from comment #20)
> https://git.libre-soc.org/?p=dev-env-setup.git;a=commitdiff;
> h=9acff23d8e121186233b1daafaba1645f910ae8e
> 
> however now i am at this error:
> 
> Generating rr_graph_xc7a100t_test.rr_graph.patched.bin
> 2021-10-10 10:33:12.641114 Starting routing import
> Traceback (most recent call last):
>   File
> "/home/lkcl/src/symbiflow/symbiflow-arch-defs/xc/common/utils/
> prjxray_routing_import.py", line 1433, in <module>
>     main()
>   File
> "/home/lkcl/src/symbiflow/symbiflow-arch-defs/xc/common/utils/
> prjxray_routing_import.py", line 1322, in main
>     output_file_name=args.write_rr_graph,
>   File
> "/home/lkcl/src/symbiflow/symbiflow-arch-defs/utils/lib/rr_graph_capnp/
> graph2.py", line 298, in __init__
>     imports=[os.path.dirname(os.path.dirname(capnp.__file__))]
>   File "capnp/lib/capnp.pyx", line 3973, in capnp.lib.capnp.load
>   File "capnp/lib/capnp.pyx", line 3216, in capnp.lib.capnp.SchemaParser.load
> OSError: File not found:
> /home/lkcl/src/symbiflow/symbiflow-arch-defs/env/conda/envs/
> symbiflow_arch_def_base/share/vtr/rr_graph_uxsdcxx.capnp

did you run these (script has it)

mkdir -p env/conda/envs
ln -s /usr/local/symbiflow env/conda/envs/symbiflow_arch_def_base
Comment 24 Luke Kenneth Casson Leighton 2021-10-10 14:23:38 BST
(In reply to vklr@vkten.in from comment #23)

> did you run these (script has it)
> 
> mkdir -p env/conda/envs
> ln -s /usr/local/symbiflow env/conda/envs/symbiflow_arch_def_base

by running the script, yes, those commands would have been run

currently up to here:

-- Build files have been written to: /home/lkcl/src/symbiflow/symbiflow-arch-defs/build
Scanning dependencies of target file_xc_xc7_archs_artix7_100t_channels_xc7a100tfgg676-1_channels.db
Generating channels/xc7a100tfgg676-1/channels.db, channels/xc7a100tfgg676-1/vpr_grid_map.csv
Comment 25 Veera 2021-10-10 14:36:50 BST
Have built vtr with tbb successfully and symbiflow also built with it successfully. Have to run symbiflow tests yet.

About fasm built with antlr backend, is not going to be possible by me. The fasm code is not mature yet with antlr backend. Building with antlr gives errors.
Comment 26 Veera 2021-10-10 17:33:52 BST
vtr with tbb reduces run time of vpr very much. I used env var VPR_NUM_WORKERS=68 on talos server. It reduced run time from 1 hour to 15-20 mins for symbiflow artix7(x50t) toolchain.

For artix7 (x50t) target:
 symbiflow toolchain build: pass
       counter test: pass
 symbiflow-examples:
       counter test: pass
       picosoc demo: pass
       linux litex demo: pass
       litex demo: pass

Both plain vtr and vtr with tbb can be installed in the system. Only PATH for vpr binary has to be adjusted.

So shall we install both or only one with option to select which? (in symbiflow-install)
Comment 27 Veera 2021-10-13 08:28:42 BST
Buster or Bullseye Openocd does not supports digilent arty board for bitstream programming.

This link may help: https://sourceforge.net/p/openocd/mailman/message/36196412/
Comment 28 Luke Kenneth Casson Leighton 2021-10-13 11:05:00 BST
(In reply to vklr@vkten.in from comment #23)

> >     imports=[os.path.dirname(os.path.dirname(capnp.__file__))]
> >   File "capnp/lib/capnp.pyx", line 3973, in capnp.lib.capnp.load
> >   File "capnp/lib/capnp.pyx", line 3216, in capnp.lib.capnp.SchemaParser.load
> > OSError: File not found:
> > /home/lkcl/src/symbiflow/symbiflow-arch-defs/env/conda/envs/
> > symbiflow_arch_def_base/share/vtr/rr_graph_uxsdcxx.capnp
> 
> did you run these (script has it)
> 
> mkdir -p env/conda/envs
> ln -s /usr/local/symbiflow env/conda/envs/symbiflow_arch_def_base

this exact same error occurs again after running the script exactly
as it is.

i wonder if the fact that the talos workstation is using debian/testing
has caused some other dependency to be fixed which is not fixed on
debian/buster.
Comment 29 Veera 2021-10-13 12:12:41 BST
(In reply to Luke Kenneth Casson Leighton from comment #28)
> (In reply to vklr@vkten.in from comment #23)
> 
> > >     imports=[os.path.dirname(os.path.dirname(capnp.__file__))]
> > >   File "capnp/lib/capnp.pyx", line 3973, in capnp.lib.capnp.load
> > >   File "capnp/lib/capnp.pyx", line 3216, in capnp.lib.capnp.SchemaParser.load
> > > OSError: File not found:
> > > /home/lkcl/src/symbiflow/symbiflow-arch-defs/env/conda/envs/
> > > symbiflow_arch_def_base/share/vtr/rr_graph_uxsdcxx.capnp
> > 
> > did you run these (script has it)
> > 
> > mkdir -p env/conda/envs
> > ln -s /usr/local/symbiflow env/conda/envs/symbiflow_arch_def_base
> 
> this exact same error occurs again after running the script exactly
> as it is.
> 

This happened to me also at start of this project. Do these to correct,

check that:
symbiflow-arch-defs/env/conda/envs are directories
symbiflow_arch_def_base is a symlink to /usr/local/symbiflow
/usr/local/symbiflow/share/vtr is a directory
copy rr_graph_uxsdcxx.capnp file from vtr-verilog-to-routing/libs/libvtrcapnproto/gen/rr_graph_uxsdcxx.capnp to /usr/local/symbiflow/share/vtr directory

And then rerun make install

> i wonder if the fact that the talos workstation is using debian/testing
> has caused some other dependency to be fixed which is not fixed on
> debian/buster.

I have created buster debootstrap in my home directory as per requirement of clean environment for finding dependencies and building.
Comment 30 Veera 2021-10-13 12:16:51 BST
Have updated https://libre-soc.org/HDL_workflow/symbiflow/ to latest instructions.

Updates:

* Latest symbiflow toolchain
* Building vtr-verilog-to-routing with tbb to speed up
* Instructions for symbiflow-examples ( Arty 35T and 100T )
   counter test 
   picosoc demo
   linux litex demo
* Instructions for building Litex Demo for Digilent Arty 35T and 100T
* Fixes in build instructions
Comment 31 Luke Kenneth Casson Leighton 2021-10-13 13:56:55 BST
(In reply to vklr@vkten.in from comment #26)
> vtr with tbb reduces run time of vpr very much. I used env var
> VPR_NUM_WORKERS=68 on talos server. It reduced run time from 1 hour to 15-20
> mins for symbiflow artix7(x50t) toolchain.

eek, that sounds like it'll completely hammer a machine with multiple processes,
let's not do that :)

> Both plain vtr and vtr with tbb can be installed in the system. Only PATH
> for vpr binary has to be adjusted.

okaaay.
 
> So shall we install both or only one with option to select which? (in
> symbiflow-install)

yes that's a great idea.
Comment 32 Veera 2021-10-17 14:04:22 BST
Have updated https://libre-soc.org/HDL_workflow/symbiflow/ to latest instructions.

Updates:

* Fixes in build instructions

Did a fresh debootstrap. Checked each instruction one by one. Hand coded all.
Comment 33 Veera 2021-10-17 14:09:31 BST
Updated symbiflow-install script.

https://git.libre-soc.org/?p=dev-env-setup.git;a=blob;f=symbiflow-install;h=93c1f1a7139bf3fd7e490c49a76e458c538d1fc3;hb=HEAD

Added build steps for TBB and using it with vtr for multi-threading. Give option to select TBB and vtr building.

Many other fixes.

I think this version will compile from start to finish without errors.
Not yet ran this script myself.
Comment 34 Veera 2021-10-18 09:58:13 BST
Again updated symbiflow-install script.

https://git.libre-soc.org/?p=dev-env-setup.git;a=blob;f=symbiflow-install;h=71fc6ffe087524ef6fc241eaedae8932da4ee446;hb=HEAD

Added git-man/buster to apt-get install command for git for it to run without errors. Yesterday it was not needed but today it is needed; another oldstable/buster miracle!

A minor shell line fix.

I ran this version in a chroot and it compiles from start to finish without errors.

Luke and others, kindly test and review it.
Comment 35 Luke Kenneth Casson Leighton 2022-02-02 21:02:03 GMT
hi veera, just to confirm i am now running symbiflow (now doing FPGA work)
i was able to compile and upload successfully from the symbiflow-examples

  export PATH=$PATH:"/usr/local/symbiflow/bin/"
  export PATH=$PATH:"/usr/local/symbiflow/yosys/bin/"
  export PATH=$PATH:"/usr/local/symbiflow/vtr/bin/"
  TARGET="arty_100" make  -C counter_test
  cd counter_test/build/
  cd arty_100/
  openocd -f /tmp/digilent_arty.cfg -c "init; pld load 0 top.bit; exit"