Skip to content

Commit

Permalink
Merge pull request #17232 from leandrolanzieri/pr/cpu/esp/model_kconfig
Browse files Browse the repository at this point in the history
cpu/esp{32,8266}: model kconfig
  • Loading branch information
gschorcht authored Dec 11, 2021
2 parents d362360 + a8201c0 commit 85313cc
Show file tree
Hide file tree
Showing 73 changed files with 717 additions and 67 deletions.
2 changes: 2 additions & 0 deletions .murdock
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ cc1352-launchpad
cc2650-launchpad
derfmega128
dwm1001
esp32-heltec-lora32-v2
esp8266-esp-12x
hifive1
mbed_lpc1768
mega-xplained
Expand Down
11 changes: 11 additions & 0 deletions boards/common/esp32/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,14 @@ config BOARD_COMMON_ESP32
select HAS_PERIPH_GPIO_IRQ
select HAS_PERIPH_UART
select HAS_PERIPH_UART_MODECFG

select HAVE_SAUL_GPIO

config MODULE_BOARDS_COMMON_ESP32
bool
depends on TEST_KCONFIG
depends on BOARD_COMMON_ESP32
depends on HAS_ARCH_ESP32
default y
help
Common ESP32 boards code.
11 changes: 11 additions & 0 deletions boards/common/esp8266/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,14 @@ config BOARD_COMMON_ESP8266
select HAS_PERIPH_SPI
select HAS_PERIPH_UART
select HAS_PERIPH_UART_MODECFG

select HAVE_SAUL_GPIO

config MODULE_BOARDS_COMMON_ESP8266
bool
depends on TEST_KCONFIG
depends on HAS_ARCH_ESP8266
depends on BOARD_COMMON_ESP8266
default y
help
Common ESP8266 boards code.
1 change: 0 additions & 1 deletion boards/esp32-ethernet-kit-v1_0/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ config BOARD_ESP32_ETHERNET_KIT_V1_0
default y
select BOARD_COMMON_ESP32
select CPU_MODEL_ESP32_WROVER_B
select HAS_ESP_SPI_RAM
select HAS_ESP_JTAG
select HAS_PERIPH_ADC
select HAS_PERIPH_ETH
Expand Down
1 change: 0 additions & 1 deletion boards/esp32-ethernet-kit-v1_0/Makefile.features
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,3 @@ endif

# unique features provided by the board
FEATURES_PROVIDED += esp_jtag
FEATURES_PROVIDED += esp_spi_ram
1 change: 0 additions & 1 deletion boards/esp32-ethernet-kit-v1_1/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ config BOARD_ESP32_ETHERNET_KIT_V1_1
default y
select BOARD_COMMON_ESP32
select CPU_MODEL_ESP32_WROVER_B
select HAS_ESP_SPI_RAM
select HAS_ESP_JTAG
select HAS_PERIPH_ADC
select HAS_PERIPH_ETH
Expand Down
1 change: 0 additions & 1 deletion boards/esp32-ethernet-kit-v1_2/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ config BOARD_ESP32_ETHERNET_KIT_V1_2
default y
select BOARD_COMMON_ESP32
select CPU_MODEL_ESP32_WROVER_E
select HAS_ESP_SPI_RAM
select HAS_ESP_JTAG
select HAS_PERIPH_ADC
select HAS_PERIPH_ETH
Expand Down
2 changes: 2 additions & 0 deletions boards/esp32-heltec-lora32-v2/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,6 @@ config BOARD_ESP32_HELTEC_LORA32_V2
select HAS_PERIPH_PWM
select HAS_PERIPH_SPI

select HAVE_SX1276

source "$(RIOTBOARD)/common/esp32/Kconfig"
15 changes: 15 additions & 0 deletions boards/esp32-ttgo-t-beam/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,18 @@ config BOARD_ESP32_TTGO_T_BEAM
select HAS_PERIPH_UART

source "$(RIOTBOARD)/common/esp32/Kconfig"

menu "ESP32 TTGO T-Beam options"
depends on TEST_KCONFIG
depends on BOARD_ESP32_TTGO_T_BEAM

config MODULE_ESP32_TTGO_T_BEAM_V1_0
bool "Use V1.0 board variant"
select MODULE_PERIPH_I2C
help
There are at least three board types: rev0, rev1, and V1.0. Versions
rev0 and rev1 are very similar, the only difference is that rev1 has
an additional LED connected to GPIO14. The pinout of V1.0 has more
changes.

endmenu
1 change: 0 additions & 1 deletion boards/esp32-wemos-lolin-d32-pro/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ config BOARD_ESP32_WEMOS_LOLIN_D32_PRO
select BOARD_COMMON_ESP32
select CPU_MODEL_ESP32_WROVER
select HAS_ARDUINO
select HAS_ESP_SPI_RAM
select HAS_PERIPH_ADC
select HAS_PERIPH_DAC
select HAS_PERIPH_I2C
Expand Down
1 change: 1 addition & 0 deletions boards/esp32-wemos-lolin-d32-pro/Makefile.default
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
DEFAULT_MODULE += esp_spi_ram
2 changes: 0 additions & 2 deletions boards/esp32-wemos-lolin-d32-pro/Makefile.dep
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
USEMODULE += esp_spi_ram

include $(RIOTBOARD)/common/esp32/Makefile.dep
9 changes: 6 additions & 3 deletions boards/esp32-wemos-lolin-d32-pro/Makefile.features
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@ FEATURES_PROVIDED += periph_i2c
FEATURES_PROVIDED += periph_pwm
FEATURES_PROVIDED += periph_spi

# unique features provided by the board
FEATURES_PROVIDED += esp_spi_ram

FEATURES_PROVIDED += arduino

# This configuration enables modules that are only available when using Kconfig
# module modelling
ifeq (1, $(TEST_KCONFIG))
KCONFIG_ADD_CONFIG += $(BOARDDIR)/esp32-wemos-lolin-d32-pro.config
endif
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
CONFIG_MODULE_ESP_SPI_RAM=y
5 changes: 3 additions & 2 deletions boards/esp32-wrover-kit/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,13 @@ config BOARD_ESP32_WROVER_KIT
select CPU_MODEL_ESP32_WROVER
select HAS_ARDUINO
select HAS_ESP_RTC_TIMER_32K
select HAS_ESP_SPI_RAM
select HAS_ESP_JTAG
select HAS_PERIPH_ADC
select HAS_PERIPH_I2C
select HAS_PERIPH_PWM
select HAS_PERIPH_SPI
select HAS_SDCARD_SPI
select MODULE_ESP_JTAG

select HAVE_ILI9341

source "$(RIOTBOARD)/common/esp32/Kconfig"
8 changes: 7 additions & 1 deletion boards/esp32-wrover-kit/Makefile.features
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,13 @@ FEATURES_PROVIDED += periph_spi

# unique features provided by the board
FEATURES_PROVIDED += sdcard_spi
FEATURES_PROVIDED += esp_spi_ram
FEATURES_PROVIDED += esp_rtc_timer_32k
FEATURES_PROVIDED += esp_jtag

FEATURES_PROVIDED += arduino

# This configuration enables modules that are only available when using Kconfig
# module modelling
ifeq (1, $(TEST_KCONFIG))
KCONFIG_ADD_CONFIG += $(BOARDDIR)/esp32-wrover-kit.config
endif
2 changes: 2 additions & 0 deletions boards/esp32-wrover-kit/esp32-wrover-kit.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Sets up configuration for openocd
CONFIG_MODULE_ESP_JTAG=y
40 changes: 35 additions & 5 deletions cpu/esp32/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,14 @@ config CPU_FAM_ESP32
select HAS_PERIPH_RTT_SET_COUNTER
select HAS_PERIPH_RTT_OVERFLOW

select MODULE_PERIPH_RTT if HAS_PERIPH_RTT && MODULE_PM_LAYERED
select MODULE_RTT_RTC if HAS_PERIPH_RTT && MODULE_PERIPH_RTC
select MODULE_PS if MODULE_SHELL
select MODULE_ESP_IDF_DRIVER if TEST_KCONFIG
select MODULE_ESP_IDF_ESP32 if TEST_KCONFIG
select MODULE_ESP_IDF_SOC if TEST_KCONFIG
imply MODULE_NEWLIB_NANO

## CPU Models
config CPU_MODEL_ESP32_WROOM_32
bool
Expand All @@ -29,14 +37,17 @@ config CPU_MODEL_ESP32_WROOM_32
config CPU_MODEL_ESP32_WROVER
bool
select CPU_FAM_ESP32
select HAS_ESP_SPI_RAM

config CPU_MODEL_ESP32_WROVER_B
bool
select CPU_FAM_ESP32
select HAS_ESP_SPI_RAM

config CPU_MODEL_ESP32_WROVER_E
bool
select CPU_FAM_ESP32
select HAS_ESP_SPI_RAM

config CPU_MODEL_ESP32_D0WD
bool
Expand Down Expand Up @@ -65,16 +76,15 @@ config HAS_ESP_SPI_RAM
Indicates that an external RAM is connected via the FSPI interface in
the board.

config HAS_ESP_WIFI_ENTERPRISE
config HAS_PERIPH_ADC_CTRL
bool
help
Indicates that the platform supports WPA2 enterprise mode for the WiFi
interface.
Indicates that an ESP32 ADC controller peripheral is present.

config HAS_PERIPH_ADC_CTRL
config HAS_ESP_SPI_RAM
bool
help
Indicates that an ESP32 ADC controller peripheral is present.
Indicates that the a RAM is present on the SPI bus.

## Common CPU symbols
config CPU_CORE
Expand All @@ -93,4 +103,24 @@ config CPU_MODEL
config CPU
default "esp32" if CPU_FAM_ESP32

menu "ESP32 configurations"
depends on TEST_KCONFIG
depends on HAS_ARCH_ESP32

config MODULE_ESP_SPI_RAM
bool "SPI RAM support"
select MODULE_ESP_IDF_HEAP
depends on HAS_ESP_SPI_RAM
select MODULE_ESP_IDF_HEAP
help
Say y to use external SPI RAM connected through the FSPI interface.

config MODULE_ESP_JTAG
bool "Enable JTAG debugging interface"
depends on HAS_ESP_JTAG

endmenu

rsource "periph/Kconfig"
rsource "vendor/esp-idf/Kconfig"
source "$(RIOTCPU)/esp_common/Kconfig"
17 changes: 8 additions & 9 deletions cpu/esp32/Makefile.dep
Original file line number Diff line number Diff line change
Expand Up @@ -66,22 +66,17 @@ ifneq (,$(filter periph_i2c,$(USEMODULE)))
endif
endif

ifneq (,$(filter esp_spi_ram,$(DISABLE_MODULE)))
USEMODULE := $(filter-out esp_spi_ram,$(USEMODULE))
endif

ifneq (,$(filter esp_now esp_wifi esp_spi_ram,$(USEMODULE)))
# the ESP-IDF heap has to be used if SPI RAM is used
USEMODULE += esp_idf_heap
endif

ifneq (,$(filter mtd,$(USEMODULE)))
USEMODULE += esp_idf_spi_flash
ifneq (,$(filter esp_spi_ram,$(USEMODULE)))
FEATURES_REQUIRED += esp_spi_ram
endif

ifneq (,$(filter ndn-riot,$(USEPKG)))
USEMODULE += crypto
USEMODULE += cipher_modes
ifneq (,$(filter mtd,$(USEMODULE)))
USEMODULE += esp_idf_spi_flash
endif

ifneq (,$(filter periph_rtc,$(USEMODULE)))
Expand All @@ -100,3 +95,7 @@ endif
ifneq (,$(filter shell,$(USEMODULE)))
USEMODULE += ps
endif

ifneq (,$(filter esp_jtag,$(USEMODULE)))
FEATURES_REQUIRED += esp_jtag
endif
10 changes: 10 additions & 0 deletions cpu/esp32/Makefile.features
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,13 @@ FEATURES_PROVIDED += periph_rtc
FEATURES_PROVIDED += periph_rtt
FEATURES_PROVIDED += periph_rtt_set_counter
FEATURES_PROVIDED += periph_rtt_overflow

ifneq (,$(filter esp32-wrover%,$(CPU_MODEL)))
FEATURES_PROVIDED += esp_spi_ram
endif

# This configuration enables modules that are only available when using Kconfig
# module modelling
ifeq (1, $(TEST_KCONFIG))
KCONFIG_ADD_CONFIG += $(RIOTCPU)/esp32/esp32.config
endif
6 changes: 1 addition & 5 deletions cpu/esp32/Makefile.include
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,6 @@ ifneq (,$(filter esp_eth,$(USEMODULE)))
INCLUDES += -I$(ESP32_SDK_DIR)/components/ethernet/include
endif

ifneq (,$(filter esp_jtag,$(USEMODULE)))
FEATURES_REQUIRED += esp_jtag
endif

CFLAGS += -DSDK_NOT_USED -DCONFIG_FREERTOS_UNICORE=1 -DESP_PLATFORM
CFLAGS += -DLOG_TAG_IN_BRACKETS

Expand All @@ -74,7 +70,7 @@ ifneq (,$(filter esp_now,$(USEMODULE)))
ARCHIVES += -lespnow -lmesh
endif

ifneq (,$(filter cpp,$(FEATURES_USED)))
ifneq (,$(filter cpp,$(USEMODULE)))
ARCHIVES += -lstdc++
endif

Expand Down
1 change: 1 addition & 0 deletions cpu/esp32/esp32.config
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
CONFIG_MODULE_PM_LAYERED=y
30 changes: 30 additions & 0 deletions cpu/esp32/periph/Kconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Copyright (c) 2021 HAW Hamburg
#
# This file is subject to the terms and conditions of the GNU Lesser
# General Public License v2.1. See the file LICENSE in the top level
# directory for more details.
#

if TEST_KCONFIG

config MODULE_ESP_RTC_TIMER_32K
bool
depends on HAS_ESP_RTC_TIMER_32K
default y if MODULE_PERIPH_RTC
help
Use RTC timer with external 32.768 kHz crystal as RTT.

config MODULE_PERIPH_ADC_CTRL
bool
depends on HAS_PERIPH_ADC_CTRL
default y if MODULE_PERIPH_ADC || MODULE_PERIPH_DAC

config MODULE_PERIPH_RTT_HW_SYS
bool
default y if MODULE_PERIPH_RTT

config MODULE_PERIPH_RTT_HW_RTC
bool
default y if MODULE_PERIPH_RTT

endif # TEST_KCONFIG
34 changes: 34 additions & 0 deletions cpu/esp32/periph/Kconfig.i2c
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Copyright (c) 2021 HAW Hamburg
#
# This file is subject to the terms and conditions of the GNU Lesser
# General Public License v2.1. See the file LICENSE in the top level
# directory for more details.
#

if TEST_KCONFIG

choice
bool "I2C implementation"
depends on MODULE_PERIPH_I2C
help
Due to the poor and faulty hardware I2C implementation the software one
is used by default for the moment.

config MODULE_ESP_I2C_SW
bool "Software"
select MODULE_PERIPH_I2C_SW

config MODULE_ESP_I2C_HW
bool "Hardware"
select MODULE_CORE_THREAD_FLAGS
select MODULE_XTIMER
select MODULE_PERIPH_I2C_HW

endchoice

config MODULE_PERIPH_I2C_HW
bool
help
Hardware implementation of I2C.

endif # TEST_KCONFIG
Loading

0 comments on commit 85313cc

Please sign in to comment.