User Tools

Site Tools


esp:esp32:conditional-compile

Compiler defines

To set specific compile time defines (e.g. in case of compiling a project for different architectures esp32, esp32-c3, etc.) do the following:

in the c source files include conditional statements

#ifdef __GPIO_ESP_DEVKIT_WROOM
   .....
#endif
#ifdef __GPIO_ESP_C3_MINI
   .....
#endif

In project/main/CMakelists.txt add at the bottom:

add_compile_definitions( __GPIO_ESP_DEVKIT_WROOM=1)
or
add_compile_definitions( __GPIO_ESP_C3_MINI=1)
esp/esp32/conditional-compile.txt · Last modified: by 127.0.0.1