MCU Performance: running with emulator vs running without emulator


If I connect to my MCU with its SWD emulator/debugger, is there ANY difference in performance/behavior as compared to when I run the MCU without the emulator?

I am using a freescale KL25z Cortex M0+ with Arm GCC compiler on Eclipse. I am running at full speed.

Best Answer

In a word, yes.

As a rule of thumb, a debugger will slow down the target chip. The more expensive real time debugger/ICE tools reduce this but you will still get a measurable slow down.

The slow down is typically because the debugger sticks extra code into your program for breakpoints, RAM monitoring etc.

How much slow down is rather a "how long is a piece of string" question. Your best bet is to measure it.


Word to the wise

Always test your code comprehensively without a debugger. It is entirely possible to write embedded code that only works when the debugger is plugged in (the debugger slow down fixes timing issues inadvertently).