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?
Preprocessor symbol for ESP32 code?
Re: Preprocessor symbol for ESP32 code?
http://esp-idf.readthedocs.io/en/latest ... efinitions
We use ESP_PLATFORM when we need to detect that compilation happens in IDF environment.
We use ESP_PLATFORM when we need to detect that compilation happens in IDF environment.
-
- Posts: 13
- Joined: Tue May 02, 2017 9:33 am
Re: Preprocessor symbol for ESP32 code?
Many thanks, this works. I was not aware of this good documentation source on ESP32! I like that. There is no (obvious) link to it from the espressif.com site!
Who is online
Users browsing this forum: No registered users and 87 guests