EmbeddedRelated.com
Forums

InLine C routines

Started by FB March 19, 2007
Hi!
I need IAR guru's advice!

I have a very structured C program and I set the proyect ing high
optimization.
In many places I call functions that are only call in one place so I wait
the Compiler to Inline those functions
to avoid the call and then assembler lines.

How can I do that !?!

Thanks
Bukitoo

--

11:49 a.m.

Beginning Microcontrollers with the MSP430

FB wrote:
> Hi!
> I need IAR guru's advice!
>
> I have a very structured C program and I set the proyect ing high
> optimization.
> In many places I call functions that are only call in one place so I wait
> the Compiler to Inline those functions
> to avoid the call and then assembler lines.
>
> How can I do that !?!
>
> Thanks
> Bukitoo
>

You can use the "inline" keyword, if you're using C++.

In C, you can use the IAR-speficic pragma "inline", either as "#pragma
inline" or "#pragma inline=forced". In addition, you must use the "high"
optimization level and make sure that you haven't checked the box named
"no inline".

-- Anders Lindgren, IAR Systems
--
Disclaimer: Opinions expressed in this posting are strictly my own and
not necessarily those of my employer.

Thanks!
Just a Question!
In which dialog is that "no inline" box you told me?
thanks

-----Original Message-----
From: m... [mailto:m...] On Behalf Of
Anders Lindgren
Sent: Lunes, 19 de Marzo de 2007 12:13 p.m.
To: m...
Subject: Re: [msp430] InLine C routines

FB wrote:
> Hi!
> I need IAR guru's advice!
>
> I have a very structured C program and I set the proyect ing high
> optimization.
> In many places I call functions that are only call in one place so I
> wait the Compiler to Inline those functions to avoid the call and then
> assembler lines.
>
> How can I do that !?!
>
> Thanks
> Bukitoo
>

You can use the "inline" keyword, if you're using C++.

In C, you can use the IAR-speficic pragma "inline", either as "#pragma
inline" or "#pragma inline=forced". In addition, you must use the "high"
optimization level and make sure that you haven't checked the box named "no
inline".

-- Anders Lindgren, IAR Systems
--
Disclaimer: Opinions expressed in this posting are strictly my own and not
necessarily those of my employer.
FB wrote:
> Thanks!
> Just a Question!
> In which dialog is that "no inline" box you told me?

It's in Options->C/C++ Compiler->Code. And when I checked it was named
"function inlining" and it should be checked. When you build in Release
mode it is checked by default.

-- Anders Lindgren, IAR Systems
--
Disclaimer: Opinions expressed in this posting are strictly my own and
not necessarily those of my employer.

I couldn't ge this work!
please help me!
thanks

-----Original Message-----
From: m... [mailto:m...] On Behalf Of
Anders Lindgren
Sent: Lunes, 19 de Marzo de 2007 12:13 p.m.
To: m...
Subject: Re: [msp430] InLine C routines

FB wrote:
> Hi!
> I need IAR guru's advice!
>
> I have a very structured C program and I set the proyect ing high
> optimization.
> In many places I call functions that are only call in one place so I
> wait the Compiler to Inline those functions to avoid the call and then
> assembler lines.
>
> How can I do that !?!
>
> Thanks
> Bukitoo
>

You can use the "inline" keyword, if you're using C++.

In C, you can use the IAR-speficic pragma "inline", either as "#pragma
inline" or "#pragma inline=forced". In addition, you must use the "high"
optimization level and make sure that you haven't checked the box named "no
inline".

-- Anders Lindgren, IAR Systems
--
Disclaimer: Opinions expressed in this posting are strictly my own and not
necessarily those of my employer.