This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TMS320F2812: CCS breakpoint interferes with stack overflow watchpoint

Other Parts Discussed in Thread: TMS320F2812

I have encountered a quirky issue with some code that we are working with using CCS and a TMS320F2812 board. Specifically, trying to make use of the stack overflow detection.

If we set a breakpoint anywhere in the code during initialization (prior to the call to stkov_init()), stack overflow detection initialization will fail and enter the infinite loop.

If we do not set any breakpoints, click run, then manually halt execution, the code will have initialized the stack overflow detection as expected and return successfully from the call to stkov_init().

Contacting technical support, it was suggested to check "Do Not Set End of Program Breakpoint At Load" as well as "Do Not Set CIO Breakpoint At Load" to see if that changed anything. Despite making these changes to the options, this did not have any affect. If a breakpoint is set, the init fails; if it is not, the init success as expected.

It was then suggested that I post a description of the issue here to see if there might be other suggestions on what could be causing this. Ideally, we would like to resolve the issue via a setting rather than add an additional step to all of our automated GEL scripts to override a failure return from the stkov_init() function.

Commenting out the infinite loop for testing purposes is also an option, but we would like to exhaust the other possibilities first.

Included is small snippet of the initialization code:

stkov_init.c:

#define WP_EVT_CNTL (volatile unsigned int *) 0x00000084E
#define WP_EVT_ID   (volatile unsigned int *) 0x00000084F

int stkov_init()
{
   //pre-processing work...

   asm("EALLOW");

   *WP_EVT_CNTL = 0x0001;

   asm("RPT #1 || NOP");

   if ((*WP_EVT_ID & 0xC000) != 0x4000)
   {
      asm("EDIS");

      return -1;
   }

   //post-processing work...

   return 0;

}

main.c:

void main(void)
{
   int stack_result;

   stack_result = stkov_init();

   while (stack_result == -1)
   {
      ;
   }
}

  • Hi Jamie,

    It is big difference wheather the breakepoint you mentioned is SW or HW type. If it is HW type it uses one of the watchpoints (probably WP0) which in turn can not be used by stack overflow detection code.

    One solution would be to modify stack overflow detection code to use WP1, but this might also fail if you set two HW breakpoints.

    The other on would be to copy-paste the WP initialization code in GEL file within OnFileLoaded or OnReset functions. This way when the code is loaded (or CPU is reset) first you initialize the WP, therefore when you try to set second breakpoint you'll get error message from CCS (at least you should - I haven't tried this).

    Best regards,

    Mitja