/[avr-libc]/avr-libc/doc/api/faq.dox
ViewVC logotype

Diff of /avr-libc/doc/api/faq.dox

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.35.2.2 by joerg_wunsch, Tue Mar 15 22:36:08 2005 UTC revision 1.35.2.3 by joerg_wunsch, Tue Sep 6 18:19:22 2005 UTC
# Line 65  When using the optimizer, in a loop like Line 65  When using the optimizer, in a loop like
65  \code  \code
66  uint8_t flag;  uint8_t flag;
67  ...  ...
68    SIGNAL(SIG_SOMETHING) {
69      flag = 1;
70    }
71    ...
72    
73          while (flag == 0) {          while (flag == 0) {
74                  ...                  ...
75          }          }
76  \endcode  \endcode
77    
78  the compiler will typically optimize the access to \c flag completely  the compiler will typically access \c flag only once, and optimize further accesses completely
79  away, since its code path analysis shows that nothing inside the loop  away, since its code path analysis shows that nothing inside the loop
80  could change the value of \c flag anyway.  To tell the compiler that  could change the value of \c flag anyway.  To tell the compiler that
81  this variable could be changed outside the scope of its code path  this variable could be changed outside the scope of its code path
# Line 116  This can be done with Line 120  This can be done with
120  register unsigned char counter asm("r3");  register unsigned char counter asm("r3");
121  \endcode  \endcode
122    
123    Typically, it should be possible to use r2 through r15 that way.
124    
125  See \ref c_names_in_asm for more details.  See \ref c_names_in_asm for more details.
126    
127  <small>Back to \ref faq_index.  <small>Back to \ref faq_index.
# Line 159  devices like ATmega161 because of errata Line 165  devices like ATmega161 because of errata
165  <tt>-Wl,-Tdata,0x801100</tt> to start the data section above the  <tt>-Wl,-Tdata,0x801100</tt> to start the data section above the
166  stack.  stack.
167    
168  For more information on using sections, including how to use them from C code,  For more information on using sections,
169  see \ref mem_sections.  Note that in C code, any such function would  see \ref mem_sections.
170    There is also an example for \ref c_sections.
171    Note that in C code, any such function would
172  preferrably be placed into section \c .init3 as the code in \c .init2  preferrably be placed into section \c .init3 as the code in \c .init2
173  ensures the internal register <tt>__zero_reg__</tt> is already cleared.  ensures the internal register <tt>__zero_reg__</tt> is already cleared.
174    
# Line 288  microcontroller like the AVR. Line 296  microcontroller like the AVR.
296  So in general, variables should only be explicitly initialized if the initial  So in general, variables should only be explicitly initialized if the initial
297  value is non-zero.  value is non-zero.
298    
299    \note Recent versions of GCC are now smart enough to detect this
300    situation, and revert variables that are explicitly initialized to 0
301    to the .bss section.  Still, other compilers might not do that
302    optimization, and as the C standard guarantees the initialization, it
303    is safe to rely on it.
304    
305  <small>Back to \ref faq_index.  <small>Back to \ref faq_index.
306  </small>  </small>
307    

Legend:
Removed from v.1.35.2.2  
changed lines
  Added in v.1.35.2.3

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26