how to use powf or ceilingf function in rtems..

김찬 ckim at
Tue Nov 15 00:34:51 UTC 2016

Hello, Jinhyun~
As I said, in my case the –lm option had been given only to the compile command and not the link command.
After I add it to the link command, I can link it. (so it was because of an error in my Makefile).
Hi, all,
By the way, I found printf(“PI = %f \n”, 3.1415) prints only “PI = f”. Anybody know in what case this happens?
In my another program, it prints ok, so it is a build problem..


From: Jinhyun [mailto:jinhyun at]
Sent: Monday, November 14, 2016 10:57 AM
To: 김찬 <ckim at>
Cc: users at
Subject: RE: how to use powf or ceilingf function in rtems..

I succeed to use powf function in another function without any touch on hello example of rtems-exampls-v2.
I configured RTEMS-4.12 for i386 and use pc386 BSP.

My command for configuration is:
           $ configure --target-i386-rtems4.12 --enable-bsp=pc386 --enable-posix --enable-networking
I use rtems-source-builder for building RTEMS tool sets.
And hello example codes are as below.
*  Classic API Hello World

#include <rtems.h>
#include <stdlib.h>
#include <stdio.h>
#include <math.h>

void another_func(void){
  printf( "powf: %f\n", powf(0.2, 4));

rtems_task Init(
  rtems_task_argument ignored
  printf( "\n\n*** HELLO WORLD TEST ***\n" );
  printf( "Hello World\n" );
  printf( "*** END OF HELLO WORLD TEST ***\n" );
  exit( 0 );

/* configuration information */

#include <bsp.h>

/* NOTICE: the clock driver is explicitly disabled */


#include <rtems/confdefs.h>
/* end of file */

I hope that these will help you.

From: users [mailto:users-bounces at] On Behalf Of 김찬
Sent: Sunday, November 13, 2016 10:54 PM
To: joel at<mailto:joel at>
Cc: rtems-users at<mailto:rtems-users at> <users at<mailto:users at>>
Subject: RE: how to use powf or ceilingf function in rtems..

Thanks, Joel,
I added the ‘-lm’ option using XCFLAGS variable (which should be extra compile flags).
So the ‘-lm’ option was given to the compile command (-c) only and was not being given to the link command. So I added –lm option at the end of COBJS list in my Makefile.base (which my Makefile includes).
I tried using XLDCONFIGS but it didn’t’ work I don’t know why.

From: Joel Sherrill [mailto:joel at]
Sent: Saturday, November 12, 2016 11:37 PM
To: 김찬 <ckim at<mailto:ckim at>>
Cc: rtems-users at<mailto:rtems-users at> <users at<mailto:users at>>
Subject: Re: how to use powf or ceilingf function in rtems..

On Nov 12, 2016 4:44 AM, "김찬" <ckim at<mailto:ckim at>> wrote:
> Hello,
> I’m trying to make an rtems application which uses some math function.
> I put #include <math.h>. When the powf function is in the Init() function, it works,
> But when powf is called from another function(I want to call this function from Init..), I get ‘undefined reference to powf’ error.
> I tried merning the files into one but it is the same. What can be the problem?

You should only have to include math.h and link against libm. There should be nothing odd.

My first guess is that the -lm argument is before the other .o on the link command.

Check that and if that isn't it, can you produce an example?

> Thanks!
> Chan Kim
> 김 찬 (Chan Kim)
> 책임연구원, 프로세서연구실, 지능형반도체연구부
> 한국전자통신연구원
> O) 042-860-5773  C) 010-3418-9152  E) ckim at<mailto:ckim at>
> _______________________________________________
> users mailing list
> users at<mailto:users at>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the users mailing list