DSPRelated.com
Forums

FastRTS library usage

Started by William C Bonner April 5, 2007
I'm programming in C++ on a 6713 DSP. I've told the compiler to use the
-pe switch for embedded C++. I'm linking in the fastmath67x.lib file
into my project, and have listed that library in the linker order before
any of the other files without linker order.

Am I doing what I need to take advantage of the fastmath library for
things like the cos() and sin() functions in my code, or am I required
to include special header files and special function names? If I'm using
the cos() function with both a float argument and a float return value,
does the compiler automatically select the correct cos() function, and
match it with the correct function from the fastrts library?

I'm working with code that needs to remain largely cross platform
between running in windows and running on the dsp, but am willing to do
whatever is necessary to optimize the calls on the DSP.
I'm pretty sure you need to include mathf.h and call sinf() and cosf() to use the faster single precision routines. I often use the debugger and single step into the routine to be sure what label is actually called and that the routine is in fast internal memory. Conversely, I've often found that on the PC the sinf() and cosf() functions exist for compatibility, but just end up calling double precision routines.

Tom Kerekes

William C Bonner wrote:
I'm programming in C++ on a 6713 DSP. I've told the compiler to use the
-pe switch for embedded C++. I'm linking in the fastmath67x.lib file
into my project, and have listed that library in the linker order before
any of the other files without linker order.

Am I doing what I need to take advantage of the fastmath library for
things like the cos() and sin() functions in my code, or am I required
to include special header files and special function names? If I'm using
the cos() function with both a float argument and a float return value,
does the compiler automatically select the correct cos() function, and
match it with the correct function from the fastrts library?

I'm working with code that needs to remain largely cross platform
between running in windows and running on the dsp, but am willing to do
whatever is necessary to optimize the calls on the DSP.
This is what's confusing me... I was reading the SPRU100a.pdf file ( I
found a web accessable copy here
http://wisconsin.cern.ch/ROD/ti_documents/spru100a.pdf ) that documents
the FastRTS library and in section 1.1 it states:

> The FastRTS library includes all floating-point math routines
> currently provided
> in existing run-time-support libraries for C6000. These new functions
> can be called with the current run-time-support library names or the new
> names included in the FastRTS library.
and then in section 2.3.2

> In addition to correctly installing the FastRTS software, you must
> follow these
> steps to include a FastRTS function in your code:
>
> * Include the function header file corresponding to the FastRTS
> function:
> o The fastrts67x.h header file must be included if you use
> the special FastRTS function names.
> o The recip.h header file must be included if the recip,
> recipdp, recipf, or recipsp function is called.
> o The math.h header file must be included if you are using
> the standard run-time-support function names.
> * Link your code with fastrts67x.lib for little-endian code or
> fastrts67xe.lib for big-endian code.
>

I'm working primarily with floats and not doubles. Am I very likely
using double precision routines for things like cos() and sin() if I'm
not going out of my way to explicitly call sinf() and cosf() I'd like to
know if I should expect warning messages from the compiler that it's
changing the resolution, if the compiler is correcting the calls using
the standard override mechanism, or what.

I find it frustrating chasing through the include files because code
composer studio doesn't correctly trace C++ style headers in its list of
include files, and when you try to load a file like cmath in the editor
it prompts for what file you want to open it with.

In what I'm doing, I'm just trying to gain the most speed improvemet
possible, and I'm primarily porting other peoples code to the DSP.

Wim.

Tom Kerekes wrote:
> I'm pretty sure you need to include mathf.h and call sinf() and cosf() to use the faster single precision routines. I often use the debugger and single step into the routine to be sure what label is actually called and that the routine is in fast internal memory. Conversely, I've often found that on the PC the sinf() and cosf() functions exist for compatibility, but just end up calling double precision routines.
>
> Tom Kerekes
>
> William C Bonner wrote:
> I'm programming in C++ on a 6713 DSP. I've told the compiler to use the
> -pe switch for embedded C++. I'm linking in the fastmath67x.lib file
> into my project, and have listed that library in the linker order before
> any of the other files without linker order.
>
> Am I doing what I need to take advantage of the fastmath library for
> things like the cos() and sin() functions in my code, or am I required
> to include special header files and special function names? If I'm using
> the cos() function with both a float argument and a float return value,
> does the compiler automatically select the correct cos() function, and
> match it with the correct function from the fastrts library?
>
> I'm working with code that needs to remain largely cross platform
> between running in windows and running on the dsp, but am willing to do
> whatever is necessary to optimize the calls on the DSP.
>
>
>