URL:
<http://savannah.nongnu.org/bugs/?27201>
Summary: _WORDREGISTER in xmega headers does not work in C99
mode
Project: AVR C Runtime Library
Submitted by: schneiso
Submitted on: Fr 07 Aug 2009 10:41:28 GMT
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.5
Fixed Release: None
_______________________________________________________
Details:
When using -std=c99 in conjunction with ATxmega128A1 the following example
code from the website for Xmega (Application node AVR1300: Using the XMEGA
ADC) does not compile for avr-gcc (Win-AVR20090313).
ADC_CH_t *acd_ch;
int16_t answer;
answer = adc_ch->RES;
This creates the following error message:
"error: 'ADC_CH_t' has no member named 'RES'
When looking at the corresponding header file iox128a1.h the type ADC_CH_t is
defined as such:
typedef struct ADC_CH_struct
{
register8_t CTRL; /* Control Register */
register8_t MUXCTRL; /* MUX Control */
register8_t INTCTRL; /* Channel Interrupt Control */
register8_t INTFLAGS; /* Interrupt Flags */
_WORDREGISTER(RES); /* Channel Result */
register8_t reserved_0x6;
register8_t reserved_0x7;
} ADC_CH_t;
The issue is caused be the definition of "_WORDREGISTER" in line 94:
#define _WORDREGISTER(regname) \
union \
{ \
register16_t regname; \
struct \
{ \
register8_t regname ## L; \
register8_t regname ## H; \
}; \
}
This does not work for C99, which (unfortunately) I need for my project.
The code works with IAR Workbench 5.30.02.
_______________________________________________________
Reply to this item at:
<http://savannah.nongnu.org/bugs/?27201>
_______________________________________________
Nachricht geschickt von/durch Savannah
http://savannah.nongnu.org/
_______________________________________________
AVR-libc-dev mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/avr-libc-dev