Skip to content

Commit

Permalink
cpu/esp32: deduplication in Kconfig
Browse files Browse the repository at this point in the history
The commit defines a new common CPU symbol `CPU_COMMON_ESP32X` in Kconfig that is used by all `CPU_FAM_ESP32x` symbols which selects features, modules and packages that are common for all ESP32x SoC variants. This avoids the selection of features, modules and packages again and again for each ESP32x SoC variant.
  • Loading branch information
gschorcht committed Mar 30, 2023
1 parent 198aadf commit 5a4759c
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 91 deletions.
1 change: 1 addition & 0 deletions cpu/esp32/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ config CPU_CORE
default "xtensa-lx7" if CPU_CORE_XTENSA_LX7
default "rv32imc" if CPU_CORE_RV32IMC

rsource "Kconfig.esp32x"
rsource "Kconfig.esp32"
rsource "Kconfig.esp32c3"
rsource "Kconfig.esp32s3"
Expand Down
23 changes: 1 addition & 22 deletions cpu/esp32/Kconfig.esp32
Original file line number Diff line number Diff line change
Expand Up @@ -7,35 +7,14 @@

config CPU_FAM_ESP32
bool
select CPU_COMMON_ESP
select CPU_COMMON_ESP32X
select CPU_CORE_XTENSA_LX6
select HAS_ARCH_ESP32
select HAS_CPU_ESP32
select HAS_BLE_NIMBLE
select HAS_BLE_NIMBLE_NETIF
select HAS_ESP_BLE
select HAS_ESP_BLE_ESP32
select HAS_ESP_HW_COUNTER
select HAS_ESP_RMT
select HAS_ESP_WIFI_ENTERPRISE
select HAS_PERIPH_FLASHPAGE
select HAS_PERIPH_FLASHPAGE_IN_ADDRESS_SPACE
select HAS_PERIPH_FLASHPAGE_PAGEWISE
select HAS_PERIPH_GPIO_LL
select HAS_PERIPH_GPIO_LL_IRQ
select HAS_PERIPH_GPIO_LL_IRQ_LEVEL_TRIGGERED_HIGH
select HAS_PERIPH_GPIO_LL_IRQ_LEVEL_TRIGGERED_LOW
select HAS_PERIPH_SPI_RECONFIGURE
select HAS_PUF_SRAM

select PACKAGE_ESP32_SDK if TEST_KCONFIG

select MODULE_PERIPH_RTT if HAS_PERIPH_RTT && MODULE_PM_LAYERED
select MODULE_PS if MODULE_SHELL
select MODULE_PTHREAD if MODULE_CPP
select MODULE_RTT_RTC if HAS_PERIPH_RTT && MODULE_PERIPH_RTC
imply MODULE_NEWLIB_NANO

config CPU_FAM
default "esp32" if CPU_FAM_ESP32

Expand Down
23 changes: 1 addition & 22 deletions cpu/esp32/Kconfig.esp32c3
Original file line number Diff line number Diff line change
Expand Up @@ -7,35 +7,14 @@

config CPU_FAM_ESP32C3
bool
select CPU_COMMON_ESP
select CPU_COMMON_ESP32X
select CPU_CORE_RV32IMC
select HAS_ARCH_ESP32
select HAS_CPU_ESP32
select HAS_BLE_ADV_EXT
select HAS_BLE_NIMBLE
select HAS_BLE_NIMBLE_NETIF
select HAS_BLE_PHY_2MBIT
select HAS_ESP_BLE
select HAS_ESP_BLE_ESP32C3
select HAS_ESP_RMT
select HAS_ESP_WIFI_ENTERPRISE
select HAS_PERIPH_FLASHPAGE
select HAS_PERIPH_FLASHPAGE_IN_ADDRESS_SPACE
select HAS_PERIPH_FLASHPAGE_PAGEWISE
select HAS_PERIPH_GPIO_LL
select HAS_PERIPH_GPIO_LL_IRQ
select HAS_PERIPH_GPIO_LL_IRQ_LEVEL_TRIGGERED_HIGH
select HAS_PERIPH_GPIO_LL_IRQ_LEVEL_TRIGGERED_LOW
select HAS_PERIPH_SPI_RECONFIGURE
select HAS_PUF_SRAM

select PACKAGE_ESP32_SDK if TEST_KCONFIG

select MODULE_PERIPH_RTT if HAS_PERIPH_RTT && MODULE_PM_LAYERED
select MODULE_PS if MODULE_SHELL
select MODULE_PTHREAD if MODULE_CPP
select MODULE_RTT_RTC if HAS_PERIPH_RTT && MODULE_PERIPH_RTC
imply MODULE_NEWLIB_NANO

config CPU_FAM
default "esp32c3" if CPU_FAM_ESP32C3
Expand Down
24 changes: 1 addition & 23 deletions cpu/esp32/Kconfig.esp32s2
Original file line number Diff line number Diff line change
Expand Up @@ -7,32 +7,10 @@

config CPU_FAM_ESP32S2
bool
select CPU_COMMON_ESP
select CPU_COMMON_ESP32X
select CPU_CORE_XTENSA_LX7
select HAS_ARCH_ESP32
select HAS_CPU_ESP32
select HAS_ESP_HW_COUNTER
select HAS_ESP_RMT
select HAS_ESP_WIFI_ENTERPRISE
select HAS_PERIPH_FLASHPAGE
select HAS_PERIPH_FLASHPAGE_IN_ADDRESS_SPACE
select HAS_PERIPH_FLASHPAGE_PAGEWISE
select HAS_PERIPH_GPIO_LL
select HAS_PERIPH_GPIO_LL_IRQ
select HAS_PERIPH_GPIO_LL_IRQ_LEVEL_TRIGGERED_HIGH
select HAS_PERIPH_GPIO_LL_IRQ_LEVEL_TRIGGERED_LOW
select HAS_PERIPH_SPI_RECONFIGURE
select HAS_PUF_SRAM

select PACKAGE_ESP32_SDK if TEST_KCONFIG

select MODULE_PERIPH_RTT if HAS_PERIPH_RTT && MODULE_PM_LAYERED
select MODULE_PS if MODULE_SHELL
select MODULE_PTHREAD if MODULE_CPP
select MODULE_RTT_RTC if HAS_PERIPH_RTT && MODULE_PERIPH_RTC
select MODULE_USBDEV_SYNOPSYS_DWC2 if MODULE_PERIPH_USBDEV
select MODULE_USB_BOARD_RESET if MODULE_USBUS_CDC_ACM || MODULE_TINYUSB_CLASS_CDC
imply MODULE_NEWLIB_NANO

config CPU_FAM
default "esp32s2" if CPU_FAM_ESP32S2
Expand Down
25 changes: 1 addition & 24 deletions cpu/esp32/Kconfig.esp32s3
Original file line number Diff line number Diff line change
Expand Up @@ -7,39 +7,16 @@

config CPU_FAM_ESP32S3
bool
select CPU_COMMON_ESP
select CPU_COMMON_ESP32X
select CPU_CORE_XTENSA_LX7
select HAS_ARCH_ESP32
select HAS_CPU_ESP32
select HAS_BLE_ADV_EXT
select HAS_BLE_NIMBLE
select HAS_BLE_NIMBLE_NETIF
select HAS_BLE_PHY_2MBIT
select HAS_ESP_BLE
select HAS_ESP_BLE_ESP32C3
select HAS_ESP_RMT
select HAS_ESP_HW_COUNTER
select HAS_ESP_WIFI_ENTERPRISE
select HAS_PERIPH_FLASHPAGE
select HAS_PERIPH_FLASHPAGE_IN_ADDRESS_SPACE
select HAS_PERIPH_FLASHPAGE_PAGEWISE
select HAS_PERIPH_GPIO_LL
select HAS_PERIPH_GPIO_LL_IRQ
select HAS_PERIPH_GPIO_LL_IRQ_LEVEL_TRIGGERED_HIGH
select HAS_PERIPH_GPIO_LL_IRQ_LEVEL_TRIGGERED_LOW
select HAS_PERIPH_SPI_RECONFIGURE
select HAS_PUF_SRAM
select HAS_TINYUSB_DEVICE

select PACKAGE_ESP32_SDK if TEST_KCONFIG

select MODULE_PERIPH_RTT if HAS_PERIPH_RTT && MODULE_PM_LAYERED
select MODULE_PS if MODULE_SHELL
select MODULE_PTHREAD if MODULE_CPP
select MODULE_RTT_RTC if HAS_PERIPH_RTT && MODULE_PERIPH_RTC
select MODULE_USBDEV_SYNOPSYS_DWC2 if MODULE_PERIPH_USBDEV
select MODULE_USB_BOARD_RESET if MODULE_USBUS_CDC_ACM || MODULE_TINYUSB_CLASS_CDC
imply MODULE_NEWLIB_NANO

config CPU_FAM
default "esp32s3" if CPU_FAM_ESP32S3
Expand Down
38 changes: 38 additions & 0 deletions cpu/esp32/Kconfig.esp32x
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Copyright (c) 2023 Gunar Schorcht
#
# 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.

# define a CPU configurationthat common is common for all ESP32x SoC variants

config CPU_COMMON_ESP32X
bool
select CPU_COMMON_ESP
select HAS_ARCH_ESP32
select HAS_CPU_ESP32
select HAS_ESP_HW_COUNTER if CPU_ARCH_XTENSA
select HAS_ESP_RMT
select HAS_ESP_WIFI_ENTERPRISE
select HAS_PERIPH_FLASHPAGE
select HAS_PERIPH_FLASHPAGE_IN_ADDRESS_SPACE
select HAS_PERIPH_FLASHPAGE_PAGEWISE
select HAS_PERIPH_GPIO_LL
select HAS_PERIPH_GPIO_LL_IRQ
select HAS_PERIPH_GPIO_LL_IRQ_LEVEL_TRIGGERED_HIGH
select HAS_PERIPH_GPIO_LL_IRQ_LEVEL_TRIGGERED_LOW
select HAS_PERIPH_SPI_RECONFIGURE
select HAS_PUF_SRAM

select PACKAGE_ESP32_SDK if TEST_KCONFIG

select MODULE_PERIPH_RTT if HAS_PERIPH_RTT && MODULE_PM_LAYERED
select MODULE_PS if MODULE_SHELL
select MODULE_PTHREAD if MODULE_CPP
select MODULE_RTT_RTC if HAS_PERIPH_RTT && MODULE_PERIPH_RTC

imply MODULE_NEWLIB_NANO

help
Selects all features, modules and packages that are common for
all ESP32x SoC variants.

0 comments on commit 5a4759c

Please sign in to comment.