From f01e0804ffefb72a4e56e44ddb10e1e5f19c1799 Mon Sep 17 00:00:00 2001 From: Gunar Schorcht Date: Thu, 16 Dec 2021 14:26:57 +0100 Subject: [PATCH 1/3] cpu/esp32: remove the duplicate ESP_HAS_SPI_RAM --- cpu/esp32/Kconfig | 5 ----- 1 file changed, 5 deletions(-) diff --git a/cpu/esp32/Kconfig b/cpu/esp32/Kconfig index abad7755da..1f51de72a0 100644 --- a/cpu/esp32/Kconfig +++ b/cpu/esp32/Kconfig @@ -81,11 +81,6 @@ config HAS_PERIPH_ADC_CTRL help Indicates that an ESP32 ADC controller peripheral is present. -config HAS_ESP_SPI_RAM - bool - help - Indicates that the a RAM is present on the SPI bus. - ## Common CPU symbols config CPU_CORE default "xtensa-lx6" if CPU_CORE_XTENSA_LX6 From f6831f34fb9aeafadc53f40069ff5323b193ea33 Mon Sep 17 00:00:00 2001 From: Gunar Schorcht Date: Sun, 19 Dec 2021 12:19:15 +0100 Subject: [PATCH 2/3] cpu/esp32: add CPU frequency selection to Kconfig t --- cpu/esp32/Kconfig | 38 +++++++++++++++++++++++++----------- cpu/esp32/include/sdk_conf.h | 35 +++++++++++++++++++++------------ 2 files changed, 49 insertions(+), 24 deletions(-) diff --git a/cpu/esp32/Kconfig b/cpu/esp32/Kconfig index 1f51de72a0..7ecd23c0a1 100644 --- a/cpu/esp32/Kconfig +++ b/cpu/esp32/Kconfig @@ -1,4 +1,5 @@ # Copyright (c) 2020 HAW Hamburg +# 2021 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 @@ -98,21 +99,36 @@ config CPU_MODEL config CPU default "esp32" if CPU_FAM_ESP32 -menu "ESP32 configurations" +menu "ESP32 specific 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. + choice + bool "CPU clock frequency" + default ESP32_DEFAULT_CPU_FREQ_MHZ_80 -config MODULE_ESP_JTAG - bool "Enable JTAG debugging interface" - depends on HAS_ESP_JTAG + config ESP32_DEFAULT_CPU_FREQ_MHZ_2 + bool "2 MHz" + config ESP32_DEFAULT_CPU_FREQ_MHZ_40 + bool "40 MHz" + config ESP32_DEFAULT_CPU_FREQ_MHZ_80 + bool "80 MHz" + config ESP32_DEFAULT_CPU_FREQ_MHZ_160 + bool "160 MHz" + config ESP32_DEFAULT_CPU_FREQ_MHZ_240 + bool "240 MHz" + endchoice + + config MODULE_ESP_SPI_RAM + bool "SPI RAM support" + 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 diff --git a/cpu/esp32/include/sdk_conf.h b/cpu/esp32/include/sdk_conf.h index 6581737ce0..9686b51461 100644 --- a/cpu/esp32/include/sdk_conf.h +++ b/cpu/esp32/include/sdk_conf.h @@ -29,15 +29,34 @@ extern "C" { #endif /** -* @name Clock configuration -* @{ -*/ + * @name Clock configuration + * @{ + */ + +#ifndef DOXYGEN +/* Mapping of Kconfig defines to the respective enumeration values */ +#if CONFIG_ESP32_DEFAULT_CPU_FREQ_MHZ_2 +#define CONFIG_ESP32_DEFAULT_CPU_FREQ_MHZ 2 +#elif CONFIG_ESP32_DEFAULT_CPU_FREQ_MHZ_40 +#define CONFIG_ESP32_DEFAULT_CPU_FREQ_MHZ 40 +#elif CONFIG_ESP32_DEFAULT_CPU_FREQ_MHZ_80 +#define CONFIG_ESP32_DEFAULT_CPU_FREQ_MHZ 80 +#elif CONFIG_ESP32_DEFAULT_CPU_FREQ_MHZ_160 +#define CONFIG_ESP32_DEFAULT_CPU_FREQ_MHZ 160 +#elif CONFIG_ESP32_DEFAULT_CPU_FREQ_MHZ_240 +#define CONFIG_ESP32_DEFAULT_CPU_FREQ_MHZ 240 +#endif +#endif + /** * @brief Defines the CPU frequency [values = 2, 40, 80, 160 and 240] */ #ifndef CONFIG_ESP32_DEFAULT_CPU_FREQ_MHZ #define CONFIG_ESP32_DEFAULT_CPU_FREQ_MHZ 80 #endif +/** + * @brief Mapping configured ESP32 default clock to CLOCK_CORECLOCK define + */ #define CLOCK_CORECLOCK (1000000UL * CONFIG_ESP32_DEFAULT_CPU_FREQ_MHZ) /** @} */ @@ -60,16 +79,6 @@ extern "C" { #define CONFIG_LOG_DEFAULT_LEVEL LOG_LEVEL #endif -/** - * ESP32 specific configuration - * - * CONFIG_ESP32_DEFAULT_CPU_FREQ_MHZ can be overridden by an application - * specific SDK configuration file. - */ -#ifndef CONFIG_ESP32_DEFAULT_CPU_FREQ_MHZ -#define CONFIG_ESP32_DEFAULT_CPU_FREQ_MHZ 80 -#endif - /** * ESP32 specific configuration * From 4d19b77fce2e449c97abc4e1d62b66860d5c4cec Mon Sep 17 00:00:00 2001 From: Gunar Schorcht Date: Sun, 19 Dec 2021 12:20:34 +0100 Subject: [PATCH 3/3] cpu/esp8266: add CPU frequency selection to Kconfig --- cpu/esp8266/Kconfig | 16 ++++++++++++++++ cpu/esp8266/include/cpu_conf.h | 14 ++++++++++++++ 2 files changed, 30 insertions(+) diff --git a/cpu/esp8266/Kconfig b/cpu/esp8266/Kconfig index cca627a7d6..c4390765d7 100644 --- a/cpu/esp8266/Kconfig +++ b/cpu/esp8266/Kconfig @@ -64,6 +64,22 @@ config CPU_MODEL config CPU default "esp8266" if CPU_FAM_ESP8266 +menu "ESP8266 specific configurations" + depends on TEST_KCONFIG + depends on HAS_ARCH_ESP8266 + + choice + bool "CPU clock frequency" + default ESP8266_CPU_FREQUENCY_80 + + config ESP8266_CPU_FREQUENCY_80 + bool "80 MHz" + config ESP8266_CPU_FREQUENCY_160 + bool "160 MHz" + endchoice + +endmenu + source "$(RIOTCPU)/esp_common/Kconfig" config MODULE_ESP_I2C_SW diff --git a/cpu/esp8266/include/cpu_conf.h b/cpu/esp8266/include/cpu_conf.h index 380f710684..09642c9b49 100644 --- a/cpu/esp8266/include/cpu_conf.h +++ b/cpu/esp8266/include/cpu_conf.h @@ -33,6 +33,16 @@ extern "C" { * @name Clock configuration * @{ */ + +#ifndef DOXYGEN +/* Mapping of Kconfig defines to the respective enumeration values */ +#if CONFIG_ESP8266_CPU_FREQUENCY_80 +#define ESP8266_CPU_FREQUENCY 80 +#elif CONFIG_ESP8266_CPU_FREQUENCY_160 +#define ESP8266_CPU_FREQUENCY 160 +#endif +#endif + /** * @brief Defines the CPU frequency in MHz * @@ -41,6 +51,10 @@ extern "C" { #ifndef ESP8266_CPU_FREQUENCY #define ESP8266_CPU_FREQUENCY (80) #endif + +/** + * @brief Mapping configured ESP8266 default clock to CLOCK_CORECLOCK define + */ #define CLOCK_CORECLOCK (1000000UL * ESP8266_CPU_FREQUENCY) /** @} */