Skip to content

Use integer progress fractions#1959

Open
benma wants to merge 5 commits into
BitBoxSwiss:masterfrom
benma:progress
Open

Use integer progress fractions#1959
benma wants to merge 5 commits into
BitBoxSwiss:masterfrom
benma:progress

Conversation

@benma
Copy link
Copy Markdown
Collaborator

@benma benma commented Apr 23, 2026

No description provided.

@benma benma requested a review from NickeZ April 23, 2026 09:47
@benma benma mentioned this pull request Apr 23, 2026
@benma benma requested review from cedwies and removed request for NickeZ April 23, 2026 09:54
Copy link
Copy Markdown
Collaborator

@NickeZ NickeZ left a comment

Choose a reason for hiding this comment

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

tACK

Comment thread src/rust/bitbox02-rust/src/hww/api/bitcoin/signtx.rs
@benma
Copy link
Copy Markdown
Collaborator Author

benma commented May 12, 2026

Added two more commits with small fixes, PTAL @cedwies

(input_index as f32 + subprogress) * step
});
progress_component.set_fraction(
input_index * prevtx_total_ios + prevtx_input_index,
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

You already fixed the wrap around in C by using int64 instead of int32. What about here in rust?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

If we change params from u32 to u64 here, then in C it could overflow uint64_t 😂

Since no one is expected to run into this, I converted it to checked arithmetic that fails on overflow. See new commit.

benma added 5 commits May 18, 2026 17:06
Add an integer `set_fraction()` progress path through the HAL and UI layers,
and switch the live Bitcoin-signing and Bluetooth-upgrade progress updates to
use it.

The progress bar ultimately renders whole pixels, so the C progress component
now stores the filled pixel width directly and computes it with integer math.
This keeps the visible behavior intact while removing the Rust-side soft-float
`f32` arithmetic path that was only used for progress updates.

In the final firmware image this drops the live
`compiler_builtins::float::{add,div,mul}::<f32>` helpers together with the
associated `__aeabi_fadd`, `__aeabi_fdiv`, and `__aeabi_fmul` wrappers.

Savings: 1352 bytes
Extend .ci/check-unwanted-symbols with additional checks for linked
floating-point helpers in build/bin/firmware.elf.

Keep the existing float formatting, strftime, and sha2::Sha512 checks,
and add floating-point helper checks for the helpers removed by the
integer fee and progress commits. The f64 check is intentionally
scoped to comparison/conversion helpers because this branch still has
some double arithmetic helpers pulled in by the existing C
snprintf/newlib path.
Compute the filled pixel width with a 64-bit product so large valid fractions cannot wrap before division.
Render filled progress pixels within the inclusive screen bounds and
skip drawing when the filled width is zero.
@benma benma requested a review from cedwies May 18, 2026 15:07
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.

3 participants