Page 1 of 1

ChibiOS Eclipse debug view

Posted: Fri Oct 11, 2019 3:30 pm
by Eddie
Hi, I tried Chibios after a long time. Has anything changed in debuging? If I stop the program in the main routine, the chibios plugin reads the Chibios status and everithing is OK. But if I stop the program in ISR, the plugin writes Chibios not found on target. Thank you.

ChibiStudio Preview 21
ChibiOS 1.9.3

Re: ChibiOS Eclipse debug view

Posted: Fri Oct 11, 2019 6:18 pm
by Giovanni
Hi,

This should not be the case, it is possible you had a stack overflow corrupting the threads list or something else.

Try placing a breakpoint in an ISR and check.

Giovanni

Re: ChibiOS Eclipse debug view

Posted: Fri Oct 11, 2019 9:08 pm
by Eddie
Hi,
I did a long debug until I found a curious mistake. In DAC callback I used the variable ch. If breakpoint is set in main, everything is fine, if breakpoint is set to DAC callback, plugin reports Chibios not found.
I don't exactly understand the problem when variable ch is defined as local.

Code: Select all

/*
 * DAC streaming callback.
 */
size_t nx = 0, ny = 0, nz = 0;
static void end_cb1(DACDriver *dacp) {
  uint32_t ch;

  ch = 0;

  nz++;
  if (dacIsBufferComplete(dacp)) {
    nx += DAC_BUFFER_SIZE / 2;
  }
  else {
    ny += DAC_BUFFER_SIZE / 2;
  }

  if ((nz % 1000) == 0) {
    palTogglePad(GPIOD, GPIOD_LED3);
  }
}

Re: ChibiOS Eclipse debug view

Posted: Fri Oct 11, 2019 9:20 pm
by Giovanni
I will give it a try, moving the topic in "bug reports".

Giovanni

Re: ChibiOS Eclipse debug view

Posted: Fri Oct 11, 2019 9:46 pm
by Eddie
OK, thank you. Here is complete project for F4 discovery.

ChibiStudio Preview 21
ChibiOS 1.9.3
GCC 7.0

I got only warning
main.c:63:12: warning: variable 'ch' set but not used [-Wunused-but-set-variable]

Re: ChibiOS Eclipse debug view

Posted: Sat Oct 12, 2019 9:08 am
by steved
Isn't 'ch' the name of the variable that OpenOCD looks for to identify a Chibios system?
If so, presumably the local ch is overriding the global one; so changing the variable name in the callback should at least work round the problem.

Re: ChibiOS Eclipse debug view

Posted: Sat Oct 12, 2019 12:50 pm
by Giovanni
Good idea steved, try changing the variable name.

Giovanni

Re: ChibiOS Eclipse debug view

Posted: Sat Oct 12, 2019 1:23 pm
by Eddie
Yes, presumably the local ch is overriding the global one. Changing variable name resolved the problem. Thank you.