How do you configure the IAR debugger to stop clocks when you hit a break point?

I have an issue where I hit a break point and the timer continues to run. As a result it triggers at inappropriate times. Is there a way to have the debugger halt the clock when debugging so the timers stop as well? Thanks, cmerritt

Thank you for your query. I understand that you are looking to halt a GPT (timer) clock when the ADuCM302x core is halted due to a breakpoint. One way you can achieve this in IAR is by use of C-SPY macros. Here is a brief outline of how you can use custom C-SPY macro functions to halt GPT clocks (and more generally, to halt a peripheral clock or to read/modify a peripheral register) on hitting a breakpoint in IAR:

Create a .mac file - for example, a myDebug.mac file where you can define multiple macro functions.

Select the Use macro file(s) option and add the path to your .mac file in the IAR Debugger options - see snapshot below.

3. Now, edit the .mac file to define some macro functions. For example, the halt_GPT_clocks() macro below configures the CLKG0_CLK_CTL5 register to halt peripheral clocks corresponding to GPT0, GPT1, and GPT2. The resume_GPT_clocks() macro resumes the same peripheral clocks.

4. Map the macros defined to break-points in your code. To do this, right click on the breakpoint in your code and click on the Edit Breakpoint option. Then, add the relevant macro function call to the Action field.

5. Now, when you run your code in debug mode, on hitting a breakpoint, IAR will execute the macro function corresponding to that breakpoint. For the halt_GPT_clocks () and resume_GPT_clocks () macro functions above, you should see the following message in your IAR debug log window.