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.

How to run rts2800_fpu32 math functions from RAM on TMS320F2833?

We are running our code from flash in order to save RAM space.

However, we would like to run some time critical functions from RAM to get the full 150MIPS performance.

We have been following SPRA958I and have declared some functions to run from RAM using CODE SECTION.

e.g.

#pragma CODE_SECTION(CheckForHeartbeat, "ramfuncs");

   ramfuncs            : LOAD = FLASHD,
                         RUN = RAML0,
                         LOAD_START(_ramfuncsLoadStart),
                         LOAD_END(_ramfuncsLoadEnd),
                         RUN_START(_ramfuncsRunStart),
                         PAGE = 0

This runs the function out of RAM and gives a slight performance improvement, but is still slower than expected.

I think this is because some of the math library functions (in rts2800_fpu32) that this function uses are still in FLASH.

I have tried the following:

#pragma CODE_SECTION(cos, "ramfuncs");

but the function is still in flash....

00322cee    0000005e     rts2800_fpu32_eh.lib : cos.obj (.text)
00322cee   _cos

How can I get time critical functions in rts2800_fpu32 to reside in RAM?

  • Paul,

    There is certain syntax to extract an archive member and place it into an output section. You can then copy this output section to RAM from Flash the same way you are copying the ramfuncs section. You can see details on how to extract an archive member in Section 7.5.4.5 of the TMS320C28x Assembly Language Tools User’s Guide:

    http://www.ti.com/lit/ug/spru513d/spru513d.pdf

    You should be able to accomplish this task with this documentation. Please let me know if you have any troubles.

    Regards,

    Tim Love

  • Hi Tim,

    Thanks for your response - I have taken a look at the document and this looks exactly what I need.

    However I seem to be having trouble with the syntax - please can you help me with the syntax for, say, loading the cos and sin functions from rts2800_fpu32_eh.lib into RAML0. Or maybe even loading all the functions the linker needs from rts2800_fpu32_eh.lib into RAML0?

    Below shows some of the things I have tried, and the errors I get from the linker. Maybe you spot my mistake?

    Thanks in advance,

    Paul

    SECTIONS
    {
     
       /* Allocate program areas: */
       
       .cinit              : > FLASHA      PAGE = 0
       .pinit              : > FLASHA,     PAGE = 0
       .text               : > FLASHD      PAGE = 0
       codestart           : > BEGIN       PAGE = 0
       ramfuncs            : LOAD = FLASHD,
                             RUN = RAML0,
                             LOAD_START(_ramfuncsLoadStart),
                             LOAD_END(_ramfuncsLoadEnd),
                             RUN_START(_ramfuncsRunStart),
                             PAGE = 0
                             
       .rts  > RAML0
       {
               -l = rts2800_fpu32_eh.lib<cos.obj sin.obj> (.text)
       }                         
                             
       .rts  { -l = rts2800_fpu32_eh.lib (.text) }  > RAML0  

    ......

    C:\ti\ccsv4\ccsv4\utils\gmake\gmake -k all
    'Building target: CadenceTest1.out'
    'Invoking: Linker'
    'Flags: --silicon_version=28 -g -O3 --diag_warning=225 --optimize_with_debug --large_memory_model --unified_memory --float_support=fpu32 --optimizer_interlist --call_assumptions=3 --single_inline --opt_for_speed=5 --std_lib_func_defined -z -m"CadenceTest1.map" --stack_size=0x300 --warn_sections -i"C:/ti/ccsv4/ccsv4/tools/compiler/C2000 Code Generation Tools 5.2.11/lib" -i"C:/ti/ccsv4/ccsv4/tools/compiler/C2000 Code Generation Tools 5.2.11/include" --reread_libs --rom_model'
    "C:/ti/ccsv4/ccsv4/tools/compiler/C2000 Code Generation Tools 5.2.11/bin/cl2000" -@"ccsLinker.opt" -o "CadenceTest1.out"
    <Linking>
    "../DSP2833x_common/cmd/F28335.cmd", line 155: error: -l must specify a
       filename
    "../DSP2833x_common/cmd/F28335.cmd", line 155: error: cannot find file
       "cos.obj"
    "../DSP2833x_common/cmd/F28335.cmd", line 155: error: cannot find file
       "sin.obj"
    "../DSP2833x_common/cmd/F28335.cmd", line 155: error: cannot find file ".text"
    "../DSP2833x_common/cmd/F28335.cmd", line 158: error: -l must specify a
       filename
    "../DSP2833x_common/cmd/F28335.cmd", line 158: error: cannot find file ".text"
    "../DSP2833x_common/cmd/F28335.cmd", line 155: warning: no matching section
    "../DSP2833x_common/cmd/F28335.cmd", line 155: warning: no matching section
    "../DSP2833x_common/cmd/F28335.cmd", line 155: warning: no matching section
    "../DSP2833x_common/cmd/F28335.cmd", line 158: warning: section specifier
       matches no sections; potential matches are consumed by section specifier at
       "../DSP2833x_common/cmd/F28335.cmd", line 155
    "../DSP2833x_common/cmd/F28335.cmd", line 158: warning: no matching section
    "../DSP2833x_common/cmd/F28335.cmd", line 153: error: placement fails for
       object ".rts", size 0xccad (page 0).  Available ranges:
       RAML0        size: 0x3ec0       unused: 0x3ec0       max hole: 0x3ec0    
    "../DSP2833x_common/cmd/F28335.cmd", line 158: warning: memory range not found:
       RAML0 on page 1
    "../DSP2833x_common/cmd/F28335.cmd", line 158: error: run placement fails for
       object ".rts", size 0x0 (page 1)
    warning: ignoring fill value 0 for initialized section
       ".text:I2C_Interface_Hw.obj"
    warning: ignoring fill value 0 for initialized section
       ".cinit:I2C_Interface_Hw.obj"
    warning: ignoring fill value 0 for initialized section
       ".text:Battery_Manager.obj"
    warning: ignoring fill value 0 for initialized section
       ".cinit:Battery_Manager.obj"
    warning: ignoring fill value 0 for initialized section
       ".econst:.string:Battery_Manager.obj"
    warning: ignoring fill value 0 for initialized section
       ".text:UART_B_Interface_Hw.obj"
    warning: ignoring fill value 0 for initialized section
       ".text:Bluetooth_FileManager.obj"
    warning: ignoring fill value 0 for initialized section
       ".cinit:Bluetooth_FileManager.obj"
    warning: ignoring fill value 0 for initialized section
       ".econst:.string:Bluetooth_FileManager.obj"
    warning: ignoring fill value 0 for initialized section
       ".econst:_$P$T0$1:Bluetooth_FileManager.obj"
    warning: ignoring fill value 0 for initialized section
       ".econst:_$P$T1$2:Bluetooth_FileManager.obj"
    warning: ignoring fill value 0 for initialized section
       ".econst:_$P$T2$3:Bluetooth_FileManager.obj"
    warning: ignoring fill value 0 for initialized section
       ".econst:_$P$T3$4:Bluetooth_FileManager.obj"
    warning: ignoring fill value 0 for initialized section
       ".econst:_$P$T4$5:Bluetooth_FileManager.obj"
    warning: ignoring fill value 0 for initialized section
       ".econst:_$P$T5$6:Bluetooth_FileManager.obj"
    warning: ignoring fill value 0 for initialized section
       ".econst:_$P$T6$8:Bluetooth_FileManager.obj"
    warning: ignoring fill value 0 for initialized section
       ".econst:_$P$T7$9:Bluetooth_FileManager.obj"
    warning: ignoring fill value 0 for initialized section
       ".econst:_$P$T8$10:Bluetooth_FileManager.obj"
    warning: ignoring fill value 0 for initialized section
       ".econst:_$P$T9$11:Bluetooth_FileManager.obj"
    warning: ignoring fill value 0 for initialized section
       ".econst:_$P$T10$12:Bluetooth_FileManager.obj"
    warning: ignoring fill value 0 for initialized section
       "ramfuncs:DSP2833x_usDelay.obj"
    warning: ignoring fill value 0 for initialized section
       ".text:DSP2833x_SysCtrl.obj"
    warning: ignoring fill value 0 for initialized section
       "ramfuncs:DSP2833x_SysCtrl.obj"
    warning: ignoring fill value 0 for initialized section
       ".text:DSP2833x_Spi.obj"
    warning: ignoring fill value 0 for initialized section
       ".text:Display_Interface_Hw.obj"
    warning: ignoring fill value 0 for initialized section
       ".text:Display_Initial.obj"
    warning: ignoring fill value 0 for initialized section
       ".text:Display_Function.obj"
    warning: ignoring fill value 0 for initialized section
       ".cinit:Display_Function.obj"
    warning: ignoring fill value 0 for initialized section
       ".switch:Display_Function.obj"
    warning: ignoring fill value 0 for initialized section
       ".econst:_ucAumLogo3:Display_Function.obj"
    warning: ignoring fill value 0 for initialized section
       ".text:Display_Delay.obj"
    warning: ignoring fill value 0 for initialized section
       ".text:DSP2833x_PieVect.obj"
    warning: ignoring fill value 0 for initialized section
       ".econst:DSP2833x_PieVect.obj"
    warning: ignoring fill value 0 for initialized section
       ".text:DSP2833x_PieCtrl.obj"
    warning: ignoring fill value 0 for initialized section
       ".text:DSP2833x_MemCopy.obj"
    warning: ignoring fill value 0 for initialized section
       ".text:DSP2833x_I2C.obj"
    warning: ignoring fill value 0 for initialized section
       ".text:DSP2833x_Gpio.obj"
    warning: ignoring fill value 0 for initialized section
       ".text:DSP2833x_DefaultIsr.obj"
    warning: ignoring fill value 0 for initialized section
       ".text:DSP2833x_CpuTimers.obj"
    warning: ignoring fill value 0 for initialized section
       ".text:DSP2833x_CodeStartBranch.obj"
    warning: ignoring fill value 0 for initialized section
       "codestart:DSP2833x_CodeStartBranch.obj"
    warning: ignoring fill value 0 for initialized section
       ".text:DSP2833x_Adc.obj"
    warning: ignoring fill value 0 for initialized section
       ".cinit:Heartbeat_Detect.obj"
    warning: ignoring fill value 0 for initialized section
       "ramfuncs:Heartbeat_Detect.obj"
    warning: ignoring fill value 0 for initialized section
       ".text:ADC_Interface_Hw.obj"
    warning: ignoring fill value 0 for initialized section
       ".cinit:ADC_Interface_Hw.obj"
    warning: ignoring fill value 0 for initialized section
       ".text:MMC_Command_Lib.obj"
    warning: ignoring fill value 0 for initialized section
       ".econst:.string:MMC_Command_Lib.obj"
    warning: ignoring fill value 0 for initialized section
       ".text:MBSpi_Interface_Hw.obj"
    warning: ignoring fill value 0 for initialized section
       ".text:Timer_Interface_Hw.obj"
    warning: ignoring fill value 0 for initialized section
       ".adc_cal:DSP2833x_ADC_cal.obj"
    warning: ignoring fill value 0 for initialized section
       ".text:DebugUART_Interface_Hw.obj"
    warning: ignoring fill value 0 for initialized section
       ".text:GPIO_Interface_Hw.obj"
    warning: ignoring fill value 0 for initialized section ".text:Main.obj"
    warning: ignoring fill value 0 for initialized section ".cinit:Main.obj"
    warning: ignoring fill value 0 for initialized section
       ".econst:.string:Main.obj"
    warning: ignoring fill value 0 for initialized section
       ".text:Signal_Manager.obj"
    warning: ignoring fill value 0 for initialized section
       ".cinit:Signal_Manager.obj"
    warning: ignoring fill value 0 for initialized section
       ".econst:.string:Signal_Manager.obj"
    warning: ignoring fill value 0 for initialized section
       ".text:Noise_Cancellation.obj"
    warning: ignoring fill value 0 for initialized section
       ".cinit:Noise_Cancellation.obj"
    warning: ignoring fill value 0 for initialized section ".text:TickTimer.obj"
    warning: ignoring fill value 0 for initialized section ".cinit:TickTimer.obj"
    warning: ignoring fill value 0 for initialized section
       ".text:Status_LED_Hw.obj"
    warning: ignoring fill value 0 for initialized section
       ".text:rts2800_fpu32_eh.lib<boot.obj>"
    warning: ignoring fill value 0 for initialized section
       ".reset:rts2800_fpu32_eh.lib<boot.obj>"
    warning: ignoring fill value 0 for initialized section
       ".text:rts2800_fpu32_eh.lib<exit.obj>"
    warning: ignoring fill value 0 for initialized section
       ".cinit:rts2800_fpu32_eh.lib<exit.obj>"
    warning: ignoring fill value 0 for initialized section
       ".text:rts2800_fpu32_eh.lib<fs_div.obj>"
    warning: ignoring fill value 0 for initialized section
       ".text:rts2800_fpu32_eh.lib<cos.obj>"
    warning: ignoring fill value 0 for initialized section
       ".text:rts2800_fpu32_eh.lib<sin.obj>"
    warning: ignoring fill value 0 for initialized section
       ".text:rts2800_fpu32_eh.lib<_lock.obj>"
    warning: ignoring fill value 0 for initialized section
       ".cinit:rts2800_fpu32_eh.lib<_lock.obj>"
    warning: ignoring fill value 0 for initialized section
       ".text:rts2800_fpu32_eh.lib<args_main.obj>"
    warning: ignoring fill value 0 for initialized section
       ".text:rts2800_fpu32_eh.lib<memset.obj>"
    warning: ignoring fill value 0 for initialized section
       ".text:rts2800_fpu32_eh.lib<sprintf.obj>"
    warning: ignoring fill value 0 for initialized section
       ".text:rts2800_fpu32_eh.lib<strncmp.obj>"
    warning: ignoring fill value 0 for initialized section
       ".text:rts2800_fpu32_eh.lib<memcpy_ff.obj>"
    warning: ignoring fill value 0 for initialized section
       ".text:rts2800_fpu32_eh.lib<_printfi.obj>"
    warning: ignoring fill value 0 for initialized section
       ".econst:rts2800_fpu32_eh.lib<_printfi.obj>"
    warning: ignoring fill value 0 for initialized section
       ".econst:.string:rts2800_fpu32_eh.lib<_printfi.obj>"
    warning: ignoring fill value 0 for initialized section
       ".text:rts2800_fpu32_eh.lib<atoi.obj>"
    warning: ignoring fill value 0 for initialized section
       ".econst:__ctypes_:rts2800_fpu32_eh.lib<ctype.obj>"
    warning: ignoring fill value 0 for initialized section
       ".text:rts2800_fpu32_eh.lib<ltoa.obj>"
    warning: ignoring fill value 0 for initialized section
       ".text:rts2800_fpu32_eh.lib<memccpy.obj>"
    warning: ignoring fill value 0 for initialized section
       ".text:rts2800_fpu32_eh.lib<strcpy.obj>"
    warning: ignoring fill value 0 for initialized section
       ".text:rts2800_fpu32_eh.lib<strlen.obj>"
    warning: ignoring fill value 0 for initialized section
       ".text:rts2800_fpu32_eh.lib<fd_cmp.obj>"
    warning: ignoring fill value 0 for initialized section
       ".text:rts2800_fpu32_eh.lib<fd_div.obj>"
    warning: ignoring fill value 0 for initialized section
       ".text:rts2800_fpu32_eh.lib<fd_mpy.obj>"
    warning: ignoring fill value 0 for initialized section
       ".text:rts2800_fpu32_eh.lib<fd_neg.obj>"
    warning: ignoring fill value 0 for initialized section
       ".text:rts2800_fpu32_eh.lib<fd_sub.obj>"
    warning: ignoring fill value 0 for initialized section
       ".text:rts2800_fpu32_eh.lib<fd_toi.obj>"
    warning: ignoring fill value 0 for initialized section
       ".text:rts2800_fpu32_eh.lib<fd_tol.obj>"
    warning: ignoring fill value 0 for initialized section
       ".text:rts2800_fpu32_eh.lib<fs_tofd.obj>"
    warning: ignoring fill value 0 for initialized section
       ".text:rts2800_fpu32_eh.lib<l_div.obj>"
    warning: ignoring fill value 0 for initialized section
       ".text:rts2800_fpu32_eh.lib<l_tofd.obj>"
    warning: ignoring fill value 0 for initialized section
       ".text:rts2800_fpu32_eh.lib<ll_cmp.obj>"
    warning: ignoring fill value 0 for initialized section
       ".text:rts2800_fpu32_eh.lib<ll_div.obj>"
    warning: ignoring fill value 0 for initialized section
       ".text:rts2800_fpu32_eh.lib<ll_mpy.obj>"
    warning: ignoring fill value 0 for initialized section
       ".text:rts2800_fpu32_eh.lib<fd_add.obj>"
    error: errors encountered during linking; "CadenceTest1.out" not built



  • OK, I figured it out - I found the following syntax worked for me in order to run the maths functions from RAML0 to RAML2 blocks:

    .rts  { -lrts2800_fpu32_eh.lib (.text) }  >> RAML0 | RAML1 | RAML2   PAGE = 0

    The syntax is slightly different to the documentation, but this might be because I am using an older version of CCS (v4).

    Thanks for your help Tim.

  • A better solution for this (allows the CPU to be power cycled) is described here:-

    http://e2e.ti.com/support/microcontrollers/tms320c2000_32-bit_real-time_mcus/f/171/p/183181/677051.aspx#677051

    In this solution sections of the library are loaded from FLASH to RAM on power up, and executed out of RAM for faster performance.