5. Debugging Tips

The CLA can halt, single-step and run independently from the main C28x CPU. Both the CLA and the C28x are debugged from the same JTAG port.

  • When a debug session is launched, the debug view (window within CCS) will have entries for C28x and CLA.
  • Clicking on CLA changes the context of all windows in CCS to reflect CLA data.
  • Connecting to the CLA core from the debug perspective enables single stepping
  • Load Program Symbols onto the CLA from Target menu options to begin debugging
_images/cla_debug1.png

Debugging CLA code

  1. Insert a breakpoint into CLA code

    • An __mdebugstop() intrinsic is a CLA breakpoint. It will place the instruction MDEBUGSTOP at that position in assembly.
    • If not connected to the CLA core (i.e. single step disabled), the intrinsic behaves as a MNOP (no operation)
  2. Start the task: CLA will execute code until the MDEBUGSTOP is in D2

  3. Single step or run to the next breakpoint: Single stepping moves the CLA pipeline one cycle at a time

_images/cla_debug2.png

Note

The debugger cannot perform ‘run to line’ or ‘step over’ when debugging CLA code.

5.1. Help! Why doesn’t my CLA code work?

Place a breakpoint in the CLA code. Make sure the CLA is connected and see if you hit the breakpoint. Step through the code to try and narrow down the problem.

If the breakpoint is never hit, then the task may not be starting. Check the CLA set-up (vectors, tasks are enabled, etc..)

5.2. My CLA task never starts.

Try starting the task with software to narrow down the issue. This will help confirm the task vector is setup correctly.

If the task fails to start for a peripherial trigger, check when the peripheral initalization is done. A CLA task only triggers on a level transition (an edge) of the configured interrupt source. If the peripheral triggers an interrupt before the CLA is initalized, then it can be missed. One way to get around this is to clear the interrupt flags from the peripherals.

5.3. Why can’t I force a task using software (IACK)?

Verify the following:

  1. This feature is enabled in the MCTL register. This register is EALLOW protected.
  2. The interrupt is enabled in the MIER register. This register is EALLOW protected.
  3. Software is configured as the task trigger. Refer to the device-specific TRM.
  4. You are using the correct argument to IACK. For example IACK #0x0003 would flag interrupt 1 (bit 0) and interrupt 2 (bit 1).
  5. Refer to the SW examples in C2000Ware.

5.4. Why does my Code Composer Studio (CCS) GEL file enable the CLA clock on reset?

When you reset the device, the CLA breakpoints are disabled and the CLA clock itself is disabled. To make debugging CLA code easier, CCS will watch for a reset condition and re-enable CLA breakpoints after a reset. For this to occur the CLA clock itself must be re-enabled. If you do not like this behavior, the line can be commented out or removed from the GEL file.

5.5. Can I start a task from the debug window?

You can use the CLA force register MIFRC to start tasks. This register is available in the CLA register window.

5.6. After a “run”, why did the CLA begin executing another task instead of stopping at MSTOP?

If there is a task both pending and enabled when you run to the MSTOP, the pending task will automatically begin execution. To keep this from happening you can modify the MIER register so that no tasks are enabled.

5.7. Why are the variables in the CLA code not updating as expected?

A reason is that the .scratchpad and .bss_cla sections are incorrectly allocated to read only CLA Program memory. The task will run, but variables allocated to the .bss_cla section will not be updated. Moreover, the .scratchpad section is used by the compiler and allocating to to read only memory can result in undefined behavior.