1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-12-25 22:43:50 +01:00
RIOT/cpu/esp_common/Makefile.dep
Marian Buschsieweke 276ad5716a
sys/net/gnrc/netif: allow checking if a netdev is legacy or new API
A if `netdev_driver_t::confirm_send()` is provided, it provides the
new netdev API. However, detecting the API at runtime and handling
both API styles comes at a cost. This can be optimized in case only
new or only old style netdevs are in use.

To do so, this adds the pseudo modules `netdev_legacy_api` and
`netdev_new_api`. As right now no netdev actually implements the new
API, all netdevs pull in `netdev_legacy_api`. If `netdev_legacy_api` is
in used but `netdev_new_api` is not, we can safely assume at compile
time that only legacy netdevs are in use. Similar, if only
`netdev_new_api` is used, only support for the new API is needed. Only
when both are in use, run time checks are needed.

This provides two helper function to check for a netif if the
corresponding netdev implements the old or the new API. (With one
being the inverse of the other.) They are suitable for constant folding
when only new or only legacy devices are in use. Consequently, dead
branches should be eliminated by the optimizer.
2022-08-17 12:56:07 +02:00

110 lines
2.4 KiB
Makefile

# additional modules dependencies
# Modules used by ESP*
USEMODULE += esp_common
USEMODULE += esp_common_periph
USEMODULE += esp_freertos
USEMODULE += esp_idf
USEMODULE += log
USEMODULE += periph
USEMODULE += periph_hwrng
USEMODULE += periph_uart
USEMODULE += random
ifneq (,$(filter mtd,$(USEMODULE)))
USEMODULE += periph_flash
endif
ifeq (,$(filter stdio_% slipdev_stdio,$(USEMODULE)))
USEMODULE += stdio_uart
endif
ifeq (xtensa,$(CPU_ARCH))
USEMODULE += esp_xtensa
USEMODULE += xtensa
endif
ifeq (rv32,$(CPU_ARCH))
USEMODULE += esp_riscv
endif
# Features used by ESP*
FEATURES_REQUIRED += newlib
ifneq (,$(filter esp_idf_nvs_flash,$(USEMODULE)))
FEATURES_REQUIRED += cpp
endif
ifneq (,$(filter esp_wifi_ap,$(USEMODULE)))
FEATURES_REQUIRED += esp_wifi_ap
USEMODULE += esp_wifi
endif
ifneq (,$(filter esp_wifi_enterprise,$(USEMODULE)))
FEATURES_REQUIRED += esp_wifi_enterprise
USEMODULE += esp_wifi
endif
ifneq (,$(filter netdev_default,$(USEMODULE)))
ifneq (,$(filter lwip,$(USEMODULE)))
# for lwip, use esp_wifi as default netdev if no other netdev is enabled
ifeq (,$(filter esp_eth,$(USEMODULE)))
USEMODULE += esp_wifi
endif
else
# otherwise use esp_now as default netdev if no other netdev is enabled
ifeq (,$(filter esp_wifi esp_eth,$(USEMODULE)))
USEMODULE += esp_now
endif
endif
endif
ifneq (,$(filter esp_gdbstub,$(USEMODULE)))
USEMODULE += esp_gdb
endif
ifneq (,$(filter log_color,$(USEMODULE)))
USEMODULE += esp_log_colored
endif
ifneq (,$(filter 4 5,$(LOG_LEVEL)))
USEMODULE += esp_log_startup
endif
# default to using littlefs2 on the SPI flash
ifneq (,$(filter vfs_default,$(USEMODULE)))
USEMODULE += littlefs2
endif
# each device has SPI flash memory, but it has to be enabled explicitly
ifneq (,$(filter esp_spiffs,$(USEMODULE)))
USEMODULE += spiffs
endif
ifneq (,$(filter esp_freertos,$(USEMODULE)))
USEMODULE += esp_freertos_common
endif
ifneq (,$(filter esp_now,$(USEMODULE)))
USEMODULE += esp_wifi_any
endif
ifneq (,$(filter esp_wifi,$(USEMODULE)))
USEMODULE += esp_wifi_any
USEMODULE += netdev_eth
endif
ifneq (,$(filter esp_wifi_any,$(USEMODULE)))
USEMODULE += netdev_legacy_api
USEMODULE += netopt
USEMODULE += ztimer_msec
endif
ifneq (,$(filter esp_freertos_common,$(USEMODULE)))
ifneq (,$(filter ztimer_msec,$(USEMODULE)))
USEMODULE += core_thread_flags
endif
endif