Skip to content

Simplify VFS initialization#569

Merged
sosthene-nitrokey merged 2 commits intomainfrom
simpler-vfs
Dec 16, 2024
Merged

Simplify VFS initialization#569
sosthene-nitrokey merged 2 commits intomainfrom
simpler-vfs

Conversation

@sosthene-nitrokey
Copy link
Copy Markdown
Collaborator

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

Comment thread components/apps/Cargo.toml Outdated
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
Copy Markdown
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 thread components/boards/src/store.rs Outdated
Comment on lines +198 to +200
static mut VOLATILE_STORAGE: VolatileStorage = VolatileStorage {
buf: [0; 8192],
};
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
Member

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

@sosthene-nitrokey
Copy link
Copy Markdown
Collaborator Author

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

@robin-nitrokey
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
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