Clearer message for functions not supported on platform

Use this forum for requesting small changes in ChibiOS. Large changes should be discussed in the development forum. This forum is NOT for support.
steved
Posts: 825
Joined: Fri Nov 09, 2012 2:22 pm
Has thanked: 12 times
Been thanked: 135 times

Clearer message for functions not supported on platform

Postby steved » Wed May 15, 2019 11:18 am

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)

User avatar
Giovanni
Site Admin
Posts: 14455
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 1076 times
Been thanked: 922 times
Contact:

Re: Clearer message for functions not supported on platform

Postby Giovanni » Wed May 15, 2019 6:28 pm

Hi,

It is a good idea, is that pragma standard?

Giovanni

steved
Posts: 825
Joined: Fri Nov 09, 2012 2:22 pm
Has thanked: 12 times
Been thanked: 135 times

Re: Clearer message for functions not supported on platform

Postby steved » Thu May 16, 2019 10:09 am

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.


Return to “Small Change Requests”

Who is online

Users browsing this forum: No registered users and 19 guests