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

WIP Remove static muts from examples #513

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

tlevora
Copy link
Contributor

@tlevora tlevora commented Dec 7, 2024

No description provided.

richardeoin and others added 3 commits December 7, 2024 09:19
For the future, need to investigate:
* How to implement DMA without requiring the lifetime of the buffer to be
'static
* How to specific the link_section of non-static buffers
@richardeoin
Copy link
Member

As discussed in #512, dereferencing a static of type StaticCell with #[link_section = ".."] is UB if the runtime doesn't initialise the memory area specified by link_section.

I think it should be something like

#[link_section = ".axisram.eth"]
static DES_RING: MaybeUninit<SomeKindOfUnsafeCell<ethernet::DesRing<4, 4>>> = MaybeUninit::uninit();

but need to work out what SomeKindOfUnsafeCell is exactly

@usbalbin
Copy link
Contributor

Also related rust-embedded/cortex-m#538

@Joker2770
Copy link

Joker2770 commented Dec 17, 2024

Is it OK to use core::mem::transmute?

unsafe { mem::transmute(buf) }

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