Automate .bit file creation by command line
Aug 02, 2019
asked by Tanguy
Question / Issue:
Hello,
I've found your website because of this page https://mindchasers.com/dev/tools-diamond-git.
Beside versioning a lattice project on git, we'd like also to generate .bit files by command line in order to automate.
Have you done this?
Kind regards,
Tanguy
Responses:
Date: Aug. 2, 2019
Author: Mind Chasers
Comment:
We had the same goal a couple years ago and found that the command line tools don't work properly on Windows 10 using PowerShell.
You can find the commands that were run in Diamond by either looking in the individual Process Reports or view the automake.log file under the impl folder.
For our project and Bit generation, you can find the command:
Command: bitgen -w -g CfgMode:Disable -g RamCfg:Reset -g DisableUES:FALSE -g ES:No -e -s C:/projects/lattice/privateisland/privateisland.sec -k C:/projects/lattice/privateisland/privateisland.bek -gui -msgset C:/projects/lattice/privateisland/promote.xml privateisland_impl1.ncd privateisland_impl1.prf
The default location for bitgen is C:\lscc\diamond\3.11_x64\ispfpga\bin\nt64
However, when we try running bitgen in PowerShell, it throws an exception:
PS C:\lscc\diamond\3.11_x64\ispfpga\bin\nt64> bitgen
Exception Condition ID=0000000: core file C:\Users\...\AppData\Local\Temp\lsc_diamond_1556.dmp is generated
fails to load message index file msgindex.xml.
...
We have tried working around it by adding various paths to $env:PATH, but we haven't found a way to get it to work. Perhaps developers more experienced in configuring Windows 10 can find a work around.
We reported this problem awhile back. We'll do it again and post back if we find a fix / workaround either on our own or from Lattice. Please let us know if you get it working and how you did it.
BTW, you can probably do something similar with tcl, but we don't use it.
Date: Aug. 6, 2019
Author: Tanguy Mezzano
Comment:
Hello Mind Chasers,
Thank you for the tips.
I'm facing the same issue: fails to load message index file msgindex.xml.
In fact any exe file event without arguments in the ispfpga directory gives the same exception.
I've sent an email to lattice support.
I've managed to generate my .bit files by using tcl but it requires a X display as it's opening diamond to run tcl commands:
C:\lscc\diamond\3.10_x64\bin\nt64>pnwrap.exe -t tcl.txt
With the following content for tcl.txt:
prj_project open "C:/Users/Mezzano/Desktop/test/lvds_to_mipi.ldf"
sbp_design open -dsgn "C:/Users/Mezzano/Desktop/test/lvds_to_mipi/lvds_to_mipi.sbx"
set currentPath [pwd];set tmp_autopath $auto_path
cd "C:/Users/Mezzano/Desktop/test/lvds_to_mipi/lvdstomipi"
source "C:/Users/Mezzano/Desktop/test/lvds_to_mipi/lvdstomipi/generate_core.tcl"
set auto_path $tmp_autopath;cd $currentPath
prj_run Export -impl impl1
Kind regards
Date: Aug. 7, 2019
Author: Tanguy
Comment:
I've created a ticket on lattice support website:
https://lattice.agiloft.com/gui2/record/edit.do;en;page=1746FB3F5DDCD8469188AEDCABBFA8930012;CSRF_NONCE=1A7629973857D79B068FDE5BEE501964?_mode=view&_unifier=6732&_recordId=90052&_prevTarget=close
Date: Aug. 8, 2019
Author: Tanguy
Comment:
Hi,
To avoid having the exception, you need to specify the FOUNDRY variable with the ispfpga path.
Check out this url in order to generate .bit files in command line.
https://github.com/SymbiFlow/prjtrellis/blob/master/diamond.sh
We can now integrate that process in our CI.
Kind regards
Date: Aug. 8, 2019
Author: Mind Chasers
Comment:
Well done Tanguy! Yes, this works for us on Windows 10 with Diamond. As you described, we set a FOUNDRY environment variable to point to the isfpga path using Control Panel->System and Security -> System -> Advanced System Settings. After setting the environment variable, we launched PowerShell, and the command line interface worked without throwing exceptions.
It looks like you have identified a Lattice bug. Shouldn't they test for the FOUNDRY environment variable and print to stderr when it's not set?
We're still developing our forum code, and we'll soon have your post marked as an accepted answer. Thanks again!