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.

Compiler/LAUNCHXL-F28069M: How to put Math Libraries in RAM or to inline their functions?

Part Number: LAUNCHXL-F28069M

Tool/software: TI C/C++ Compiler

Dear All

          I want to put the functions of

rts2800_fpu32_fast_supplement.lib

rts2800_fpu32.lib

in RAM (like ranfuncs)

or alternately inline their functions

FPUmathTables.obj can be in FLASH

I prefer the former option

Thanks

Luis Gonçalves

  • user4957458 said:

              I want to put the functions of

    rts2800_fpu32_fast_supplement.lib

    rts2800_fpu32.lib

    in RAM (like ranfuncs)

    Is all of the following correct?  When the system powers on, these functions are in FLASH.  Before any of these functions are called, they are copied from FLASH to RAM.  All calls to these functions are to their address in RAM.  

    Thanks and regards,

    -George

  • Can you use --opt_level=4? This will be able to inline some functions from rts2800_fpu32.lib, but not all of them. Which functions in particular do you want to inline?
  • For example the floating division in

    rts2800_fpu32_fast_supplement.lib

    and I have the optimization for speed to the maximum

  • I am still unsure about what you need.  But I will take a guess.

    The linker command file F28069.cmd can be found in a location similar to ...

    C:\ti\ccsv7\ccs_base\c2000\include

    It is a good guess that you either use this linker command file, or one similar to it.  This file contains these lines ...

       ramfuncs            : LOAD = FLASHD,
                             RUN = RAML0,
                             LOAD_START(_RamfuncsLoadStart),
                             LOAD_END(_RamfuncsLoadEnd),
                             RUN_START(_RamfuncsRunStart),
                             PAGE = 0

    Lines very similar to these are described in the article Linker Command File Primer, in the section titled Load at One Address, Run from a Different Address.  

    Here is one way to rewrite those lines ...

       ramfuncs
       {
          *(ramfuncs)
    
          /* insert your code here */
    
       }                   : LOAD = FLASHD,
                             RUN = RAML0,
                             LOAD_START(_RamfuncsLoadStart),
                             LOAD_END(_RamfuncsLoadEnd),
                             RUN_START(_RamfuncsRunStart),
                             PAGE = 0   
    

    This does exactly the same thing.  Line 3 explicitly names the input sections.  Line 6 is where you insert the code I describe next.

    The general idea is to adapt the technique described in the section of the Linker Command File Primer article titled Allocate a Single Input Section from a Library.  Something like this ...

        libc.a(.text)
        rts2800_fpu32_fast_supplement.lib(.text)

    This adds all of the functions from libc.a and rts2800_fpu32_fast_supplement.lib to the ramfuncs output section.  Note the linker replaces libc.a with whatever compiler RTS library is appropriate.  In your case, it is rts2800_fpu32.lib.  Also note you may have to precede these library names with the option -L .

    I am confident these suggestions, or something close to them, will solve your problem.

    Thanks and regards,

    -George

  • Since it has been a while, I presume you have resolved your problem. I'd appreciate hearing how you resolved it.

    Thanks and regards,

    -George
  • I found some way (there is an test that gives that)  to get the program size by optimization parameter of speed. The program increases in size and I supposed rhat one of the optimizations was inlining. I did not unassembly the code. I just want the maximum speed.

    When I have time and the board I will found the addresses of the sine and float division (fast library) and if them are in RAM or FLASH (in debug mode)

    Thanks

    Luis Gonçalves

    PS I suppose you know better that than me