bugAVR C Runtime Library - Bugs: bug #31136, Missing clock_prescale_set()...

 
 

bug #31136: Missing clock_prescale_set() declaration for ATtiny family

Submitted by:  Łukasz Góralczyk <liku>
Submitted on:  Sun 26 Sep 2010 02:49:46 PM UTC  
 
Category: HeaderSeverity: 3 - Normal
Priority: 5 - NormalItem Group: Header files
Status: DuplicatePercent Complete: 0%
Assigned to: NoneOpen/Closed: Closed
Release: 1.7.0Fixed Release: None

Add a New Comment(Rich Markup)
   

You are not logged in

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

 

Sun 26 Sep 2010 07:14:28 PM UTC, comment #1:

Duplicate for bug #30783 (which has already been fixed).

Joerg Wunsch <joerg_wunsch>
Project Administrator
Sun 26 Sep 2010 02:49:46 PM UTC, original submission:

There's a missing declaration of clock_prescale_set() in avr/power.h for ATtiny family.

How to reproduce:
1. Create two source files which both include <avr/power.h>, fist one should contain "main()", second might be empty.
2. Compile and link: "avr-gcc -mmcu=attiny45 -otest.elf f1.c f2.c".

Expected result:
Files should compile and link without any problems.

Actual result:
Below error is displayed:
--- start ---
/tmp/cc5ymZ7L.o: In function `clock_prescale_set':
f2.c:(.text+0x0): multiple definition of `clock_prescale_set'
/tmp/ccHUt23W.o:f1.c:(.text+0x0): first defined here
--- end ---
clock_prescale_set() may be present more than once if developer includes <avr/power.h> multiple times in files.

Proposed fix:
Add static declaration for clock_prescale_set() function for ATtiny family, it is currently missing in power.h file (see the end of the file). See similar code just before ATtiny #ifdef block.

Additional comment:
The problem with current solution is that every time a power.h file is included a small piece of code is included in a given module which is redundant.
If I may ask: what was the reason to use a function instead of macro as it was in the past?
I'm attaching example code to reproduce this bug.

Łukasz Góralczyk <liku>

 

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

Attach File(s):
   
   
Comment:
   

Attached Files
file #21546:  clk_prescale_bug_avrlibc.zip added by liku (560B - application/zip - Zipped code sample to demonstrate clock_prescale_set() bug)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by joerg_wunsch (Posted a comment)
  • -unavailable- added by liku (Submitted the item)
  •  

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

     

     

    Follow 3 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Sun 26 Sep 2010 07:14:28 PM UTCjoerg_wunschStatusNone=>Duplicate
      Open/ClosedOpen=>Closed
    Sun 26 Sep 2010 02:49:46 PM UTClikuAttached File-=>Added clk_prescale_bug_avrlibc.zip, #21546

    Back to the top


    Powered by Savane 3.1-cleanup1