简体   繁体   中英

avr gcc inline asm variable input operand

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM