This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

C674x fast math linking into internal memory

I would like to link some of the math functions in C674x fast math library for performance reasons.  In particular I need log10sp, exp10sp and recip.  Some others like sinsp and sindp I would like to link into external SDRAM.  Can some one suggest a suitable linker command file?

Currently I am using

   output_section_1  : {
    -lc674xfastMath.lib<lib_file.obj>(.criticalCode)
   } > IRAM

which seems to do nothing ans the linker complains with no matching section on this line.

Thanks,

Fawad

  • Since this is a Development Tools question and not a hardware question, we will have it moved to the TI C/C++ Compiler - Forum. People there may give you a better answer than mine.

    Doing what you describe is possible with the linker. There are several special features of the linker like the method you show above. The best place to look for answers is the C6000 Assembly Language Tools User's Guide for the version of the tools you are using.

    Whenever I have tried to use any of these special features, I have to try to the best of my understanding, like you have done. Then examine the results in the .map file or the error messages and go back to the ALT UG to see what I may be doing wrong.

    Good luck. And please post back any successes that you have once you have this working.

    Regards,
    RandyP

  • Specifying an input section of library member is discussed in the C6000 Assembly book in the section titled Specifying Library or Archive Members as Input to Output Sections .  Be careful, though, there is a known error documented here.  So, to make use of this feature, you need to know three things:

    1. The name of library
    2. The name of the object file in the library
    3. The name of the section in the object file

    For the name of the library, I'll use c67xfastMath.lib.  That's the name of a library in the (possibly outdated) C67x Math Lib I have.

    To see the names of the object files in the library, use the archiver ar6x with the -t option ...

    C:\Program Files\Texas Instruments\c67xmathlib_2_01_00_00\lib>ar6x -t c67xfastMath.lib
    
          SIZE   DATE                        FILE NAME
      --------   ------------------------    -----------------
          2592   Fri Oct 15 14:43:27 2010    atan2dp.obj
          4947   Fri Oct 15 14:43:29 2010    atan2dp_v.obj
          1714   Fri Oct 15 14:47:41 2010    atan2sp.obj
          3769   Fri Oct 15 14:49:34 2010    atan2sp_v.obj
    ...
    

    Here's is one way to filter that to see the files related to log functions ...

    C:\Program Files\Texas Instruments\c67xmathlib_2_01_00_00\lib>ar6x -t c67xfastMath.lib | find "log"
          2068   Fri Oct 15 14:46:25 2010    log10dp.obj
          4468   Fri Oct 15 14:46:26 2010    log10dp_v.obj
          1858   Fri Oct 15 14:51:48 2010    log10sp.obj
          5610   Fri Oct 15 14:52:17 2010    log10sp_v.obj
          2081   Fri Oct 15 14:46:27 2010    log2dp.obj
          4459   Fri Oct 15 14:46:28 2010    log2dp_v.obj
          1854   Fri Oct 15 14:52:17 2010    log2sp.obj
          5598   Fri Oct 15 14:52:46 2010    log2sp_v.obj
          2075   Fri Oct 15 14:46:29 2010    logdp.obj
          4409   Fri Oct 15 14:46:30 2010    logdp_v.obj
          1846   Fri Oct 15 14:52:46 2010    logsp.obj
          5196   Fri Oct 15 14:52:59 2010    logsp_v.obj
    
    

    For this example, I'll pick the file log10sp.obj.  

    For the name of the section, the simplest thing is to depend on the convention that code is placed in the .text section.

    Putting it all together, something like this will work ...

    output_section_1 {
       -lc67xfastMath.lib<log10sp.obj>(.text)
       /* list other critical library sections here */
    } > IRAM
    

    Thanks and regards,

    -George

  • George,

    Thanks for the quick answer.  i used

       output_section_1  : {
        -lc674xfastMath.lib(.text)
     
       } > IRAM

    And all the functions I need were linked into IRAM.  But I use log10sp_v in time critical code but I also use log10dp in a background task that generate some filter coefficients.  As I am a little short of Internal memory I would like to only have log10sp_v in internal and log10dp in external.  Is there a way to do that?

    Thanks,

    Fawad

  • Something like this will work ...

       output_section_1 {
          -lc67xfastMath.lib<log10sp_v.obj>(.text)
          /* list other critical library sections here */
       } > FAST_MEMORY
    
       output_section_2 {
          -lc67xfastMath.lib<log10dp.obj>(.text)
       } > SLOW_MEMORY
    

    One simplification to consider ... If you form the general .text section with a line like ...

       .text > SLOW_MEMORY

    then you could just not create output_section_2 at all, and let the .text from log10dp.obj become part of this general .text output section.

    Thanks and regards,

    -George

  • George,

    This worked.  Thanks.

    Fawad