Timur Gilfanov | 1 Feb 13:52
Picon

[bug #28756] Bug in AVR libc 1.6.7 (power.h for 8-bit AVR)


Follow-up Comment #3, bug #28756 (project avr-libc):

I'm have his bug in WinAVR 20100110 too. In clock_prescale_set(x) I found
infinity loop and error disappear when I remove loop:
WinAVR 20100110 power.h:
#define clock_prescale_set(x) 
do { 
        uint8_t tmp = _BV(CLKPCE); 
        __asm__ __volatile__ ( 
                "in __tmp_reg__,__SREG__" "nt" 
                "cli" "nt" 
                "sts %1, %0" "nt" 
                "sts %1, %2" "nt" 
                "out __SREG__, __tmp_reg__" 
                : /* no outputs */ 
                : "d" (tmp), 
                  "M" (_SFR_MEM_ADDR(CLKPR)), 
                  "d" (x) 
                : "r0"); 
} while (0)

WinAVR 20090313 power.h:
#define clock_prescale_set(x) 
{ 
        uint8_t tmp = _BV(CLKPCE); 
        __asm__ __volatile__ ( 
                "in __tmp_reg__,__SREG__" "nt" 
                "cli" "nt" 
                "sts %1, %0" "nt" 
(Continue reading)

Joerg Wunsch | 1 Feb 14:05
Picon

[bug #28756] Bug in AVR libc 1.6.7 (power.h for 8-bit AVR)


Follow-up Comment #4, bug #28756 (project avr-libc):

do { ... } while(0) is *not* an infinite loop.  Think again
about it.

Sorry, I still cannot reproduce any error.  The project in
the attachment did apparently compile fine (it contains an
ELF file, after all!), and when I recompile it, I don't get
an error at all, nor does anyone else provide an error
message.

Btw., when being asked for a sample file, it's a little
impolite to dump him half a megabyte of a complete project.
It's really not asked too much that you do your fair share
of the workload, and strip the files down to the minimum
required to reproduce the issue.

Please also quote the compiler error message in full.

    _______________________________________________________

Reply to this item at:

  <http://savannah.nongnu.org/bugs/?28756>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.nongnu.org/
(Continue reading)

Timur Gilfanov | 2 Feb 06:51
Picon

[bug #28756] Bug in AVR libc 1.6.7 (power.h for 8-bit AVR)


Follow-up Comment #5, bug #28756 (project avr-libc):

Sorry, I was inattentive with "infinity loop" :).
When I try to reproduce error I'm force to "Clean project" in Eclipse. Here
my compile error.  

(file #19605)
    _______________________________________________________

Additional Item Attachment:

File name: compile_error                  Size:1 KB

    _______________________________________________________

Reply to this item at:

  <http://savannah.nongnu.org/bugs/?28756>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.nongnu.org/
Joerg Wunsch | 2 Feb 08:48
Picon

[bug #28756] Bug in AVR libc 1.6.7 (power.h for 8-bit AVR)


Follow-up Comment #6, bug #28756 (project avr-libc):

Thanks for the error message.  Still, I cannot reproduce
the problem.  For reference, this is my source code file:

#include "power.h"

void prescaler_1(void)
{
  clock_prescale_set(clock_div_1);
}

and compile it with

avr-gcc -O -mmcu=atmega1281 -c clkpr.c

I get a working result, regardless of whether I'm using either
of your submitted power.h include files (where one is the
stock power.h from avr-libc 1.6.6, and the other one is
your edited version from avr-libc 1.6.7), or the file from
CVS (either HEAD or the 1.6 branch, both files are the same).

    _______________________________________________________

Reply to this item at:

  <http://savannah.nongnu.org/bugs/?28756>

_______________________________________________
(Continue reading)

David Brown | 2 Feb 09:49
Picon

[bug #28756] Bug in AVR libc 1.6.7 (power.h for 8-bit AVR)


Follow-up Comment #7, bug #28756 (project avr-libc):

I have tested out Joerg's snippet with -mmcu=atmega128rfa1 -W -Wall, using
WinAVR.  With WinAVR-20090313, you get an error ("clock_div_1" undeclared, and
a warning implicit declaration of function "clock_prescale_set").  This
particular avr is missing from the list for the clock prescale micros.

With the WinAVR-20100110, the newer version of the library has this included,
and the code compiles fine.

    _______________________________________________________

Reply to this item at:

  <http://savannah.nongnu.org/bugs/?28756>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.nongnu.org/
Joerg Wunsch | 2 Feb 09:54
Picon

[bug #28756] Bug in AVR libc 1.6.7 (power.h for 8-bit AVR)


Follow-up Comment #8, bug #28756 (project avr-libc):

Yes, the ATmega128RFA1 was (accidentally) missing from the
list of supported MCUs for clock prescaling in avr-libc 1.6.6.

However, the error Timur is getting is completely different:

../main.c:105: error: expected expression before 'do'

    _______________________________________________________

Reply to this item at:

  <http://savannah.nongnu.org/bugs/?28756>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.nongnu.org/
Lucas | 2 Feb 11:06
Picon

[bug #28756] Bug in AVR libc 1.6.7 (power.h for 8-bit AVR)


Follow-up Comment #9, bug #28756 (project avr-libc):

I have the same error with AT90USB1287:
error: expected expression before 'do'

    _______________________________________________________

Reply to this item at:

  <http://savannah.nongnu.org/bugs/?28756>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.nongnu.org/
Joerg Wunsch | 2 Feb 11:24
Picon

[bug #28756] Bug in AVR libc 1.6.7 (power.h for 8-bit AVR)


Follow-up Comment #10, bug #28756 (project avr-libc):

> I have the same error with AT90USB1287

Source code?

    _______________________________________________________

Reply to this item at:

  <http://savannah.nongnu.org/bugs/?28756>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.nongnu.org/
Lucas | 2 Feb 11:55
Picon

[bug #28756] Bug in AVR libc 1.6.7 (power.h for 8-bit AVR)


Follow-up Comment #11, bug #28756 (project avr-libc):

I wrote about it in third post, source code is in first attachment (file
#19561:  test_usb_mass_storage.rar added by kukiz100)

    _______________________________________________________

Reply to this item at:

  <http://savannah.nongnu.org/bugs/?28756>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.nongnu.org/
Joerg Wunsch | 2 Feb 12:26
Picon

[bug #28756] Bug in AVR libc 1.6.7 (power.h for 8-bit AVR)


Follow-up Comment #12, bug #28756 (project avr-libc):

But: I cannot reproduce it with that, and obviously, your
own code /was/ fully compiled (the .rar file contains an
ELF file).

Please give me a 5 to 10 line example code that triggers this
compiler error, including the compiler command-line.

    _______________________________________________________

Reply to this item at:

  <http://savannah.nongnu.org/bugs/?28756>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.nongnu.org/

Gmane