Hi,
I have a problem with inline assembly
I have a naked isr that works fine with a AT90USB646
ISR(USART1_RX_vect, ISR_NAKED) { asm ( .... " lds r17,%[udr1] \n\t" .... " reti \n\t" : : [udr1] "M" (_SFR_MEM_ADDR(UDR1)) : "memory" ); }
Then I have to port it to an xmega device ATxmega128A1
ISR(USARTC0_RXC_vect, ISR_NAKED) { asm ( .... " lds r17,%[udr] \n\t" .... " reti \n\t" : : [udr] "M" (_SFR_MEM_ADDR(USARTC0_DATA)) : "memory" ); }
But studio 4 give me this error :
warning: asm operand 0 probably doesn't match constraints
when I try to replace the LDS line by :
" lds r17,USARTC0_DATA \n\t"
I have this error
undefined reference to `USARTC0_DATA'
USARTC0_DATA and UDR1 is defined as this in their respected io.h
#define USARTC0_DATA _SFR_MEM8(0x08A0) #define UDR1 _SFR_MEM8(0XCE)
This works :
" lds r17,0x08A0 \n\t"
But not this :
#define USARTC0_DATA_addr 0x08A0 ... "lds r17,USARTC0_DATA_addr \n\t"
Sometimes in my tests he said me :
lvalue required as unary '&' operand
Do someone know what I have to write in my interrupt code to make it run ?
I have read the avrlibc manual, but it is not very clear. And there is no sts lds example with xmega.
Best Regards.
Doom