EmbeddedRelated.com
Forums
Memfault Beyond the Launch

in-line C language routines

Started by lbra...@... December 17, 2003
Hello Anders Lindgren and everyone else

How do I in-line C Language routines with the IAR Compiler
in order to avoid the overhead of a function call?



Beginning Microcontrollers with the MSP430

In the Quadravox compiler, you specify __inline__
(two underscores each side of the word inline.
You can also make a multi-line macro. 

Kent

> Hello Anders Lindgren and everyone else
> 
> How do I in-line C Language routines with the IAR Compiler
> in order to avoid the overhead of a function call?
> 
> 
> 
> 
> .
> 
> 
> 
> 
> 
> . 
> 


-- 
Anakron Canada Inc. / Kent Johansen, Cand. Polyt. M.Sc. 
Suite 640, 580 Hornby Street
Vancouver, British Columbia V6C3B6, Canada
Office: +1 604 642 0663  Cell: +1 604 728 3348







lbraun@lbra... writes:

> Hello Anders Lindgren and everyone else
>
> How do I in-line C Language routines with the IAR Compiler
> in order to avoid the overhead of a function call?

Hi!

Version 2 of the IAR compiler has got a pragma directive for this
called (suprise ;-) "#pragma inline".  It comes in two flavours, the
normal (where the compiler decides if the function should be inlined)
one and a forced version.  (On low optimization levels, no inlining
will be performed, not even on "forced" function.)

The following is an example of the forced and the normal one:

#pragma inline=forced
void test1()
{
  /* Do something... */
}


#pragma inline
void test2()
{
  /* Do something else... */
}


The inlined function definitions could be placed in header files if
they should be used by function in more than one source files.  Even
if the compiler decides that the function will not be inlined there
will still be at most one copy of the function in the linked
application.

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

Hello Anders Lindgren and everyone

KickStart V1.26B/WIN which I downloaded from the TI Web Site does not support
"#pragma inline".
What are the upgrade options and is there a free upgrade from TI or IAR to
Version 2 of the IAR Compiler?
  ----- Original Message ----- 
  From: Anders Lindgren 
  To: msp430@msp4... 
  Sent: Thursday, December 18, 2003 4:01 AM
  Subject: Re: [msp430] in-line C language routines


  lbraun@lbra... writes:

  > Hello Anders Lindgren and everyone else
  >
  > How do I in-line C Language routines with the IAR Compiler
  > in order to avoid the overhead of a function call?

  Hi!

  Version 2 of the IAR compiler has got a pragma directive for this
  called (suprise ;-) "#pragma inline".  It comes in two flavours, the
  normal (where the compiler decides if the function should be inlined)
  one and a forced version.  (On low optimization levels, no inlining
  will be performed, not even on "forced" function.)

  The following is an example of the forced and the normal one:

  #pragma inline=forced
  void test1()
  {
    /* Do something... */
  }


  #pragma inline
  void test2()
  {
    /* Do something else... */
  }


  The inlined function definitions could be placed in header files if
  they should be used by function in more than one source files.  Even
  if the compiler decides that the function will not be inlined there
  will still be at most one copy of the function in the linked
  application.

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


  .





------
  . 






Hello, I downloaded the Kickstart V2 from TI Website next week..
but I just look on their website to grab the link to give it here 
and the webpage has changed. it seems that the Kickstart isn't 
availaible on it for download.. may be the webpage is not totally 
modified yet ??

--- In msp430@msp4..., "Leonard Braun" <lbraun@n...> wrote:
> Hello Anders Lindgren and everyone
> 
> KickStart V1.26B/WIN which I downloaded from the TI Web Site does 
not support "#pragma inline".
> What are the upgrade options and is there a free
upgrade from TI 
or IAR to Version 2 of the IAR Compiler?



> KickStart V1.26B/WIN which I downloaded from the
TI Web Site does
> not support "#pragma inline".  What are the upgrade options and
is
> there a free upgrade from TI or IAR to Version 2 of the IAR
> Compiler?

Hi!

It look like TI is restructuring their web site; I asked around and
apparently the Kickstart version will be available for download very
soon.

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

--- In msp430@msp4..., "valdef78" <valdef@z...> wrote:
> Hello, I downloaded the Kickstart V2 from TI
Website next week..
> but I just look on their website to grab the link to give it here 
> and the webpage has changed. it seems that the Kickstart isn't 
> availaible on it for download.. may be the webpage is not totally 
> modified yet ??
> 
> --- In msp430@msp4..., "Leonard Braun" <lbraun@n...> wrote:
> > Hello Anders Lindgren and everyone
> > 
> > KickStart V1.26B/WIN which I downloaded from the TI Web Site does 
> not support "#pragma inline".
> > What are the upgrade options and is there a free upgrade from TI 
> or IAR to Version 2 of the IAR Compiler?


Hello,
the file for Kickstart V2 is slac034a.zip.

The link:
http://focus.ti.com/docs/toolsw/folders/print/msp-fet430p440.html

Best Regards,
Helmut

I wish all people here a Merry Christmas.






Memfault Beyond the Launch