Skip to content

Display uf2 combine --offset default-value in hexadecimal - #353

Merged
will-v-pi merged 5 commits into
developfrom
lurch-patch-2
Sep 7, 2026
Merged

Display uf2 combine --offset default-value in hexadecimal#353
will-v-pi merged 5 commits into
developfrom
lurch-patch-2

Conversation

@lurch

@lurch lurch commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

Possible fix for #352

@lurch lurch linked an issue Jul 27, 2026 that may be closed by this pull request
Comment thread main.cpp Outdated
Comment thread README.md Outdated
@will-v-pi will-v-pi added this to the 2.4.0 milestone Aug 12, 2026
will-v-pi and others added 3 commits August 13, 2026 13:55
Co-authored-by: will-v-pi <108662275+will-v-pi@users.noreply.github.com>
Comment thread README.md
--minor <minor>
Add Minor Version
--rollback <rollback> [<rows>..]
Add Rollback Version

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The rollback stuff is stored in OTP, right? So why is this using hex numbers when https://github.com/raspberrypi/picotool#setget appears to be using decimal numbers? (Or do the OTP docs also need to be updated to specify hexadecimal numbers? 🤷 )

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure where the decimal row numbers are in the docs? Rows can be indexed by hex or decimal for set/get, but the output always prints hex:

$ picotool otp list 0x40
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 64
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

Same goes for PAGE:PAGE_ROW_NUMBER selectors - 1:0x11, 1:17, 0x1:17 etc all target the same row

This --rollback argument is using hex rows for simplicity, as the default rows are OTP_DATA_DEFAULT_BOOT_VERSION0_ROW=0x4e and OTP_DATA_DEFAULT_BOOT_VERSION1_ROW=0x51

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rows can be indexed by hex or decimal

Ahhh okay, that's the bit I was missing. As it doesn't say "hexadecimal", that's why I was assuming it was decimal-only. But perhaps it's worth tweaking the OTP section of the docs to clarify that the row and page numbers can be specified in either decimal or hex?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All regular integer arguments in picotool can be specified as hex or dec (or binary) (see integer::parse_string in cli.h, so I don't think that it is necessary to state that these selector fields also support hex or dec, given the output prints row numbers in hex anyway (for set/get/list and dump)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is that actually mentioned in the README, or do people need to read the source-code to discover that? 😉

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not that I can see in the README, but anyway, I think that's a separate issue - this PR is about hex arguments which always treat values as hex (i.e. 1234 is treated as 0x1234), whereas this discussion is about integer arguments which are treated as decimal unless a 0x or 0b prefix. The hex ones are the only ones with non-default behaviour, hence being good to have explicit documentation, integer behaves like you would expect it to behave.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not that I can see in the README, but anyway, I think that's a separate issue

Haha, fair enough, sorry for going off-topic.

@will-v-pi
will-v-pi merged commit 6b8b68a into develop Sep 7, 2026
48 checks passed
@will-v-pi
will-v-pi deleted the lurch-patch-2 branch September 7, 2026 13:41
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.

uf2 combine: --offset representation

2 participants