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

List field desciptions if field is matching #174

Merged
merged 2 commits into from
Nov 20, 2024
Merged

List field desciptions if field is matching #174

merged 2 commits into from
Nov 20, 2024

Conversation

will-v-pi
Copy link
Contributor

With otp list, show field descriptions if a field is matched, or if the -f flag is set:

$ picotool otp list crit1
ROW 0x0040: OTP_DATA_CRIT1
        "Page 1 critical boot flags (RBIT-8)"
    field GLITCH_DETECTOR_SENS (bits 5-6)
    field GLITCH_DETECTOR_ENABLE (bit 4)
    field BOOT_ARCH (bit 3)
    field DEBUG_DISABLE (bit 2)
    field SECURE_DEBUG_DISABLE (bit 1)
    field SECURE_BOOT_ENABLE (bit 0)
$ picotool otp list crit1 -f
ROW 0x0040: OTP_DATA_CRIT1
        "Page 1 critical boot flags (RBIT-8)"
    field GLITCH_DETECTOR_SENS (bits 5-6)
        "Increase the sensitivity of the glitch detectors from their default."
    field GLITCH_DETECTOR_ENABLE (bit 4)
        "Arm the glitch detectors to reset the system if an abnormal clock/power event is observed."
    field BOOT_ARCH (bit 3)
        "Set the default boot architecture, 0=ARM 1=RISC-V. Ignored if ARM_DISABLE, RISCV_DISABLE or SECURE_BOOT_ENABLE is set."
    field DEBUG_DISABLE (bit 2)
        "Disable all debug access"
    field SECURE_DEBUG_DISABLE (bit 1)
        "Disable Secure debug access"
    field SECURE_BOOT_ENABLE (bit 0)
        "Enable boot signature enforcement, and permanently disable the RISC-V cores."
$ picotool otp list crit1.boot_arch
ROW 0x0040: OTP_DATA_CRIT1
        "Page 1 critical boot flags (RBIT-8)"
    field BOOT_ARCH (bit 3)
        "Set the default boot architecture, 0=ARM 1=RISC-V. Ignored if ARM_DISABLE, RISCV_DISABLE or SECURE_BOOT_ENABLE is set."

Fixes #134

@will-v-pi will-v-pi linked an issue Nov 12, 2024 that may be closed by this pull request
@will-v-pi will-v-pi added this to the 2.1.0 milestone Nov 12, 2024
main.cpp Outdated Show resolved Hide resolved
@lurch
Copy link
Contributor

lurch commented Nov 15, 2024

I wonder if the "row description" should be less indented than the "field description", to make them more visually distinct? e.g.

$ picotool otp list crit1 -f
ROW 0x0040: OTP_DATA_CRIT1
    "Page 1 critical boot flags (RBIT-8)"
    field GLITCH_DETECTOR_SENS (bits 5-6)
        "Increase the sensitivity of the glitch detectors from their default."
    field GLITCH_DETECTOR_ENABLE (bit 4)
        "Arm the glitch detectors to reset the system if an abnormal clock/power event is observed."

@will-v-pi
Copy link
Contributor Author

I wonder if the "row description" should be less indented than the "field description", to make them more visually distinct?

It might be better to just add a newline instead, so it still matches the otp get command?

$ picotool otp get crit1
ROW 0x0040: OTP_DATA_CRIT1
        "Page 1 critical boot flags (RBIT-8)"

    VALUE 0x000000

    field GLITCH_DETECTOR_SENS (bits 5-6) = 0
        "Increase the sensitivity of the glitch detectors from their default."
    field GLITCH_DETECTOR_ENABLE (bit 4) = 0
        "Arm the glitch detectors to reset the system if an abnormal clock/power event is observed."
    field BOOT_ARCH (bit 3) = 0
        "Set the default boot architecture, 0=ARM 1=RISC-V. Ignored if ARM_DISABLE, RISCV_DISABLE or SECURE_BOOT_ENABLE is set."
    field DEBUG_DISABLE (bit 2) = 0
        "Disable all debug access"
    field SECURE_DEBUG_DISABLE (bit 1) = 0
        "Disable Secure debug access"
    field SECURE_BOOT_ENABLE (bit 0) = 0
        "Enable boot signature enforcement, and permanently disable the RISC-V cores."

@will-v-pi
Copy link
Contributor Author

Actually adding a newline makes it less readable when you have multiple fields - I think it's best to leave it as-is, as that's more visually distinct than having the same indent as the field names

@will-v-pi will-v-pi merged commit dcff4d0 into develop Nov 20, 2024
35 checks passed
@will-v-pi will-v-pi deleted the list-fields branch November 20, 2024 14:23
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.

Include field descriptions for picotool otp list
3 participants