3

I was searching for this in the mplab compiler users guide but haven't found anything. I am asking it here to confirm that I am not blind or anything:

The GCC compiler provides some very interesting and useful built-in functions like __builtin_constant_p(x) or similar stuff. I have never found anything like that in the microchip compilers and I don't think there is.

So the question: Do Microchip XCxx Compilers provide any non-standard built-in functions apart from the device specific ones (like declaring variables at a given register address or declaring an interrupt function)?

EDIT: To clarify some more: I am mostly interested in retrieving information from the compiler. A good example would be something like builtin_constant, as it makes information available to the program which is normally not usable. But I do not limit this question to find constant expressions only.

jwsc
  • 867
  • 8
  • 15

3 Answers3

0

XC16 manual in google and out rolls: http://ww1.microchip.com/downloads/en/DeviceDoc/50002071E.pdf appendix G.

Marco van de Voort
  • 25,628
  • 5
  • 56
  • 89
0

The same document mentioned by @Marco van de Voort has a list of pre-defined macros in section 19.4 that give you information about the compiler environment and the device.

There is also the somewhat undocumented __DEBUG macro which is defined when running under MPLABX in debug mode (MPLABX defines this in the call to the compiler).

EBlake
  • 735
  • 7
  • 14
-1

These are the builtins supported by the XC16 compiler

enter image description here

e.g. __builtin_add

enter image description here

For a complete description of the builtins see the MPLAB XC16 compiler user's manual (under "docs" folder of compiler installation) or here: http://www.microchip.com/mymicrochip/filehandler.aspx?ddocname=en559023

Cyclops
  • 108
  • 5