Re: problem printing floating point values inside realtime tasks
Philipp Hasse <[email protected]> Sun, 20 Feb 2005 12:58:30 +0100
| Newsgroups | gmane.linux.real-time.rtlinux.general |
|---|---|
| Message-ID | <[email protected]> |
Hello,
I had the same problem here some time ago. Either you do what Herr
Hofrat stated in his email to convert fp numbers to decimal or you use
sprintf() and print floating point numbers into a buffer and then output
this buffer with rtl_printf (=printk) or FIFOs. Then of course you have
to link against the c (and maybe the gcc library) "-lc -lgcc". Don't
forget to use "-u sprintf" when running ld to link against the libs
because the kernel sources offer a sprintf function, too, but you want
to use the user space one. This method may have a bad influence on other
modules loaded after you've loaded your RT modules since all those
functions you link against from user space will be exported by your
module to kernel space. This way it could happen that another module,
say sg_mod, may use some of those functions when loaded after the rt
modules.
Regards
Philipp Hasse
Allan Barredo wrote:
>Hello to all,
>
>I tried printing a simple floating point value inside a real-time thread using:
>
> rtl_printf("%lf \n",dd_value);
>
>but somehow it manages to print only:
> %f
>and not the value.
>
>I have already used included the following in my code:
>
> pthread_attr_init(&attr);
> pthread_attr_setfp_np(&attr, 1);
>
> pthread_create( &mythread, &attr, mythreadcode, (void *)0);
>
>I also have the following in my Makefile:
> -L/usr/lib -lm -lc
>
>Am I missing something?
>
>Thanks.
>
>Allan
>_______________________________________________
>Rtl mailing list
>[email protected]
>http://www2.fsmlabs.com/mailman/listinfo/rtl
>
>
>
_______________________________________________
Rtl mailing list
[email protected]
http://www2.fsmlabs.com/mailman/listinfo/rtl