lowRISC / lowRISC/opentitan

[CW340] Hello World Demo on CW340 returns SPI connection error, despite successful build and bitstream load.

Open
#26,603 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
SystemVerilog
Stars
3.6k
Forks
1.1k
Avg merge
2d 22h
Merged PRs (30d)
141

Description

Description

I am trying to run the hello world demo test following the FPGA build guide: https://opentitan.org/book/doc/getting_started/setup_fpga.html#flash-the-bitstream-onto-the-fpga-and-bootstrap-software-into-flash. I am able to load the bitstream with:

./bazelisk.sh run //sw/host/opentitantool -- fpga load-bitstream /tmp/bitstream-latest/chip_earlgrey_cw340/lowrisc_systems_chip_earlgrey_cw340_0.1.bit

which returns:

opentitan@bxqp8b3-ub22:~/Documents/opentitan$ ./bazelisk.sh run //sw/host/opentitantool -- fpga load-bitstream /tmp/bitstream-latest/chip_earlgrey_cw340/lowrisc_systems_chip_earlgrey_cw340_0.1.bit
INFO: Analyzed target //sw/host/opentitantool:opentitantool (0 packages loaded, 0 targets configured).
INFO: Found 1 target...
INFO: Elapsed time: 0.207s, Critical Path: 0.02s
INFO: 1 process: 1 internal.
INFO: Build completed successfully, 1 total action
INFO: Running command line: bazel-bin/sw/host/opentitantool/opentitantool
[00:00:20] [██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████] 34.18 MiB/34.18 MiB (0s)

Then the build command runs successfully:

opentitan@bxqp8b3-ub22:~/Documents/opentitan$ bazel build //sw/device/examples/hello_world
DEBUG: /home/opentitan/Documents/opentitan/rules/autogen.bzl:452:14: NOTE: stamping is disabled, the chip_info section will use a fixed version string
INFO: Analyzed target //sw/device/examples/hello_world:hello_world (0 packages loaded, 1414 targets configured).
INFO: Found 1 target...
Target //sw/device/examples/hello_world:hello_world up-to-date:
bazel-bin/sw/device/examples/hello_world/hello_world_fpga_cw310.bin
bazel-bin/sw/device/examples/hello_world/hello_world_fpga_cw310.elf
bazel-bin/sw/device/examples/hello_world/hello_world_fpga_cw310.dis
bazel-bin/sw/device/examples/hello_world/hello_world_fpga_cw310.map
bazel-bin/sw/device/examples/hello_world/hello_world_fpga_cw340.bin
bazel-bin/sw/device/examples/hello_world/hello_world_fpga_cw340.elf
bazel-bin/sw/device/examples/hello_world/hello_world_fpga_cw340.dis
bazel-bin/sw/device/examples/hello_world/hello_world_fpga_cw340.map
bazel-bin/sw/device/examples/hello_world/hello_world_sim_dv.64.scr.vmem
bazel-bin/sw/device/examples/hello_world/hello_world_sim_dv.elf
bazel-bin/sw/device/examples/hello_world/hello_world_sim_dv.dis
bazel-bin/sw/device/examples/hello_world/hello_world_sim_dv.map
bazel-bin/sw/device/examples/hello_world/hello_world_sim_dv.logs.txt
bazel-bin/sw/device/examples/hello_world/hello_world_sim_dv.rodata.txt
bazel-bin/sw/device/examples/hello_world/hello_world_sim_dv.64.vmem
bazel-bin/sw/device/examples/hello_world/hello_world_sim_verilator.64.vmem
bazel-bin/sw/device/examples/hello_world/hello_world_sim_verilator.elf
bazel-bin/sw/device/examples/hello_world/hello_world_sim_verilator.dis
bazel-bin/sw/device/examples/hello_world/hello_world_sim_verilator.map
INFO: Elapsed time: 0.576s, Critical Path: 0.06s
INFO: 1 process: 1040 action cache hit, 1 internal.
INFO: Build completed successfully, 1 total action

Then when attempting hello world demo:

opentitan@bxqp8b3-ub22:~/Documents/opentitan$ bazel run //sw/host/opentitantool -- bootstrap "$(ci/scripts/target-location.sh //sw/device/examples/hello_world | grep fpga_${BOARD}.bin)"
INFO: Analyzed target //sw/host/opentitantool:opentitantool (0 packages loaded, 1281 targets configured).
INFO: Found 1 target...
INFO: Elapsed time: 0.406s, Critical Path: 0.04s
INFO: 1 process: 986 action cache hit, 1 internal.
INFO: Build completed successfully, 1 total action
INFO: Running command line: bazel-bin/sw/host/opentitantool/opentitantool
Error: SFDP header contains incorrect signature: 0xffffffff

This is after applying the change in location-target.sh:
From: REL_PATH=$(${REPO_TOP}/bazelisk.sh outquery "$@" 2>$REDIR)
To: REL_PATH=$(${REPO_TOP}/bazelisk.sh cquery --output=files "$@" 2>$REDIR)

Any advice or help to resolve the SPI issue and get the hello world test up and running?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the FPGA setup guide, the sw/host/opentitantool bootstrap entry point, and ci/scripts/target-location.sh. Reproduce the CW340 bootstrap command and investigate the SFDP header contains incorrect signature: 0xffffffff result. Done means the bootstrap completes without the SPI error and the hello world demo runs on the CW340.

Written by the indexing model from the issue text.

Assessment

Tech stack
shell
Domain
embedded-iot
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.