lowRISC / lowRISC/opentitan

[opentitanlib] CW310 not detected in rootless podman container

Open
#17,569 13 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Earlgrey-PROD Candidate SW:opentitantool
Dominant language
SystemVerilog
Stars
3.6k
Forks
1.1k
Avg merge
2d 22h
Merged PRs (30d)
141

Description

When running an OpenTitan container with rootless podman, opentitanlib does not detect a CW310 even if its devices are correctly mapped into the container (with --device=/dev/ttyXXX and --device=/dev/bus/usb/YYY) and permissions inside and outside the container allow read and write access to all devices from inside the container. The error messages I have seen are Command result: Transport does not support the requested operation or Error: Transport does not support Gpio.

A workaround is to create an rcfile for opentitantool (default location: ~/.config/opentitantool/config) and add the following settings to it:

--cw310-uarts=/dev/ttyACM2,/dev/ttyACM1
--interface=cw310

The TTY filenames depend on the setup of host and container. In my experience, CW310 comes with two TTYs and those have to be listed in descending numeric order. (If a Husky is additionally attached, its TTY has a number just above those of the CW310.) This may depend on your udev mechanisms/rules, though, so some experimentation may be required to get it right.

With this, you should now be able to program the FPGA and load and execute a binary. For example,

bazel build //sw/device/examples/hello_world:hello_world_fpga_cw310_bin
bazel run //sw/host/opentitantool -- bootstrap $(ci/scripts/target-location.sh //sw/device/examples/hello_world:hello_world_fpga_cw310_bin)

should not present any errors.

bazel test execution on the FPGA won't work out of the box, though; see https://github.com/lowRISC/opentitan/issues/17567 for further information and a workaround.

I haven't debugged this further and don't expect that someone else does so at this point; I just wanted to share this for visibility and a possible workaround.

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 by reproducing rootless Podman execution with the mapped CW310 TTY and USB devices, then compare detection with the opentitantool rcfile workaround. Use the mentioned bazel build and bazel run commands to verify programming and execution; done would mean CW310 detection works without manually setting --cw310-uarts and --interface.

Written by the indexing model from the issue text.

Assessment

Domain
embedded-iot, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.