Download avr-libc Reference Manual

Transcript
9.10
Frequently Asked Questions
Optimization
flags
-O3
-O2
-Os
-Os
-mcall-prologues
327
Size of .text
Time for test #1
Time for test #2
6898
6666
6618
6474
903 µs
972 µs
955 µs
972 µs
19.7 ms
20.1 ms
20.1 ms
20.1 ms
(The difference between 955 µs and 972 µs was just a single timer-tick, so take this
with a grain of salt.)
So generally, it seems -Os -mcall-prologues is the most universal "best" optimization level. Only applications that need to get the last few percent of speed benefit
from using -O3.
Back to FAQ Index.
9.10.18
How do I relocate code to a fixed address?
First, the code should be put into a new named section. This is done with a section
attribute:
__attribute__ ((section (".bootloader")))
In this example, .bootloader is the name of the new section. This attribute needs to be
placed after the prototype of any function to force the function into the new section.
void boot(void) __attribute__ ((section (".bootloader")));
To relocate the section to a fixed address the linker flag -section-start is used.
This option can be passed to the linker using the -Wl compiler option:
-Wl,--section-start=.bootloader=0x1E000
The name after section-start is the name of the section to be relocated. The number
after the section name is the beginning address of the named section.
Back to FAQ Index.
9.10.19
My UART is generating nonsense! My ATmega128 keeps crashing! Port
F is completely broken!
Well, certain odd problems arise out of the situation that the AVR devices as shipped
by Atmel often come with a default fuse bit configuration that doesn’t match the user’s
expectations. Here is a list of things to care for:
Generated on Mon May 12 09:55:09 2008 for avr-libc by Doxygen