Skip to content

Commit 79aa816

Browse files
committed
Fixed incorrect dynamic dispatch in wdt_enable and wdt_disable - compiler cannot prove by himself that _SFR_IO_ADDR(_WD_CONTROL_REG) fits into an immediate, so emits an error, because that value is taken from memory.
1 parent f445c5c commit 79aa816

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

include/avr/wdt.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -461,7 +461,7 @@ void wdt_enable (const uint8_t value)
461461
"out __SREG__,__tmp_reg__" "\n\t"
462462
"out %0, %2" "\n \t"
463463
: /* no outputs */
464-
: "I" (_SFR_IO_ADDR(_WD_CONTROL_REG)),
464+
: "I" (_SFR_IO_ADDR(_WD_CONTROL_REG) & 0b111111),
465465
"r" ((uint8_t)(_BV(_WD_CHANGE_BIT) | _BV(WDE))),
466466
"r" ((uint8_t) ((value & 0x08 ? _WD_PS3_MASK : 0x00) |
467467
_BV(WDE) | (value & 0x07)) )
@@ -504,7 +504,7 @@ void wdt_disable (void)
504504
"out %[WDTREG],__zero_reg__" "\n\t"
505505
"out __SREG__,__tmp_reg__" "\n\t"
506506
: [TEMPREG] "=d" (temp_reg)
507-
: [WDTREG] "I" (_SFR_IO_ADDR(_WD_CONTROL_REG)),
507+
: [WDTREG] "I" (_SFR_IO_ADDR(_WD_CONTROL_REG) & 0b111111),
508508
[WDCE_WDE] "n" ((uint8_t)(_BV(_WD_CHANGE_BIT) | _BV(WDE)))
509509
: "r0"
510510
);

0 commit comments

Comments
 (0)