Page 1 of 1

Clearer message for functions not supported on platform

Posted: Wed May 15, 2019 11:18 am
by steved
chSysPolledDelayX() and other functions are not supported on the 32L0 family. The error message is 'undefined function'; took me a little while to realise it was really 'unsupported function'.
It's possible to generate clearer error messages for this scenario; the following change to chsys.h works:

Code: Select all

#if PORT_SUPPORTS_RT == TRUE
  bool chSysIsCounterWithinX(rtcnt_t cnt, rtcnt_t start, rtcnt_t end);
  void chSysPolledDelayX(rtcnt_t cycles);
#else
  #define   chSysIsCounterWithinX(a, b, c)   _Pragma("GCC error \"chSysIsCounterWithinX() not available on platform\"")
  #define   chSysPolledDelayX(a) _Pragma("GCC error \"chSysPolledDelayX() not available on platform\"")
#endif

(Documentation on _Pragma: https://gcc.gnu.org/onlinedocs/gcc-8.3. ... agmas.html)

Re: Clearer message for functions not supported on platform

Posted: Wed May 15, 2019 6:28 pm
by Giovanni
Hi,

It is a good idea, is that pragma standard?

Giovanni

Re: Clearer message for functions not supported on platform

Posted: Thu May 16, 2019 10:09 am
by steved
Giovanni wrote:Hi,

It is a good idea, is that pragma standard?

Giovanni

Part of C99 standard, according to gcc link
Not checked the detail against the standard.