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.

TMS320F280049: Calling Device_cal safely from optimised code

Part Number: TMS320F280049

I've had some problems with Device_cal() changing the state of CPU registers (specifically XAR3) which the compiler is using to store automatic variables.  From looking at the disassembly for Device_cal(), it doesn't appear to push CPU registers onto the stack.  I'm calling it from in an initialisation function, so before interrupts are enabled.

My optimisation settings are O2 with optimise for speed = 2.  The flags excluding include paths etc are: v28 -ml -mt --cla_support=cla2 --float_support=fpu32 --tmu_support=tmu0 --vcu_support=vcu0 -O2.

Do you have any recommendations on how to ensure that Device_cal() can be called safely from optimised code?

  • Hello,

    I'm guessing you're calling Device_cal() in your code as a temporary measure until we get it added to the GEL file?

    Yeah, it looks like Device_cal() is not following the "save on entry" convention. I think you'll need to do the save and restore yourself. See if doing it with __asm() works.

    Whitney

  • Yes that's correct.
    I'll try writing some __asm() statements. It looks like I'll need to store XAR0, XAR2 and XAR3 to be safe.