avr gcc内联asm变量输入操作数 [英] avr gcc inline asm variable input operand
本文介绍了avr gcc内联asm变量输入操作数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我希望能够在运行时确定内联asm函数的端口寄存器。
I want to be able to determine the port register for an inline asm function at runtime
asm(""::"I" (_SFR_IO_ADDR(PORTD)));
_SFR_IO_ADDR
只接受一个常量
我发现了这些选项,但似乎无法通过变量传递寄存器。
I have found these options but can't seem to pass register from variable.
asm(""::"m" (PORTD));
asm(""::"n" (&PORTD));
认为这是一个常见问题/要求,但似乎找不到任何答案
Thought this would be a common issue/request but can't seem to find any answers
推荐答案
AVR IN指令仅支持立即端口号。如果可用,您可能想尝试使用内存映射访问。 - 小丑
The AVR IN instruction only supports immediate port number. You might want to try memory mapped access instead, if available. – Jester
这篇关于avr gcc内联asm变量输入操作数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文