BetterC working on AVR! (And a question about D)

AVR Dude avr at dude.com
Sun Mar 3 03:15:08 UTC 2019


I just found out that LLVM (7.0.1) has experimental support for 
AVR! This means that it is now (more or less) straightforward to 
use betterC on ATMEL microcontrollers.

Here are the basic steps to get it working:

1. Download the latest LLVM source.
2. Run CMake and pass the ` 
-DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD="AVR" ` argument to CMake.
3. Compile the D source with LDC, passing the "-output-ll" and 
"-betterC" arguments to LDC.
4. Run llc passing the "-march=avr" and "-filetype=obj" arguments.
5. Done! You now have an AVR elf ready to be uploaded to a 
microcontroller.

Now, having gotten this far, I do have one problem: How can I 
access/modify CPU registers in D (for example, `_SFR_IO8(0x18)` 
in C)?

Could someone please help me to do this?

Thanks!


More information about the Digitalmars-d mailing list