[cfe-dev] How do I call clang for AVR targets?

Bodo Wenzel via cfe-dev cfe-dev at lists.llvm.org
Wed Sep 20 12:53:44 PDT 2017


As an developer in the world of embedded control I'm playing around with 
Clang to see its capabilities. And since it is advertised as being 
usable for ARM and AVR (among a lot of other targets) I tried these.

Here at home I'm running Linux, but at the job I'm bound to use Windows. 
So I'm using Clang 5.0.0 installed by the provided Windows x64 
installer. The AVR-GCC is the current WinAVR from 2010. (Yes, I'm aware 
that there are newer versions, but I have to use this one due to company 
policies.)

With the ARM target I had no problems; compiling with Clang and linking 
with GCC produced executables that ran fine in a simulator. I have no 
real machine at hand in the moment to check further.

But the AVR target gives me a hard time. Anything I tried leads to the 
error "unable to create target: 'No available targets are compatible 
with this triple.'"

There is a lot to read at the websites of Clang and LLVM, and I did 
read. But unfortunately I found nothing helpful.

Finally I tried to follow the source code but to no avail.

The command line is like
"clang -target avr -mmcu=atmega128 -I<path-to-winavr-includes> source.c"

These are the targets I tried:
avr
avr-unknown-unknown
avr-elf
avr-gcc

What command line is supposed to be given for a successful compilation?



More information about the cfe-dev mailing list