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.
Hi,
With optimization turned off, the code executes in approximately 4 seconds.
First of all, your measured time does not make sense. You are talking about real time 4 seconds? The M4F processor has about 150MIPS at 120Mhz. To put in perspective, in 4 seconds, a 120Mhz processor can potential execute hundreds of million instructions. Your GPIO_SetMasterPin should take just a few cycles to complete. You can use the disassembly window to view the assembly code and I expect it to take tens of CPU cycles which should complete less than uS, not seconds.
As far as optimization level between off vs 0, I can have our compiler expert provide feedback. But I will suggest you compare the disassembly between the off and 0 first to see what is the difference.
Sorry for not clarifying earlier, until the point where this code is executed, the total running time of my program is approximately 4 seconds. However, when I enable optimizer level 0, it increases to 7 seconds. I measure this difference in time by monitoring the voltage change for PM5. Also, it would be great to get help from your compiler expert.
I've never done a disassembly comparison before. Should I be looking for extra operations that could increase the execution time?
Add the compiler option --src_interlist. This causes the compiler to keep the auto-generated assembly file. It has the same name as the source file, but the extension is changed to .asm. Build the file with different levels of optimization, then inspect the assembly file. I suspect you will understand the difference at that point. If you don't, then post here again.
Thanks and regards,
-George