avr gcc inline asm variable input operand

有些话、适合烂在心里 提交于 2020-01-06 04:55:07

问题


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 only accepts a constant

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


回答1:


The AVR IN instruction only supports immediate port number. You might want to try memory mapped access instead, if available. – Jester



来源:https://stackoverflow.com/questions/27581533/avr-gcc-inline-asm-variable-input-operand

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!