How do I call clang for AVR targets?

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

How do I call clang for AVR targets?

David Chisnall via cfe-dev
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?
_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: How do I call clang for AVR targets?

David Chisnall via cfe-dev
Only these targets are built by default in cmake. AVR doesn't appear to be one of them. So that probably means the release binaries don't build it either. You can check what targets have been compiled in by using "llc --version"


# List of all targets to be built by default:
set(LLVM_ALL_TARGETS
  AArch64
  AMDGPU
  ARM
  BPF
  Hexagon
  Lanai
  Mips
  MSP430
  NVPTX
  PowerPC
  Sparc
  SystemZ
  X86
  XCore
  )


~Craig

On Wed, Sep 20, 2017 at 12:53 PM, Bodo Wenzel via cfe-dev <[hidden email]> wrote:
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?
_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev


_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: How do I call clang for AVR targets?

David Chisnall via cfe-dev
Thanks for the clarification. Clang 5.0.0 was kind of advertised like
"Now with AVR!" and so I got curious.

Unfortunately lcc is not part of the installation via the Windows
installer. Is there any other way to find out what triples are supported?

Cheers, Bodo
_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: How do I call clang for AVR targets?

David Chisnall via cfe-dev
> Unfortunately lcc is not part of the installation via the Windows
> installer.
Oops, I mean llc, of course. No offend!

> Is there any other way to find out what triples are supported?
Just to push up this question in the list again: Is there any way for
the humble user of the Windows installer to find out about accepted triples?

I feel this to be necessary to broaden the usage of Clang/LLVM among us
plain vanilla developers. Usually there is no time to guess and try
several combinations until one seems to work.

-Bodo
_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev