[llvm-dev] Built in progmem variables in AVR

Ɓukasz Kostka via llvm-dev llvm-dev at lists.llvm.org
Wed Oct 9 07:16:29 PDT 2019


I was wondering if it is possible to implement placing RO variables within progmem sections. For now it is possible to just use [[gnu::progmem]] and read variables using assembly. My proposal is to:
Use those variables as any other, without creating assembly.
While reading them, compiler has all necessary knowledge where the variable is and can generate assembly

Possible future improvements:
Automatic placement of variables in __flash sections.
Take care of reading across 64KB boundary
If a variable is const, it can be places automatically in some __flash section

AVR devices are old, but still widely used. This feature could improve code quality even further. 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20191009/4b6c8bb5/attachment.html>

More information about the llvm-dev mailing list