Mon 07 Apr 2008 06:12:12 PM UTC, original submission:
Tried to compile my current project (ATmega164P) with WinAVR20080402. Compiling stopped at the line wdt_disable();
main.c:128: warning: asm operand 0 probably doesn't match constraints
main.c:128: error: impossible constraint in 'asm'
In main.i I found this:
_asm_ __volatile__ ( "in _tmp_reg_, _SREG_" "\n\t" "cli" "\n\t" "out %0, %1" "\n\t" "out %0, _zero_reg_" "\n\t" "out _SREG_,__tmp_reg__" "\n\t" : : "I" ((((uint16_t) &(((volatile uint8_t )(0x60)))) - 0x20)), "r" ((uint8_t)((1 << (4)) | (1 << (3)))) : "r0" );
The WDTCSR is located at address 0x60, thus unavailable for the OUT instruction.
The wdt.h contains two macros one with the STS instruction and one with the OUT instruction. The STS version should be used if the expression _AVR_ATmega164_ is defined.
I've added this code to wdt.h:
#ifndef _AVR_ATmega164_
#error ERROR NOT COMPILING FOR ATMEGA164P
#endif
Now compiling is aborted with the message ERROR NOT COMPILING FOR ATMEGA164P.
I'm using the standard MFile makefile with
MCU = atmega164p
Many thanks for your efforts!
|