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

Add no-std and baremetal features #133

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

geonnave
Copy link

This is an ongoing attempt at addressing #131. Heavily based on this fork. cc @chrysn @malishav

@geonnave geonnave force-pushed the have-no-std-and-baremetal-features branch from ea9f07f to 2e08c80 Compare November 28, 2023 16:35
@chrysn
Copy link

chrysn commented Nov 28, 2023

Adding a baremetal and a no_std feature is contrary to the addititvity of Cargo features. If there is an actual need for std (for #131 I don't think we need an extra feature, it can be no_std and no_alloc all the time), and it's on by default now, it should become a default feature "std", so that all dependencies that are themselves no_std would use this with no-default-features, but as soon as any dependent crate needs std, std is in.

@geonnave
Copy link
Author

geonnave commented Nov 28, 2023

Thanks for the feedback @chrysn.

Before I spend more time on this, I would like to hear what the maintainers think of addressing this issue.

@ionut-arm
Copy link
Member

Hi!

Thanks for the patch, it looks good to me. In my opinion, making it no_std is a good step forward, but happy to hear other views too.

I wanted to ask whether it would be possible/make sense to enable it for psa-crypto too.

Also, the one thing I'd like added is some mention in the README about the new features. :)

@geonnave geonnave force-pushed the have-no-std-and-baremetal-features branch from e2a6872 to 79ad9ee Compare November 29, 2023 10:22
@geonnave
Copy link
Author

geonnave commented Nov 29, 2023

Thank you @ionut-arm.

Regarding psa-crypto, it seems to already be no-std except when using the std feature (which I think is more like what @chrysn was proposing).

In addition, I realized I need some extra build flags to be passed to mbedtls when building this in no-std mode for an embedded target (nRF52840). Unfortunately, it requires patching mbedtls. I added a patch and the required logic in build.rs, but I am still not sure how general this solution is, i.e. will others wanting to build in baremetal configuration need this same patch? (cc @malishav)

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