Tool/software: TI C/C++ Compiler
I use delay function SysCtlDelay() to delay millisecond, the function is implemented as follows:
void SleepMillisecond(u16 u16milisecond) { SysCtlDelay(SysCtlClockGet() / 3000 * u16milisecond);//1ms }
void SysCtlDelay(uint32_t ui32Count) { __asm(" subs r0, #1\n" " bne.n SysCtlDelay\n" " bx lr"); }
Under normal circumstances, It's work fine. But when I change some Precompiled Macro (define by myself), This function will output double delay time. I'm so sure that Precompiled Macro do not affect this code.
I use oscilloscope to check Clock is OK. I also check anothter function execution time, however Precompiled Macro is change, execution time is same, except function SysCtlDelay().
I step into this function to debug disassembly, the executed number of assembly instructions in both cases are the same. So I really don't understand why it has different result with same code and same clock?
Compiler Environment: IAR Embedded Workbench 7.0