NOTICE: This website will be shut down in the near future. Product content has moved to nxp.com. Forum content and FAQs have been moved to community.nxp.com. We encourage you to create a user account on nxp.com to use the new community forums and access NXP microcontroller content. We greatly appreciate your contributions and look forward to seeing you at our new web location.

 

How many breakpoints or watchpoints can I set?

lpcxpresso-support's picture

When debugging code running from flash memory, the debugger is limited on how many breakpoints it can set at any time by the number of hardware breakpoint units provided by the ARM CPU within the MCU.

Note: Code located in RAM can use a different mechanism offering the capability of essentially unlimited breakpoints.

Typically, the number of hardware breakpoints/watchpoints that can be set are as follows:

  • Cortex-M0/M0+  - 4 breakpoints, 2 watchpoints

  • Cortex-M3/M4   - 6 breakpoints, 4 watchpoints

though ARM does provide a level of implementation flexibilty, so always consult your MCU documentation. Generally NXP MCUs implement the maximum possible number. Note though that the Cortex-M0's within the LPC43xx multicore MCUs implement only 2 breakpoints and 1 watchpoint.

ARM's CPU documentation can be found here.

If you try to set too many breakpoints/watchpoints when debugging, then you will see an error of the form ...

   15: Target error from Set break/watch
   Unable to set an execution break - no resource available.

Also remember that a breakpoint will be (temporarily) required for the initial breakpoint set by LPCXpresso IDE by default on the function main() when you debug your application. For more details of this, please see the FAQ Changing the initial breakpoint on debug startup.

A breakpoint may also be required (temporarily) when single stepping your code.

On ARM7 based MCUs, also be aware that if semihosting functionality is being used, then this will consume one breakpoint, leaving only one for general use.

 

Viewing the breakpoints/watchpoints that are set

When viewing source (or disassembly) during a debug session, you can toggle breakpoints by simply clicking/double clicking in the left most side of the source view, typically shown as a light blue column. This is also where the breakpoint symbol is shown when one is set.

Breakpoints and watchpoints are also displayed, and can be deleted or disabled in the Breakpoints View. If you are using the "Develop" perspective, then by default it will be in the bottom left of the LPCXpresso window tabbed with the Quickstart and other views

If you have closed the Breakpoint view at some point, then you can reopen it using the "Window -> Show view" menu or 'Window -> Reset Perspective".

 

Skip All Breakpoints

You can use the "Skip all breakpoints" icon in the Breakpoints view (or on the main toolbar) to temporarily disable all breakpoints. This can be particularly useful on parts with only a few breakpoints available, particularly when you want to reload your image, which will typically cause the default breakpoint on main() to be temporarily set again automatically by the tools.

 

Breakpoints in multi-project workspaces

One other thing to watch is that breakpoints are stored in the workspace, and by default are effectively project independent. Thus if you set a breakpoint in one file, and have a file of the same name in another project within the workspace, then if you debug the second project you may hit breakpoints unexpectedly (or have all your breakpoint units consumed unexpectedly).

You can configure your debug launch configuration such that breakpoints are set with absolute filenames to avoid this issue though.

To do these, right click on the project and select...

Launch Configurations -> Open Launch Configurations -> Debugger

Then select the "Main" tab and tick the "Use full file path to set breakpoints" option.

Note - this assumes you have already debugged the project in question. If not simply select the "Create Launch Configurations" option first.

 

0
Your rating: None
feedback