Hello hArVaRd* freaks,
about static inline function, there are several threads, e.g. topic 67893.
But one question is open for me:
Can I get sure, that a function, which is declared in an header file as "static __inline__" really goes into the section, from where it called (specially into the bootloader section)?
OK, if it is really inlined, then there is no doubt about it, that it is in the correct section: it "inherits" the section from where it is called.
But I read, that "__inline__" is only a proposal to the compiler. It is free to do it another way, if it is not forced with the attribute "always_inline".
What if the compiler decides to put the inline-proposed function as a separate function block? Then the attribute for the section is missing...
I wonder, why there are different declarations:
static inline void _delay_ms(double __ms) __attribute__((always_inline));
No problem for me, because always inlined.
static __inline__ uint16_t _crc_xmodem_update(uint16_t __crc, uint8_t __data)
This function was correctly inlined though the always_inline attribute is not used.
But is this critical, if the compiler one day changes it behavior, about what code to inline and what to call. Then the correct section, where to place the code is missing...
Or am I wrong and the compiler takes automatically care, that it goes to the correct section, also if it is not inlined, because it is "static"?
I noticed in the past that it is really important that the functions called from a bootloader reside also in the same section...
So, should I better copy and paste the utility functions into my C file with the correct section (and the copyright information of the header file)?
*) my idea, where the name AVR results of