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

 
 

You are not allowed to post comments on this tracker with your current authentication level.

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

Submitter:  Łukasz Góralczyk <liku>
Submitted:  Sun 26 Sep 2010 02:49:46 PM UTC
   
 
Category:  Header Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Header files
Status:  Duplicate Assigned to:  None
Percent Complete:  0% Open/Closed:  Closed
Release:  1.7.0 Fixed Release:  None

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

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

Joerg Wunsch <joerg_wunsch>
Group 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.)

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
  • -email is unavailable- added by joerg_wunsch (Posted a comment)
  • -email is unavailable- added by liku (Submitted the item)
  •  

    Follow 3 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2010-09-26 joerg_wunsch StatusNone Duplicate
        Open/ClosedOpen Closed
    2010-09-26 liku Attached File- Added clk_prescale_bug_avrlibc.zip, #21546

    Back to the top

    Powered by Savane 3.13-4448.
    Corresponding source code