Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[opentitantool] Convenience for external programs #25358

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

jesultra
Copy link
Contributor

Add two new commands to opentitantool: spi flashrom-arg and uart os-device, which can be used for heling external programs access HyperDebug (or some other backend devices) without going through opentitanlib, while still using the usb-serial and port aliases from our configuration files to identify the debugger and port.

$ opentitantool --conf ... --usb-serial 2042355F3236 spi --bus=BOOTSTRAP flashrom-args
{
  programmer: "raiden_debug_spi:serial=2042355F3236,target=2"
}
$ opentitantool --conf ... --usb-serial 2042355F3236 uart --uart=EC os-device
{
  path: "/dev/ttyUSB6"
}

@jesultra jesultra requested a review from a team as a code owner November 22, 2024 19:48
@jesultra jesultra added SW:opentitantool CherryPick:earlgrey_es_sival This PR should be cherry-picked to earlgrey_es_sival CherryPick:earlgrey_1.0.0 This PR should be cherry-picked to earlgrey_1.0.0 labels Nov 22, 2024
Some transports/debuggers expose the SPI ports in a way that can be
accessed by the flashrom program, without going through opentitanlib.

This CL introduces a new `flashrom-args` command under `spi`:

```
opentitantool --conf ... --usb-serial 2042355F3236 spi --bus=SPI1 flashrom-args
{
  programmer: "raiden_debug_spi:serial=2042355F3236,target=2"
}
```

This can be used in cases where the flashrom program better knows how to
communicate with e.g. the SPI flash chip mounted on the OpenTitan
development shield, in order to quickly load some data into it as part
of setup before testing code on the OpenTitan chip.

Signed-off-by: Jes B. Klinke <[email protected]>

Change-Id: I9511b449f303a5f0cd901dac19ce9654209b3fd1
Some transports/debuggers expose the serial ports in a way that can be
accessed by other programs, without necessarily going through
opentitanlib.

This CL introduces a new `uart` top level command and `os-device` under
it, (in hindsigt, `console` and `rescue` probably beloned under the same
top-level, in order to share some flag processing.)

The idea is that `opentitantool` can be queried, using a set of
configuration file with aliases and command line usb serial number, and
will print the path of the underlying OS device corresponding to the
given port of the given debugger:

```
opentitantool --conf ... --usb-serial ... uart --uart=EC os-device
{
  path: "/dev/ttyUSB6"
}
```

This can be used in cases where processing of output from the OpenTitan
chip takes place in external scripts or programs.  Such cases currently
will have to use an `opentitantool console` process to pass data between
the serial device and its stdin/stdout pipes to the actual script doing
the actual processing, which is wasteful.

Change-Id: Id4dfff38fbc74ec65366d3a7e49a6844ae52c8ee
Signed-off-by: Jes B. Klinke <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CherryPick:earlgrey_es_sival This PR should be cherry-picked to earlgrey_es_sival CherryPick:earlgrey_1.0.0 This PR should be cherry-picked to earlgrey_1.0.0 SW:opentitantool
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant