我在下面遇到此错误,但无法找到解决方案。有谁知道怎么做 修复此错误?
rafael@ubuntu:~/avr/projeto$ clang -fsyntax-only -Os -I /usr/lib/avr/include -D__AVR_ATmega328P__ -DARDUINO=100 -Wno-ignored-attributes -Wno-attributes serial_tree.c
In file included from serial_tree.c:3:
In file included from /usr/lib/avr/include/util/delay.h:43:
/usr/lib/avr/include/util/delay_basic.h:108:5: error: invalid output
constraint
'=w' in asm
: "=w" (__count)
^
1 error generated.
答案 0 :(得分:0)
util/delay.h是avr-libc的标头,并且您正在使用的功能(某些延迟功能)正在使用内联asm来实现它。 avr-libc被编写为与avr-gcc一起使用,并在串联内联asm中使用avr-gcc的功能,例如machine dependent constrains。 llvm无法识别约束“ w”,因此您必须使用其他方法,例如使用avr-gcc或将该代码移植到llvm。
avr-gcc还实现了内置功能__builtin_avr_delay_cycles,以实现浪费指定数量的时钟周期。如果llvm正确模仿了avr-gcc,则可以将该函数用作起点。