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

Simplify VFS initialization #569

Merged
merged 2 commits into from
Dec 16, 2024
Merged

Simplify VFS initialization #569

merged 2 commits into from
Dec 16, 2024

Conversation

sosthene-nitrokey
Copy link
Collaborator

Can be improved further once trussed-dev/littlefs2#87 is merged.

@@ -23,7 +23,7 @@ littlefs2-core = "0.1"
# Backends
trussed-auth = { version = "0.3.0", optional = true }
trussed-rsa-alloc = { version = "0.2.0", optional = true }
trussed-se050-backend = { version = "0.3.6", optional = true }
trussed-se050-backend = { version = "0.3.6", optional = true, features = ["log-all"] }
Copy link
Member

Choose a reason for hiding this comment

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

probably debugging artifact?

Comment on lines 198 to 200
static mut VOLATILE_STORAGE: VolatileStorage = VolatileStorage {
buf: [0; 8192],
};
Copy link
Member

Choose a reason for hiding this comment

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

Why not VolatileStorage::new()?

@nitrokey-ci
Copy link
Collaborator

nitrokey-ci commented Dec 10, 2024

No significant changes.

Insignifcant changes
metric value change
binary-size-nk3am 1,502,577 -217 (-0.01%)
binary-size-nk3am-test 1,880,394 -119 (-0.01%)
binary-size-nk3xn 539,984 -316 (-0.06%)
binary-size-nk3xn-test 540,080 -316 (-0.06%)
binary-size-nkpk 712,451 -590 (-0.08%)

@robin-nitrokey
Copy link
Member

Note sure what causes the binary size change. I cannot reproduce it locally.

@sosthene-nitrokey
Copy link
Collaborator Author

I do not understand the size increase. On the opposite I would have expected a size decrease.

@robin-nitrokey
Copy link
Member

My first guess was that maybe the build environment changed and caused the size change, but running the CI for a no-op PR like #240 does not cause a size difference.

@sosthene-nitrokey
Copy link
Collaborator Author

I can reproduce the size change locally.  My first thought was a missing rebase but it's not that.

@robin-nitrokey
Copy link
Member

I only checked the output of make bloat locally, not of the binary size. It is quite the coincidence that the volatile storage size is 8192 and the size change is e. g. 8176. It looks like this is just the size of the initializer? Using a MaybeUninit to defer initialization to runtime could help.

@sosthene-nitrokey
Copy link
Collaborator Author

Yes it looks like it was that. It's including the full zeros of the static? That's not good. As a result using MaybeUninit improves the binary size by the couple of relevant bytes.

@daringer
Copy link
Collaborator

daringer commented Dec 13, 2024

mmmh, falsely approved although the build fails - can't check it from here

This simplifies slightly the implementation and saves firwmare bytes
as the zero values do not need to be included in the binary
@sosthene-nitrokey sosthene-nitrokey merged commit afd6a8e into main Dec 16, 2024
9 checks passed
@sosthene-nitrokey sosthene-nitrokey deleted the simpler-vfs branch December 16, 2024 09:46
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.

4 participants