mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2025-12-16 10:03:50 +01:00
Merge pull request #17424 from gschorcht/cpu/esp/kconfig_cpu_frequency
cpu/esp: integrate CPU clock frequency selection in Kconfig
This commit is contained in:
commit
1a3f2d908a
@ -1,4 +1,5 @@
|
|||||||
# Copyright (c) 2020 HAW Hamburg
|
# Copyright (c) 2020 HAW Hamburg
|
||||||
|
# 2021 Gunar Schorcht
|
||||||
#
|
#
|
||||||
# This file is subject to the terms and conditions of the GNU Lesser
|
# 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
|
# General Public License v2.1. See the file LICENSE in the top level
|
||||||
@ -77,11 +78,6 @@ config HAS_PERIPH_ADC_CTRL
|
|||||||
help
|
help
|
||||||
Indicates that an ESP32 ADC controller peripheral is present.
|
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
|
## Common CPU symbols
|
||||||
config CPU_CORE
|
config CPU_CORE
|
||||||
default "xtensa-lx6" if CPU_CORE_XTENSA_LX6
|
default "xtensa-lx6" if CPU_CORE_XTENSA_LX6
|
||||||
@ -99,19 +95,34 @@ config CPU_MODEL
|
|||||||
config CPU
|
config CPU
|
||||||
default "esp32" if CPU_FAM_ESP32
|
default "esp32" if CPU_FAM_ESP32
|
||||||
|
|
||||||
menu "ESP32 configurations"
|
menu "ESP32 specific configurations"
|
||||||
depends on TEST_KCONFIG
|
depends on TEST_KCONFIG
|
||||||
depends on HAS_ARCH_ESP32
|
depends on HAS_ARCH_ESP32
|
||||||
|
|
||||||
config MODULE_ESP_SPI_RAM
|
choice
|
||||||
|
bool "CPU clock frequency"
|
||||||
|
default ESP32_DEFAULT_CPU_FREQ_MHZ_80
|
||||||
|
|
||||||
|
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"
|
bool "SPI RAM support"
|
||||||
select MODULE_ESP_IDF_HEAP
|
|
||||||
depends on HAS_ESP_SPI_RAM
|
depends on HAS_ESP_SPI_RAM
|
||||||
select MODULE_ESP_IDF_HEAP
|
select MODULE_ESP_IDF_HEAP
|
||||||
help
|
help
|
||||||
Say y to use external SPI RAM connected through the FSPI interface.
|
Say y to use external SPI RAM connected through the FSPI interface.
|
||||||
|
|
||||||
config MODULE_ESP_JTAG
|
config MODULE_ESP_JTAG
|
||||||
bool "Enable JTAG debugging interface"
|
bool "Enable JTAG debugging interface"
|
||||||
depends on HAS_ESP_JTAG
|
depends on HAS_ESP_JTAG
|
||||||
|
|
||||||
|
|||||||
@ -29,15 +29,34 @@ extern "C" {
|
|||||||
#endif
|
#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]
|
* @brief Defines the CPU frequency [values = 2, 40, 80, 160 and 240]
|
||||||
*/
|
*/
|
||||||
#ifndef CONFIG_ESP32_DEFAULT_CPU_FREQ_MHZ
|
#ifndef CONFIG_ESP32_DEFAULT_CPU_FREQ_MHZ
|
||||||
#define CONFIG_ESP32_DEFAULT_CPU_FREQ_MHZ 80
|
#define CONFIG_ESP32_DEFAULT_CPU_FREQ_MHZ 80
|
||||||
#endif
|
#endif
|
||||||
|
/**
|
||||||
|
* @brief Mapping configured ESP32 default clock to CLOCK_CORECLOCK define
|
||||||
|
*/
|
||||||
#define CLOCK_CORECLOCK (1000000UL * CONFIG_ESP32_DEFAULT_CPU_FREQ_MHZ)
|
#define CLOCK_CORECLOCK (1000000UL * CONFIG_ESP32_DEFAULT_CPU_FREQ_MHZ)
|
||||||
/** @} */
|
/** @} */
|
||||||
|
|
||||||
@ -60,16 +79,6 @@ extern "C" {
|
|||||||
#define CONFIG_LOG_DEFAULT_LEVEL LOG_LEVEL
|
#define CONFIG_LOG_DEFAULT_LEVEL LOG_LEVEL
|
||||||
#endif
|
#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
|
* ESP32 specific configuration
|
||||||
*
|
*
|
||||||
|
|||||||
@ -61,6 +61,22 @@ config CPU_MODEL
|
|||||||
config CPU
|
config CPU
|
||||||
default "esp8266" if CPU_FAM_ESP8266
|
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"
|
source "$(RIOTCPU)/esp_common/Kconfig"
|
||||||
|
|
||||||
config MODULE_ESP_I2C_SW
|
config MODULE_ESP_I2C_SW
|
||||||
|
|||||||
@ -33,6 +33,16 @@ extern "C" {
|
|||||||
* @name Clock configuration
|
* @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
|
* @brief Defines the CPU frequency in MHz
|
||||||
*
|
*
|
||||||
@ -41,6 +51,10 @@ extern "C" {
|
|||||||
#ifndef ESP8266_CPU_FREQUENCY
|
#ifndef ESP8266_CPU_FREQUENCY
|
||||||
#define ESP8266_CPU_FREQUENCY (80)
|
#define ESP8266_CPU_FREQUENCY (80)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Mapping configured ESP8266 default clock to CLOCK_CORECLOCK define
|
||||||
|
*/
|
||||||
#define CLOCK_CORECLOCK (1000000UL * ESP8266_CPU_FREQUENCY)
|
#define CLOCK_CORECLOCK (1000000UL * ESP8266_CPU_FREQUENCY)
|
||||||
/** @} */
|
/** @} */
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user