Arduino and MCU Support

kinke noone at nowhere.com
Fri Jun 19 14:26:31 UTC 2020


On Friday, 19 June 2020 at 14:14:07 UTC, frasdoge wrote:
> I'm having a bit of trouble understanding how to actually get 
> started even with those links.
>
> I've installed the latest LDC and LLVM releases for Windows, 
> though the -mcpu does not have any AVR options out-of-the-box 
> as you mentioned. Perhaps I've missed something, or will I need 
> to build the binary myself using the flags for AVR?

Compiling the sample from the AVR wiki works here on Win64 with 
the official LDC 1.22 package and:
ldc2 -betterC -Oz -mtriple=avr -mcpu=atmega328p -c test.d

For linking, you'll need an avr-gcc toolchain, and add 
`-gcc=<path\to\avr-gcc> -Xcc=-mmcu=atmega328p` as mentioned on 
the Wiki page. I don't have such a toolchain.

> The ESP32 process seems more involved. Due to my inexperience 
> in this area, I'm wondering that, if I need to build the 
> binaries myself anyway, how I would set it such that it'll work 
> with AVR and ESP32 at the same time with one installation?

Simply using -mtriple and tweaking etc\ldc2.conf as explained 
here:
https://wiki.dlang.org/Cross-compiling_with_LDC



More information about the Digitalmars-d-learn mailing list