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.

RTS Fast Math Supplement F28335

Other Parts Discussed in Thread: CONTROLSUITE

Hi

I am getting a strange result after adding the fast math supplement to my project.  The function of subtraction in the following code seems to break.  I am sending out the relevant values over CAN to debug.

mcu_skai2_B is a large struct contained in RAML6.

      mcu_skai2_B.max_flux_post_sum = mcu_skai2_B.max_flux_const
        - mcu_skai2_B.max_flux_err_lpf;

Usually mcu_skai2_B.max_flux_err_lpf = 0 therefore I expect mcu_skai2_B.max_flux_post_sum = mcu_skai2_B.max_flux_const and I see this when using the  normal rts2800_fpu32.lib. 

When I include the rts2800_fpu32_fast_supplement.lib I see a dramatic increase in performance of my code +- 100% faster but mcu_skai2_B.max_flux_post_sum = 0.

I am using Code Composer 3.3.82.13 with CGT 5.2.11, I have removed all compiler optimisation.  The original code is generated with simulink embedded coder, but I am making these modifications in CCS.

Does anybody have any suggestions as to why this might be happening?

Thanks

Nicholas

  • Nicholas,

    Can you post the disassembly of that line generated by both the normal RTS lib and the FastRTS lib

  • I assume by disassembly you mean the assembler code?  This is from the .lst files which I got by using the –al compiler parameter.  I have done a diff on the files before and the only difference is the time they are generated.  The .map files change to include the faster functions from the FastRTS library, but it all looks OK. 

     

    The line in question is line 1822, I have included some stuff before because that is where the other R0H register gets loaded.  I downloaded both the output files and the Fast RTS gives the error whilst the normal RTS doesn’t.  I should add that this function happens in the highest priority interrupt (only have one) so shouldn’t be interrupted in my opinion.

     

    Here is the ASM code with the normal RTS Library:

     

        4355                      ; call occurs [#FS$$DIV] ; |1814|

        4356 00000d9c 761F-         MOVW      DP,#_mcu_skai2_B+796

             00000d9d 001B

        4357 00000d9e E203-         MOV32     @_mcu_skai2_B+796,R0H

             00000d9f 001C

        4358                      .dwpsn  file "mcu_skai2.c",line 1822,column 7,is_stmt

        4359 00000da0 E2AF-         MOV32     R1H,@_mcu_skai2_B+778

             00000da1 010A

        4360 00000da2 E720          SUBF32    R0H,R1H,R0H           ; |1822|

             00000da3 0008

        4361 00000da4 7700          NOP

        4362 00000da5 E203-         MOV32     @_mcu_skai2_B+798,R0H

            00000da6 001E

     

     

    And here it is with the Fast RTS Library :

     

    4355                      ; call occurs [#FS$$DIV] ; |1814|

        4356 00000d9c 761F-         MOVW      DP,#_mcu_skai2_B+796

             00000d9d 001B

        4357 00000d9e E203-         MOV32     @_mcu_skai2_B+796,R0H

             00000d9f 001C

        4358                      .dwpsn  file "mcu_skai2.c",line 1822,column 7,is_stmt

        4359 00000da0 E2AF-         MOV32     R1H,@_mcu_skai2_B+778

             00000da1 010A

        4360 00000da2 E720          SUBF32    R0H,R1H,R0H           ; |1822|

             00000da3 0008

        4361 00000da4 7700          NOP

        4362 00000da5 E203-         MOV32     @_mcu_skai2_B+798,R0H

             00000da6 001E

     

    I hope you can help

  • Nicholas,

    The assembly is the same in both cases so Im thinking the variable mcu_skai2_B.max_flux_const never got initialized as there is no auto initialization function in the fastRTS so you have to include the normal RTS library in the project but there is an order of linking. Please check the doc for fastRTS on how to do it. You can find it in the controlSUITE folder: C:\TI\controlSUITE\libs\math\FPUfastRTS\V100\doc

    Let me know if that solves the problem

  • Hi Vishal

     

    I have already tried the linking order procedure specified in the FastRTS datasheet, the same thing happens.  mcu_skai2_B.max_flux_const is part of a struct that gets initialised during startup, it definitely has a value, I can read the values over CAN.

     

    How can I view the post-linker assembler code?

     

    Regards

     

    Nicholas

  • When you launch debug, open up the disassembly view from the View menu option in the debug perspective to see the assembly instructions or

    Is the value of const other than zero when you enter the interrupt or before the subtraction takes place?

  • Hi Vishal

     

    I haven't had much time to work on this issue recently, I have been catching up on documentation.  I will look at the disassembly of the .out files when I get a chance.  The value of const is non-zero when entering the interrupt.

     

    Regards

     

    Nicholas