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.

Boot ROM math functions cause CSM violations

Part Number: TMS320F28027

I am having issues getting my application to run correctly with the CSM turned on.  I've identified a line of code that works with the CSM unlocked, and always returns 0 when the CSM is locked.

float value = (float)function_returning_long();

When I step through this, there is a line in the disassembly:

767FF890    LCR          0x3ff890

As this address is inside the Boot ROM, I'm guessing I'm somehow violating the security rules.  I dont quite understand why, since this is all happening in local variables, on the stack, which is in unsecured RAM.

In my map file, 0x3ff890 is L$$TOFS

I also have several other calls to functions in the Boot ROM.

Is it possible to link these functions to Flash or RAM? 

Ive looked at several other posts that reference this general idea, but I'm struggling with the Linker syntax.

  • Accessing unsecure memory from secure memory should not be an issue but the vice versa is not true. Let me research this more.

    On a different note, is this post a continuation of https://e2e.ti.com/support/microcontrollers/c2000/f/c2000-microcontrollers-forum/991046/tms320f28027-firmware-automatically-resets-when-csm-is-locked/3662914#3662914? If not, could you please close the other post?

  • The title of your post refer to Boot-ROM math functions, but per Fig 2-1 in SPRUI09 (page 162), math stuff starts at 0x3FE000 and ends at 0x3FF4AF. 

  • I don't think these are IQ math functions.  These are functions that convert between float and long.  Here is my actual code:

    _iq Motor_PositionMrev(void)
    {
        float motor_position_eus = (float) Observer_motorEncoderMultiTurnPositionGet_eus();
        float motor_number_of_turns = motor_position_eus / MA702_EU_PER_360_DEGREES;
        return (long) ((motor_number_of_turns) * 16777216.0L);

    }

    With CSM enabled, this function returns 0, even when the intermediate values are not 0.

    With CSM disabled, this function returns nonzero values.

    Here is the end of my linker file, showing where these problematic functions are :

    abs   003ff083  __IQ24div                                         
    abs   003ff2aa  __IQ24sqrt                                        
    abs   003ff2ec  __IQ29sqrt                                        
    abs   003ff3c2  __IQ24sin                                         
    abs   003ff82b  __IQ24sinPU                                       
    abs   003ff854  __IQ24cosPU                                       
    abs   003ff87b  __IQ29rsmpy                                       
    abs   003ff890  L$$TOFS                                           
    abs   003ff8aa  UL$$TOFS                                          
    abs   003ff8bd  U$$TOFS                                           
    abs   003ff8d2  _Flash2802x_Program                               
    abs   003ff98e  _Flash2802x_Erase                                 
    abs   003ffee5  FS$$TOL                                           
    abs   003fff0e  FS$$TOI                                           
    abs   003fff33  I$$TOFS                                           
    abs   003fff4d  FS$$NEG                                           
    abs   003fff52  __IQ30rsmpy                                       
    abs   003fff67  __IQ24toF                                         
    abs   003fff7b  __IQ30toF                                         
    abs   003fff8f  __IQ24rmpy 

  • Hi Todd,

    Is it possible to share the complete map file and the linker cmd file?

    Regards,

    Veena

  • How should I do that?  I've tried dragging and dropping them, and they say they're uploading, but that doesnt actually happen.  Can I email them to you?

  • Please check the attached graphic and see if it helps you. You may need to rename the extension of the linker command file to .txt. Else it may be blocked by our firewall.

    File attach.pdf

  • After thinking about it, I'd rather not post this information on a public forum.  Can I email it to you?

  • If you could copy paste the section mapping from linker cmd file, that would be helpful.

    The L$$TOFS function is part of the rts library. It goes under .text section. I have mapped .text section to flash region and I see the function is allocated to Flash address.

    .text : >> FLASHA | FLASHC | FLASHD, PAGE = 0

    0     003f6127  L$$TOFS    

    Regards,

    Veena

  • Veena,

    I've built lab10a with your new linker file and CSM_ENABLE defined.  I still get lots of functions with $$ in the name linked in 0x3ffxx.  I'm not sure what I'm supposed to see from this lab.

  • F28027F_CSM.cmd

    You might use the attached .cmd file to replace the original one in the example project, and enable the macro definition CSM_ENABLE.

  • This was the previous recommendation, which I did.  I saw no change.  I'm not sure what this lab was supposed to demonstrate, as it relates to my problem.

  • The issue should be related to the codes you added. You should link the const section to page 1 as the example .cmd file.