lowRISC / opentitan

OpenTitan: Open source silicon root of trust
https://www.opentitan.org
Apache License 2.0
2.49k stars 742 forks source link

[FPGA] Error when generating FPGA synthesis scripts #23231

Open lmg260a opened 3 months ago

lmg260a commented 3 months ago

Description

I do not have a VM running Ubuntu, I only have a Container. I don't have ivado installed in the container, but I do have Vivado running on CentOS. I'd like to generate all the Vivado scripts inside the container, then execute them outside the container in CentOS. When I execute the following command, taken from https://opentitan.org/book/doc/getting_started/setup_fpga.html...

bazelisk.sh build --sandbox_debug //hw/bitstream/vivado:fpga_cw310_test_rom

I get this on STDOUT. I don't know how to root-cause the failure. I've been looking around but I didn't spot any appropriate error or log files, etc.

If Vivado installation is required, please let me know and please update the documentation to make that clear for future users.


Starting local Bazel server and connecting to it...
Loading: 
Loading: 
Loading: 
Loading: 2 packages loaded
Analyzing: target //hw/bitstream/vivado:fpga_cw310_test_rom (3 packages loaded, 0 targets configured)
Analyzing: target //hw/bitstream/vivado:fpga_cw310_test_rom (309 packages loaded, 6793 targets configured)
DEBUG: /opentitan_org/rules/autogen.bzl:151:14: NOTE: stamping is disabled, the chip_info section will use a fixed version string
Analyzing: target //hw/bitstream/vivado:fpga_cw310_test_rom (496 packages loaded, 26841 targets configured)
Analyzing: target //hw/bitstream/vivado:fpga_cw310_test_rom (598 packages loaded, 41490 targets configured)
INFO: Analyzed target //hw/bitstream/vivado:fpga_cw310_test_rom (600 packages loaded, 42303 targets configured).
INFO: Found 1 target...
INFO: Deleting stale sandbox base /home/ot_user1/.cache/bazel/_bazel_ot_user/de5905ce1a6c51190eb830628f418872/sandbox
[1 / 7] [Prepa] BazelWorkspaceStatusAction stable-status.txt
[46 / 115] checking cached actions
[944 / 945] [Prepa] FuseSoC hw/bitstream/vivado/build.fpga_cw310
[944 / 945] FuseSoC hw/bitstream/vivado/build.fpga_cw310; 1s processwrapper-sandbox
[944 / 945] FuseSoC hw/bitstream/vivado/build.fpga_cw310; 10s processwrapper-sandbox
ERROR: /opentitan_org/hw/bitstream/vivado/BUILD:39:14: FuseSoC hw/bitstream/vivado/build.fpga_cw310 failed: (Exit 1): process-wrapper failed: error executing command 
  (cd /home/ot_user1/.cache/bazel/_bazel_ot_user/de5905ce1a6c51190eb830628f418872/sandbox/processwrapper-sandbox/1/execroot/lowrisc_opentitan && \
  exec env - \
    HOME=/home/ot_user1 \
    PATH=/home/ot_user1/.cache/bazelisk/downloads/bazelbuild/bazel-6.2.1-linux-x86_64/bin:/home/ot_user1/.local/bin:/opentitan_org/verilator/4.210/bin:/opentitan_org/lowrisc_rv32icmb/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin \
    PYTHONPATH='' \
    TMPDIR=/tmp \
    XILINXD_LICENSE_FILE='' \
    XILINX_HLS='' \
    XILINX_VIVADO='' \
  /home/ot_user1/.cache/bazel/_bazel_ot_user/install/50a5a3eaeaa5297d31568ab6a3a702d9/process-wrapper '--timeout=0' '--kill_delay=15' '--stats=/home/ot_user1/.cache/bazel/_bazel_ot_user/de5905ce1a6c51190eb830628f418872/sandbox/processwrapper-sandbox/1/stats.out' bazel-out/k8-opt-exec-2B5CBBC6/bin/util/fusesoc_build '--cores-root=.' run '--flag=fileset_top' '--target=synth' --setup --build '--build-root=bazel-out/k8-fastbuild/bin/hw/bitstream/vivado/build.fpga_cw310' lowrisc:systems:chip_earlgrey_cw310 '--BootRomInitFile=../../../../../../../../../../bazel-out/k8-fastbuild-ST-2cc462681f62/bin/sw/device/lib/testing/test_rom/test_rom_fpga_cw310.39.scr.vmem' '--OtpCtrlMemInitFile=../../../../../../../../../../bazel-out/k8-fastbuild/bin/hw/ip/otp_ctrl/data/img_rma.24.vmem')
I
hcallahan-lowrisc commented 1 month ago

Hi @lmg260a,

Did you come up with another solution for this?

Yes the command you were trying to execute does indeed require Vivado. (All bazel targets under //hw/bitstream/ are fpga bitstreams, in this case the vivado in the target name means using vivado to build an EarlGrey bitstream for the CW310 board (Kintex K410T) with a test-rom spliced into the image).

Currently we don't support generating scripts that can be run externally for this. Bazel is responsible for invoking fusesoc which then invokes vivado, and this probably won't change in the future. Bazel manages the build flow, so we can't just break outside of that to run certain steps manually unfortunately. If you can install Vivado yourself, one option might be to append the vivado installation to the OpenTitan development container dockerfile, and then Bazel will invoke Vivado in headless-mode when building. There are instructions online on how you can do this.

If this is not possible, could you let me know a bit about your environment restrictions that might make running the OpenTitan flows difficult for you? I can't promise to fix everything, but it helps us anticipate problems. Managing the web of proprietary dependencies and locked-down environments is a continual challenge :)


Re. your original error, there is a missing vivado error way down the STDOUT. I just tested locally, and reproduced the following error...

$ bazel build --sandbox_debug //hw/bitstream/vivado:fpga_cw310_test_rom

...
<snip>
...

ERROR: /home/harry/projects/opentitan/hw/bitstream/vivado/BUILD:39:14: FuseSoC hw/bitstream/vivado/build.fpga_cw310 failed: (Exit 1): linux-sandbox failed: error executing command 
  (cd /home/harry/.cache/bazel/_bazel_harry/6aecaaad7827b990b88d034b9d0ce702/sandbox/linux-sandbox/665/execroot/lowrisc_opentitan && \
  exec env - \

...
<snip ~300 lines>
...

INFO: Building
INFO: vivado -notrace -mode batch -source lowrisc_systems_chip_earlgrey_cw310_0.1.tcl

ERROR: make: vivado: No such file or directory
make: *** [Makefile:8: lowrisc_systems_chip_earlgrey_cw310_0.1.xpr] Error 127

ERROR: Failed to build lowrisc:systems:chip_earlgrey_cw310:0.1 : '['make']' exited with an error: 2

...
<snip>
...
lmg260a commented 1 month ago

Hi Harry! I'll try out getting Vivado installed in the Container.

Thanks, Erik

Sent with Proton Mail secure email.

On Sunday, July 14th, 2024 at 3:23 PM, Harry Callahan @.***> wrote:

Hi @.***(https://github.com/lmg260a),

Did you come up with another solution for this?

Yes the command you were trying to execute does indeed require Vivado. (All bazel targets under //hw/bitstream/ are fpga bitstreams, in this case the vivado in the target name means using vivado to build an EarlGrey bitstream for the CW310 board (Kintex K410T) with a test-rom spliced into the image).

Currently we don't support generating scripts that can be run externally for this. Bazel is responsible for invoking fusesoc which then invokes vivado, and this probably won't change in the future. Bazel manages the build flow, so we can't just break outside of that to run certain steps manually unfortunately. If you can install Vivado yourself, one option might be to append the vivado installation to the OpenTitan development container dockerfile, and then Bazel will invoke Vivado in headless-mode when building. There are instructions online on how you can do this.

If this is not possible, could you let me know a bit about your environment restrictions that might make running the OpenTitan flows difficult for you? I can't promise to fix everything, but it helps us anticipate problems. Managing the web of proprietary dependencies and locked-down environments is a continual challenge :)


Re. your original error, there is a missing vivado error way down the STDOUT. I just tested locally, and reproduced the following error...

$ bazel build --sandbox_debug //hw/bitstream/vivado:fpga_cw310_test_rom

...

<

snip

...

ERROR: /home/harry/projects/opentitan/hw/bitstream/vivado/BUILD:39:14: FuseSoC hw/bitstream/vivado/build.fpga_cw310 failed: (Exit 1): linux-sandbox failed: error executing

command

(cd /home/harry/.cache/bazel/_bazel_harry/6aecaaad7827b990b88d034b9d0ce702/sandbox/linux-sandbox/665/execroot/lowrisc_opentitan

&&

\

exec

env - \

...

<

snip

~

300 lines

...

INFO: Building INFO: vivado -notrace -mode batch -source lowrisc_systems_chip_earlgrey_cw310_0.1.tcl

ERROR: make: vivado: No such file or directory make:


[Makefile:8: lowrisc_systems_chip_earlgrey_cw310_0.1.xpr] Error 127

ERROR: Failed to build lowrisc:systems:chip_earlgrey_cw310:0.1

:

'

[

'

make

'

]

'

exited with an error: 2

...

<

snip

...

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.Message ID: @.***>