AnsweredAssumed Answered

S32K144: function different link address caused different behavior

Question asked by 伟伟 刘 on Mar 20, 2019
Latest reply on Mar 27, 2019 by 伟伟 刘

Hello, guys,

I am using S32K144 for my project. I encountered a strange problem on S32 Design Studio for ARM V1.3, id:170119.
The following codes implement approximate milliseconds delay.

void DelayMS (INT32U num)
{
    INT32U i,j;

    for (i = 0,j = 0; i < num; i++){
        while(j++ < 9000) __asm__ ("NOP");
        j = 0;
    }
}
when this function "DelayMS" be linked at address xxxxxxx8(e.g. 0x00020078), the time delay is approach to 1.5*"num".
when i modify some codes(in other function) and this function "DelayMS" be linked at address xxxxxxx0(e.g. 0x00020080 0x00020090), xxxxxxx4(e.g. 0x00020084), xxxxxxxC(e.g. 0x0002008C), the time delay is approach to "num".

No project setting changed and the disassembly of function"DelayMS" is the same during other codes modified.
And i can sure no interrupt happened during function DelayMS executed.

why different link adddress caused different behavior?

Can somebody support me about this strange question?

Thanks.

Outcomes