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

add a CLI for encoding/decoding register content #17

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

jonathannilsen
Copy link
Collaborator

@jonathannilsen jonathannilsen commented Nov 21, 2024

The current CLI looks like this (when installed as svada[cli]):

usage: svada content-gen [--help] (-j | -h | -t) [-i INPUT_FILE] -s SVD_FILE
                         [-n] [--svd-parse-options SVD_PARSE_OPTIONS] [-p NAME]
                         [-a START END] [-c {any,written,modified}]
                         (-J | -B | -H | -T) [-o OUTPUT_FILE]

Encode device content from one of the supported formats and output it to another
supported format.

options:
  --help                Print help message

input options:
  -j, --in-json         Input is in JSON format.
  -h, --in-hex          Input is in Intel HEX format.
  -t, --in-toml         Input is in TOML format.
  -i INPUT_FILE, --input-file INPUT_FILE
                        File to read the input from. If not given, stdin is
                        used.

SVD options:
  -s SVD_FILE, --svd-file SVD_FILE
                        Path to the device SVD file.
  -n, --no-strict       Don't enforce constraints on register and field values
                        based on the SVD file.
  --svd-parse-options SVD_PARSE_OPTIONS
                        JSON object used to override fields in the Options
                        object to customize svada parsing behavior. Mainly
                        intended for advanced use cases such as working around
                        difficult SVD files.

selection options:
  -p NAME, --peripheral NAME
                        Limit output content to the given peripheral. May be
                        given multiple times.
  -a START END, --address-range START END
                        Limit output to a specific address range. Addresses can
                        be given as hex or decimal.
  -c {any,written,modified}, --content-status {any,written,modified}
                        Limit output based on the status of the register
                        content.

output options:
  -J, --out-json        Output in JSON format.
  -B, --out-bin         Output in binary format.
  -H, --out-hex         Output in Intel HEX format.
  -T, --out-toml        Output in TOML format.
  -o OUTPUT_FILE, --output-file OUTPUT_FILE
                        File to write the output to. If not given, output is
                        written to stdout.

Adds a utility module with helpers for populating and outputting
device memory.

The following formats are supported for input/output:
* A dict mapping address -> value (at a byte level)
* A dict mapping a device-like structure to register/field values

The following format is currently only supported for output:
* A bytearray containing device memory

The APIs for generating outputs offer a flexible "selector"
mechanism that lets the user decide which part of the device to
output.

Signed-off-by: Jonathan Nilsen <[email protected]>
Add a CLI intended for various utility scripts.
For now there is a single command that can be used to generate
register content descriptions.

Signed-off-by: Jonathan Nilsen <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant