1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-01-18 12:52:44 +01:00
RIOT/cpu/esp32/esp-idf/esp_idf_cflags.mk
Gunar Schorcht 97ad22eed6 cpu/esp32/esp-idf: minimum gpio definition for ESP-IDF headers
A number of ESP-IDF header files that are needed to compile RIOT include the header file `driver/gpio.h` only because of the definition of the type `gpio_num_t`. However, this header file contains the entire GPIO API definition of the ESP-IDF, which conflicts with that of RIOT.
The solution was to use a wrapper library that does not need to include the `driver/gpio.h` file of the ESP-IDF during compilation of RIOT code.
This commit provides another approach which does not require such a wrapper library. It just provides its own `driver/gpio.h` in RIOT that is included by ESP-IDF header files instead of the original `driver/gpio.h` in ESP-IDF. It  defines only the required `gpio_num_t` if RIOT code is compiled but includes the original `driver/gpio.h` of ESP-IDF if ESP-IDF code is compiled. This avoids to create a wrapper library for each module.
2023-03-27 03:10:56 +02:00

46 lines
1.5 KiB
Makefile

# common definitions for all ESP-IDF modules
# indicate that ESP-IDF code is compiled
CFLAGS += -DESP_IDF_CODE
# shortcuts used by ESP-IDF
CFLAGS += -Dasm=__asm
CFLAGS += -Dtypeof=__typeof__
# required for esp_wifi (components/spi_flash/esp32/spi_flash_rom_patch.c)
# required for esp_idf_heap (components/heap/heap_caps_init.c)
# required for esp_idf_wpa_supplicant
CFLAGS += -Wno-sign-compare
# required by esp_idf_heap (components/heap/heap_caps.c)
# required for esp_idf_wpa_supplicant
CFLAGS += -Wno-implicit-function-declaration
# required for esp_wifi (components/esp_event/esp_event.c)
CFLAGS += -Wno-old-style-declaration
# required for esp_wifi (components/efuse/esp32/esp_efuse_utility.c)
# required for esp_idf_heap (components/heap/multi_heap.c)
# required for esp_idf_wpa_supplicant
CFLAGS += -Wno-old-style-definition
# required for esp_idf_common (components/bootloader_support/src/bootloader_flash.c)
CFLAGS += -Wno-unused-variable
# required for esp_idf_spi_flash (components/spi_flash/partition.c)
CFLAGS += -Wno-enum-compare
# vendor code contains casts that increase alignment requirements. Let's hope
# those are false positives.
CFLAGS += -Wno-cast-align
# additional CFLAGS required for RISC-V architecture
ifneq (,$(filter riscv32%,$(TARGET_ARCH)))
INCLUDES += -I$(ESP32_SDK_DIR)/components/riscv/include
CFLAGS += -DCONFIG_IDF_TARGET_ARCH_RISCV
CFLAGS += -march=rv32imc
CFLAGS += -Wno-error=format=
CFLAGS += -nostartfiles
CFLAGS += -Wno-format
endif