bugAVR C Runtime Library - Bugs: bug #45151, #define _ASM_SFR_COMPAT 1 and...

 
 

bug #45151: #define _ASM_SFR_COMPAT 1 and #include <avr/power.h> results in build error

Submitted by:  None
Submitted on:  Wed 20 May 2015 02:49:05 PM UTC  
 
Category: HeaderSeverity: 3 - Normal
Priority: 5 - NormalItem Group: None
Status: NonePercent Complete: 0%
Assigned to: NoneOriginator Email: -unavailable-
Open/Closed: OpenRelease: 1.8.0
Fixed Release: None

Add a New Comment(Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

Thu 21 May 2015 01:31:16 PM UTC, comment #1:

If _SFR_ASM_COMPAT is defined, you can't use any of the macros/ functions from power.h. Now __power_all_enable/disable are modified as inline function, so those functions are expanded where power.h is included and caused these errors.

Possible solution maybe to include power.h conditionally (if not _SFR_ASM_COMPAT)

Pitchumani <pitchumani>
Project Member
Wed 20 May 2015 02:49:05 PM UTC, original submission:

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).

Anonymous

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach File(s):
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by pitchumani (Posted a comment)
  • -unavailable- added by None (Submitted the item)
  •  

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    No Changes Have Been Made to This Item

    Back to the top


    Powered by Savane 3.1-cleanup1