AVR C Runtime Library - Bugs: bug #23850, ATMega8 does not have MCUSR defined
You are not allowed to post comments on this tracker with your current authentication level.
bug #23850: ATMega8 does not have MCUSR defined
Submitter: | zohair ahmad <zohair> | ||
Submitted: | Tue 15 Jul 2008 06:41:33 AM UTC | ||
Category: | Header | Severity: | 3 - Normal |
Priority: | 5 - Normal | Item Group: | Header files |
Status: | Fixed | Assigned to: | arcanum |
Percent Complete: | 100% | Open/Closed: | Closed |
Release: | 1.6.2 | Fixed Release: | 1.7.0 |
No files currently attached
Depends on the following items: None found
Items that depend on this one: None found
Carbon-Copy List
Follow 5 latest changes.
Date | Changed by | Updated Field | Previous Value | => | Replaced by |
---|---|---|---|---|---|
2008-07-18 | arcanum | Status | None | Fixed | |
Percent Complete | 0% | 100% | |||
Assigned to | None | arcanum | |||
Open/Closed | Open | Closed | |||
Fixed Release | None | 1.7.0 |
Powered by Savane 3.13-4448.
Corresponding source code
The file avr/iom8.h does not have MCUSR defined. This could have been changed to MCUCSR for compatibility with the datasheet, but the change was not reflected in avr/wdt.h. Thus rendering the following code ( written in the documentation: http://www.nongnu.org/avr-libc/user-manual/group__avr__watchdog.html ) unusable for the ATMega8.
#include <stdint.h>
#include <avr/wdt.h>
uint8_t mcusr_mirror attribute ((section (".noinit")));
void get_mcusr(void) \
_attribute_((naked)) \
_attribute_((section(".init3")));
void get_mcusr(void)
{
mcusr_mirror = MCUSR;
MCUSR = 0;
wdt_disable();
}
Most other controller header files have both MCUCSR and MCUSR defined for backward compatibility. I am not sure but this may be a problem with some other headers as well.