Preprocessor symbol for ESP32 code?
Posted: Tue May 02, 2017 9:49 am
Problem: I have code which runs on many platforms, e.g. Linux and some uControllers. I need a preprocessor symbol can I use to detect that I am compiling for ESP32 under the esp-idf. (This must not come from a ESP32 header file because I need the symbol to detect whether the ESP32 headers are available at all.)
I looked at the output of "xtensa-esp32-elf-gcc -dM -E - < /dev/null" and I figured out I can use:
#ifdef __XTENSA__
...
#endif
This works for me.
The remaining question is: Is there a standard convention when compiling for ESP32?
I looked at the output of "xtensa-esp32-elf-gcc -dM -E - < /dev/null" and I figured out I can use:
#ifdef __XTENSA__
...
#endif
This works for me.
The remaining question is: Is there a standard convention when compiling for ESP32?