bugAVR C Runtime Library - Bugs: bug #27201, _WORDREGISTER in xmega headers...

 
 

bug #27201: _WORDREGISTER in xmega headers does not work in C99 mode

Submitted by:  Soeren Schneider <schneiso>
Submitted on:  Fri 07 Aug 2009 10:41:28 AM UTC  
 
Category: HeaderSeverity: 3 - Normal
Priority: 5 - NormalItem Group: Header files
Status: FixedPercent Complete: 100%
Assigned to: Eric Weddington <arcanum>Open/Closed: Closed
Release: 1.6.5Fixed Release: 1.6.3

Add a New Comment(Rich Markup)
   

You are not logged in

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

 

Mon 31 Aug 2009 11:49:09 PM UTC, comment #2:

Ok, finally committed.

Eric Weddington <arcanum>
Project AdministratorIn charge of this item.
Fri 07 Aug 2009 10:52:35 AM UTC, comment #1:

The problem is that accessing the union (and also struct,
for byte-wide access) elements without naming the union
itself is a GCC extension, so it is turned off when compiling
with -std=c99.

It appears to me that prepending the entire union declaration
with _extension_ does fix it by telling GCC "It's OK to use
the following GCC extension here, regardless of the --std
option in effect".

Joerg Wunsch <joerg_wunsch>
Project Administrator
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.

Soeren Schneider <schneiso>

 

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

Attach File(s):
   
   
Comment:
   

Attached Files
file #18587:  ChangeLog added by aboyapati (37KiB - text/plain - _WORDREGISTER defined for xmega headers)
file #18586:  NEWS added by aboyapati (37KiB - text/plain - _WORDREGISTER defined for xmega headers)
file #18585:  bug27201.patch added by aboyapati (12KiB - application/octet-stream - _WORDREGISTER defined for xmega headers)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by arcanum (Updated the item)
  • -unavailable- added by aboyapati (Updated the item)
  • -unavailable- added by joerg_wunsch (Posted a comment)
  • -unavailable- added by schneiso (Submitted the item)
  •  

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

     

     

    Follow 14 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Mon 31 Aug 2009 11:49:09 PM UTCarcanumOpen/ClosedOpen=>Closed
      StatusNone=>Fixed
      Percent Complete90%=>100%
    Sun 30 Aug 2009 01:54:12 AM UTCarcanumOpen/ClosedClosed=>Open
      StatusFixed=>None
      Percent Complete100%=>90%
    Wed 26 Aug 2009 08:56:33 PM UTCarcanumStatusNone=>Fixed
      Percent Complete0%=>100%
      Assigned toNone=>arcanum
      Open/ClosedOpen=>Closed
      Fixed ReleaseNone=>1.6.3
    Mon 17 Aug 2009 12:08:11 PM UTCaboyapatiAttached File-=>Added ChangeLog, #18587
      Attached File-=>Added bug27201.patch, #18585
      Attached File-=>Added NEWS, #18586

    Back to the top


    Powered by Savane 3.1-cleanup1