Page 1 of 1

Build macro to identify chip

Posted: Mon Feb 14, 2022 1:20 pm
by Kaisha
Is there a macro to identify which chip an application if being built for. Something like 'ESP32' or 'ESP32s3'??

Re: Build macro to identify chip

Posted: Tue Feb 15, 2022 1:35 am
by ESP_Sprite
If you include sdkconfig.h, you can either use the CONFIG_IDF_TARGET_* defines to check for a chip (e.g. #if CONFIG_IDF_TARGET_ESP32) or use CONFIG_IDF_TARGET to get a string representation.

Re: Build macro to identify chip

Posted: Tue Feb 15, 2022 12:51 pm
by Kaisha
Is there a list of CONFIG_IDF_TARGET_ESP32 defines for other chips (like s3, 8266, etc...)?

Re: Build macro to identify chip

Posted: Wed Feb 16, 2022 3:25 am
by ESP_Sprite
esp-idf/Kconfig has them listed out. (Note that Kconfig files leave off the CONFIG_ bit, so e.g. the ESP32S2 target is called IDF_TARGET_ESP32S2)