URL:
  <http://savannah.nongnu.org/bugs/?23850>

                 Summary: ATMega8 does not have MCUSR defined
                 Project: AVR C Runtime Library
            Submitted by: zohair
            Submitted on: Tuesday 07/15/2008 at 06:41
                Category: Header
                Severity: 3 - Normal
                Priority: 5 - Normal
              Item Group: Header files
                  Status: None
        Percent Complete: 0%
             Assigned to: None
             Open/Closed: Open
         Discussion Lock: Any
                 Release: 1.6.2
           Fixed Release: None

    _______________________________________________________

Details:

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.





    _______________________________________________________

Reply to this item at:

  <http://savannah.nongnu.org/bugs/?23850>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.nongnu.org/



_______________________________________________
AVR-libc-dev mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/avr-libc-dev

Reply via email to