[PATCH] D32991: [ELF] Initial migration of AVR target

Leslie Zhai via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed May 17 00:31:58 PDT 2017


xiangzhai updated this revision to Diff 99251.
xiangzhai added a comment.
Herald added a subscriber: emaste.

Dear Rui,

> Did you try to run a program generated with this patch on an actual AVR (or a simulator)? Did it work?

I only tested BareMinimum <https://www.arduino.cc/en/Tutorial/BareMinimum> on an AVR simulator <https://github.com/buserror/simavr>:

  simavr -m atmega328p clang-BareMinimum
  Loaded 10 .text at address 0x0
  avr_gdb_init listening on port 1234

For an actual AVR atmega328p chip, I have to implement all reloc types as binutils <https://sourceware.org/git/?p=binutils.git;a=blob;f=bfd/elf32-avr.c;h=43100cd20fc0f48e26bdbd8c841c661f9c37c33f;hb=HEAD#l116> , but I have no idea about AVR only for GCC __builtin functions, for example:

  #ifndef F_CPU
  #define F_CPU 1000000UL
  #endif
  #include <util/delay.h>
  
  
  int main(int argc, char *argv[]) {
  #if __clang__
  #pragma message("AVR __builtin only for GCC")
  #else
    _delay_ms(1000); // __builtin_avr_delay_cycles
  #endif
    return 0;
  }

Although in addition to the GCC builtins, Clang supports a number of builtins that GCC does not <https://clang.llvm.org/docs/LanguageExtensions.html#builtin-functions> AVR fans might choose AVR GNU toolchains <http://rpmfind.net/linux/rpm2html/search.php?query=avr-&submit=Search+...&system=&arch=> because easy-to-use Arduino IDE, the same story is people often use GNU compiler for Linux Kernel but not the patch <http://llvm.linuxfoundation.org/index.php/Main_Page> please give me some LLVM Belief support :) thanks a lot!

Regards,
Leslie Zhai


Repository:
  rL LLVM

https://reviews.llvm.org/D32991

Files:
  ELF/InputFiles.cpp
  ELF/Target.cpp
  test/ELF/basic-avr.s

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D32991.99251.patch
Type: text/x-patch
Size: 9476 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170517/c60c3928/attachment.bin>


More information about the llvm-commits mailing list