[llvm-dev] How to add new AVR targets?

Wilhelm Meier via llvm-dev llvm-dev at lists.llvm.org
Wed Mar 4 07:05:29 PST 2020

Am 04.03.20 um 13:28 schrieb Dylan McKay:

>   * *The C/C++ function needs to be declared with either the calling
>     convention avr-interrupt or avr-non-blocking-interrupt.* Skipping
>     this step will cause regular ret instructions to be emitted for
>     return-from-subroutine, instead of the required reti for interrupt
>     handlers. ISRs also have stricter requirements on which registers
>     must not be clobbered after execution, which the backend will handle
>     properly by restoring all clobbered registers in the interrupt
>     handler epilogue
>   * *The symbol names of the ISR function handlers must match those
>     referred to in avr-libc/avr-libgcc/crt*. This is because the ISR
>     table is specified in assembly inside the GCC AVR CRT. The way it
>     works is that the external symbol references in the CRT object files
>     are declared with an exotic linkage type that causes the linker to
>     skip linking of the symbols if they are undefined references. If you
>     chose a custom ISR table in a custom CRT or runtime library, you
>     would be free to choose ISR names as you pleased.
Thank you for your explanation. But I suspect I didn't get it right. Can
you please provide an example?


More information about the llvm-dev mailing list