avr-libc-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [avr-libc-dev] XMEGA


From: Bob Paddock
Subject: Re: [avr-libc-dev] XMEGA
Date: Tue, 8 Jun 2010 08:26:39 -0400

On Mon, Jun 7, 2010 at 6:28 PM, Weddington, Eric
<address@hidden> wrote:

>> On 06/07/2010 01:41 PM, Rob Holbert wrote:
>> > However, there is a major difference.  The fully qualified
>> (PORTC_OUTSET)
>> > has volatile tied to it and
>> > the (PORTC.OUTSET) does not.
>>>>
>> typedef volatile uint8_t register8_t;
>> typedef struct PORT_struct {
>>      . . .
>>      register8_t OUT;  /* I/O Port Output */
>>      . . .
>> } PORT_t;> I have always been a little bit concerned between using, e.g., 
>> PORTC.OUT versus PORTC_OUT. The latter is time-tested, straightforward with 
>> very little surprises. The former is a pointer to a structure, dereferenced, 
>> and using the dot operator to calculate an offset. Ideally, there should be 
>> no difference in the generated code. What I can't remember, however, is what 
>> happens when optimizations are turned down or off. IIRC, the compiler might 
>> generate more code with the structure-and-dot-offset variety. But it's been 
>> a long time since I've looked at it and I don't recall what the final 
>> results were.
>
> I would be very interested if someone shows conclusively that there are 
> errors with the structure-and-dot-offset register definitions.

Is this problem related to this GCC bug report?:
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43876

There is the difference that the registers inside the structure are
not declared volatile in the bug report example.

The XMega tries to copy the way the ARM architectures works, which
does produced demonstrably smaller code when using structure pointers.
However the underlying architectures are different, so what looks the
same in the source doesn't have the same results.

The people that say "C is a portable language" have never ported anything...



reply via email to

[Prev in Thread] Current Thread [Next in Thread]