NOTICE: The Processors Wiki will End-of-Life on January 15, 2021. It is recommended to download any files or other content you may need that are hosted on processors.wiki.ti.com. The site is now set to read only.

Watchpoints for Stellaris in CCS

From Texas Instruments Wiki
Jump to: navigation, search

Introduction[edit]

This page describes how to setup Hardware breakpoints, Watchpoints and Count Events in CCS v4, v5 and v6 for the Stellaris Cortex M3/M4F devices. Hardware breakpoints stop execution of the program. Hardware watchpoints allow you to halt when a read or write access is made to a data variable address. Count Event can be used to measure clock cycles between two points in the code. Since these are all implemented internally by the hardware and require on-chip analysis resources, there is usually a limit to the maximum number of events that can be enabled at one time.

Configure a Hardware Breakpoint[edit]

The steps below describe how to configure a hardware breakpoint in CCS.

  1. Configure CCS for a Stellaris target and launch a debug session.
  2. In the Debug Perspective, open the breakpoint dialog: View->Breakpoints.
  3. Use the pulldown to select Hardware Breakpoint.

    Hw breakpoint.png

  4. In the Location field, specify the address where the breakpoint should be set.
    Alternately, if the code is programmed to Flash, double-clicking on a line of code in the editor will automatically set a hardware breakpoint.

Note: Stellaris devices are limited to 6 hardware breakpoints. If you try to set more than the allowed limit, the following message will appear

No aet resource.png

Also, by default the debugger sets breakpoints to halt at CIO and end of program, so two breakpoints will be used for this, allowing only 4 breakpoints to be available to the user. These breakpoints can be disabled by going into menu Run->Debug Configurations…, Target tab, and unchecking the boxes for “Halt at program termination” and “Enable CIO function use”.

Cio endprogram bp.png

Configure a Hardware Watchpoint[edit]

  1. Configure CCS for a Stellaris target and launch a debug session.
  2. In the Debug Perspective, open the breakpoint dialog: View->Breakpoints.
  3. Use the pulldown to select Hardware Watchpoint.

    Hw watchpoint.png

  4. In the Location field, specify the address that you want to watch and if it should stop on a read or write access. For eg, if you want to watch when a global variable named g_ulGPIOa is written to, you can specify &g_ulGPIOa for the Location and Write for the memory access.

    Hw watchpoint1.png

  5. The watchpoint can be further customized, if needed, by right-clicking on the watchpoint and selecting Properties. From this dialog box you can:
    • Configure a data read/write of a particular value from the address
    • Configure the size of the data
    • Configure a mask value (bits that will be ignored)

      Hw watchpoint2.png

Configure a Count Event[edit]

The Profile Clock on Cortex M3/M4F is disabled due to Hardware limitations. Hence the menu Run->Clock in CCS will be greyed out. However, a count event can still be configured and can provide clock cycles.

  1. Configure CCS for a Stellaris target and launch a debug session.
  2. In the Debug Perspective, open the breakpoint dialog: View->Breakpoints.
  3. Use the pulldown to select Count Event.

    Count event.png

  4. Select the Event to Count as Clock Cycles.

    Clock cycles.png

  5. Enable a breakpoint in your code by double-clicking on the line in the source file. Select the Run icon. When the breakpoint is reached the Count Event will display the number of Clock Cycles.

    Count event1.png

  6. You can also set two breakpoints to count the number of cycles between two places in your code (useful to profile functions):
    Enable the count event as shown above, then right-click on its entry in the Breakpoints view, select Properties and check the box marked Reset Count on Run. This will make the Event counter reset every time the processor is put to run, therefore allowing counting events within breakpoint boundaries.

    Count event2.png

  7. Set two breakpoints in your code
  8. Run to the first breakpoint. The Event counter will count the number of cycles up to this point in your code. You can disregard this number.
  9. Run to the second breakpoint. This time the Event count will show the number of cycles between the first and the second breakpoint.

Note: The number of CPU cycles can vary greatly depending on the type of memory the code is running from (Flash, RAM, external).

Profiler[edit]

The function profiler is not supported on Stellaris hardware. The CCS menu Run->Profile->Set up Profile Data Collection does not permit activation of function profiling. An alternate method is to use the Count Event as described above.

Function profiling is supported in the Cortex M3 core simulator included with CCS v4/v5.


Checking for stack overflow[edit]

A common issue causing software instability is stack overflow. When building a project the stack size is specified in the project linker options (or in the configuration file for DSP/BIOS projects). That corresponding size will be allocated for the stack by the linker. The linker will generate a symbol called __stack (two preceding underscores) that corresponds to the lowest address of the stack.

A hardware watchpoint can be used to monitor when __stack is written to, which will indicate that a stack overflow has occurred.

  1. Configure CCS for a Stellaris target and launch a debug session.
  2. In the Debug Perspective, open the breakpoint dialog: View->Breakpoints.
  3. Use the pulldown to select Hardware Watchpoint.
  4. For the Location, enter the symbol __stack. For the Access Type, select Memory Write. Now every time the CPU writes to that address it will halt.

    Stack overflow.png

E2e.jpg {{
  1. switchcategory:MultiCore=
  • For technical support on MultiCore devices, please post your questions in the C6000 MultiCore Forum
  • For questions related to the BIOS MultiCore SDK (MCSDK), please use the BIOS Forum

Please post only comments related to the article Watchpoints for Stellaris in CCS here.

Keystone=
  • For technical support on MultiCore devices, please post your questions in the C6000 MultiCore Forum
  • For questions related to the BIOS MultiCore SDK (MCSDK), please use the BIOS Forum

Please post only comments related to the article Watchpoints for Stellaris in CCS here.

C2000=For technical support on the C2000 please post your questions on The C2000 Forum. Please post only comments about the article Watchpoints for Stellaris in CCS here. DaVinci=For technical support on DaVincoplease post your questions on The DaVinci Forum. Please post only comments about the article Watchpoints for Stellaris in CCS here. MSP430=For technical support on MSP430 please post your questions on The MSP430 Forum. Please post only comments about the article Watchpoints for Stellaris in CCS here. OMAP35x=For technical support on OMAP please post your questions on The OMAP Forum. Please post only comments about the article Watchpoints for Stellaris in CCS here. OMAPL1=For technical support on OMAP please post your questions on The OMAP Forum. Please post only comments about the article Watchpoints for Stellaris in CCS here. MAVRK=For technical support on MAVRK please post your questions on The MAVRK Toolbox Forum. Please post only comments about the article Watchpoints for Stellaris in CCS here. For technical support please post your questions at http://e2e.ti.com. Please post only comments about the article Watchpoints for Stellaris in CCS here.

}}

Hyperlink blue.png Links

Amplifiers & Linear
Audio
Broadband RF/IF & Digital Radio
Clocks & Timers
Data Converters

DLP & MEMS
High-Reliability
Interface
Logic
Power Management

Processors

Switches & Multiplexers
Temperature Sensors & Control ICs
Wireless Connectivity