Re: MSP430 RedHat Toolchain: minor issues

David Brown <[email protected]>
Newsgroups gmane.comp.hardware.texas-instruments.msp430.gcc.user
Message-ID <[email protected]>
On 14/01/14 03:00, DJ Delorie wrote:
> 
> Some quick answers where available...
> 
>> and probably not MSP430 specific, with -Os "static inline
>> functions()" are not inlined, i also tried adding
>> __attribute__((always_inline)) but it did not seem to have an effect
>> in a quick test.
> 
> Please try "extern inline functions()" instead.  There was a change in
> the ISO standard that's been tripping up lots of software like this.
> 

"extern inline" has different semantics than "static inline".  It will
not often make a difference, but it /could/ happen (for example, I
believe an "extern inline" function may not refer to "static const"
data, whereas a "static inline" function can do so).  It is also
important that "static inline" functions get properly inlined, because
they are heavily used in real-world code and work as expected on other
compilers.

Also, if I understand the complicated rules correctly, there is a
difference in C++ - with "extern inline" you must be sure that all
definitions in all translation units are identical, while with "static
inline" they can be different.


I believe, but I'm not sure, that if a "static inline" function with the
"always_inline" attribute is /not/ inlined, then this is a bug in the
compiler - according to the manual, such functions will always be
inlined even with no optimisation specified (unless you have the
-fno-inline flag active).


Certainly it is worth compiling with the "-Winline" flag to see /why/
these "static inline" functions are not being inlined.

It is also usually worth enabling "-finline-small-functions" - if the
heuristics used are accurate, this should be enabled for -Os as it will
lead to smaller code (according to the manual).


>> it was probably a design decision to change the ABI and start with
>> R12 instead of R15 for parameters. this leads to some work with
>> assembler modules interacting with c modules.
> 
> The ABI is intended to be compatible with TI's own compiler.
> 
>> positively, after working around these issues (we use custom linker
>> scripts anyway as we reserve space for a bootlaoder, MSP430F2xx) it
>> compiles and runs :-)
> 
> Woot!
> 

It is great to hear of this success.  Of course, it is not unexpected,
given the company and people doing the gcc port (and Chris is not
exactly a newbie here!).  I look forward to using the new toolchain
myself in the future.

mvh.,

David



------------------------------------------------------------------------------
CenturyLink Cloud: The Leader in Enterprise Cloud Services.
Learn Why More Businesses Are Choosing CenturyLink Cloud For
Critical Workloads, Development Environments & Everything In Between.
Get a Quote or Start a Free Trial Today. 
http://pubads.g.doubleclick.net/gampad/clk?id=119420431&iu=/4140/ostg.clktrk
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.