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

                 Summary: #define _ASM_SFR_COMPAT 1 and #include <avr/power.h>
results in build error
                 Project: AVR C Runtime Library
            Submitted by: None
            Submitted on: Wed 20 May 2015 02:49:05 PM UTC
                Category: Header
                Severity: 3 - Normal
                Priority: 5 - Normal
              Item Group: None
                  Status: None
        Percent Complete: 0%
             Assigned to: None
        Originator Email: urja...@gmail.com
             Open/Closed: Open
         Discussion Lock: Any
                 Release: 1.8.0
           Fixed Release: None

    _______________________________________________________

Details:

Note: release field is incorrect, but there isnt one for newest svn.
I was testing current trunk avr-libc + current gcc 5 branch
(20.5.2015, avr-libc r2475) against my projects when i found this.

I simplified it as:

$ cat simple.c
#define _SFR_ASM_COMPAT 1
#include <avr/io.h>
#include <avr/power.h>

void main(void) { }

$ avr-gcc -mmcu=atmega328p -Os simple.c
In file included from simple.c:3:0:
/home/urjaman/avrtc-test/avr/include/avr/power.h: In function
'__power_all_enable':
/home/urjaman/avrtc-test/avr/include/avr/power.h:1152:9: error: lvalue
required as left operand of assignment
     PRR &= (uint8_t)~(__AVR_HAVE_PRR);
         ^
/home/urjaman/avrtc-test/avr/include/avr/power.h: In function
'__power_all_disable':
/home/urjaman/avrtc-test/avr/include/avr/power.h:1201:9: error: lvalue
required as left operand of assignment
     PRR |= (uint8_t)(__AVR_HAVE_PRR);
         ^

I think this might have been officially not supported, but it used to work
without error.

I worked around by not including <avr/power.h> in the module that uses
_ASM_SFR_COMPAT (has a few variable definitions and an ASM ISR and some C
helpers to interface with the variables (and thus the ISR)), but it is
slightly annoying for a project where all system includes used to in one
main.h (another .c needed to include <avr/power.h> then).





    _______________________________________________________

Reply to this item at:

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

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


_______________________________________________
AVR-libc-dev mailing list
AVR-libc-dev@nongnu.org
https://lists.nongnu.org/mailman/listinfo/avr-libc-dev

Reply via email to