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 syntax for allocating static data to program memory #84

Open
dylanmckay opened this issue Nov 12, 2017 · 0 comments
Open

Add syntax for allocating static data to program memory #84

dylanmckay opened this issue Nov 12, 2017 · 0 comments

Comments

@dylanmckay
Copy link
Member

Related to #74, where we could do this automatically in some places.

Like with avr-gcc, programmers should be able to explicitly opt-in to having some data automatically reside in flash.

This may not be strictly necessary depending on whether there is an actual need for marking progmem data explicitly if the compiler does it automatically mostly (as might be the case in #74).

Arbitrary example

It could be an attribute like this

#[space(progmem)]
pub static FOOBAR: &'static str = "hello world";

or any number different syntaxes; no thought has really been put into it yet AFAIK.

No changes needed to type system for address space specific references

We won't need to do anything special to the type system to support anything like references that are specific to an address space (i.e. an optional address space quantifier on references &'a [progmem] my_var). If we simply add addrspace(1) attributes to immutable static/constant variables, LLVM will constantly track the address space of all pointers to that variable, and so it will always use the correct memory instructions (i.e. RAM: ld, ldd, program mem: lpm) whenever the pointers are dereferenced.

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

No branches or pull requests

1 participant