URL: <http://savannah.nongnu.org/bugs/?31136>
Summary: Missing clock_prescale_set() declaration for ATtiny family Project: AVR C Runtime Library Submitted by: liku Submitted on: Sun 26 Sep 2010 02:49:46 PM GMT Category: Header Severity: 3 - Normal Priority: 5 - Normal Item Group: Header files Status: None Percent Complete: 0% Assigned to: None Open/Closed: Open Discussion Lock: Any Release: 1.7.0 Fixed Release: None _______________________________________________________ Details: 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. _______________________________________________________ File Attachments: ------------------------------------------------------- Date: Sun 26 Sep 2010 02:49:46 PM GMT Name: clk_prescale_bug_avrlibc.zip Size: 560B By: liku Zipped code sample to demonstrate clock_prescale_set() bug <http://savannah.nongnu.org/bugs/download.php?file_id=21546> _______________________________________________________ Reply to this item at: <http://savannah.nongnu.org/bugs/?31136> _______________________________________________ Message sent via/by Savannah http://savannah.nongnu.org/ _______________________________________________ AVR-libc-dev mailing list AVR-libc-dev@nongnu.org http://lists.nongnu.org/mailman/listinfo/avr-libc-dev