Fri 07 Aug 2009 10:41:28 AM UTC, original submission:
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.
|