-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cpu/esp*: add Kconfig #13135
cpu/esp*: add Kconfig #13135
Conversation
82ddc73
to
d51872e
Compare
Just force-pushed typo and whitespace fixes for static tests. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some initial comments. Regarding the macro renaming: I think it's better if we start to keep the CONFIG_
namespace for macros generated via Kconfig, that way at a glance you can tell where this is coming from.
Also, take a look at this regarding the translation of choice
s:
Lines 30 to 43 in 27764fe
choice | |
bool "USB specification version" | |
config USB_SPEC_BCDVERSION_2_0 | |
bool "USB v2.0" | |
help | |
The peripheral acts as an USB version 2.0 device. | |
config USB_SPEC_BCDVERSION_1_1 | |
bool "USB v1.1" | |
help | |
The peripheral acts as an USB version 1.1 device. | |
endchoice |
Lines 94 to 102 in 27764fe
#ifndef CONFIG_USB_SPEC_BCDVERSION | |
#if defined(CONFIG_USB_SPEC_BCDVERSION_1_1) | |
#define CONFIG_USB_SPEC_BCDVERSION 0x0110 | |
#elif defined(CONFIG_USB_SPEC_BCDVERSION_2_0) | |
#define CONFIG_USB_SPEC_BCDVERSION 0x0200 | |
#else | |
#define CONFIG_USB_SPEC_BCDVERSION 0x0200 | |
#endif | |
#endif |
Lastly, I know that these are CPU-specific configurations for the ESP, but having the WiFi and ESP-NOW options under CPU
seems a bit off from the user perspective when using menuconfig.
@@ -21,6 +21,64 @@ | |||
|
|||
#if defined(MODULE_ESP_NOW) || defined(DOXYGEN) | |||
|
|||
/** | |||
* @name Legacy definitions of default configuration parameters | |||
* @{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe add the @deprecated
note and a deprecation release (2020.10?)
bool "Configure ESP-NOW netdev" | ||
depends on MODULE_ESP_NOW | ||
help | ||
Configure ESP-NOW netdev when module esp_now is used. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This only shows up when esp_now
module is used, so there is no need to clarify that on the help string.
@@ -30,42 +88,42 @@ | |||
* @brief The size of the stack used for the ESP-NOW netdev driver thread. | |||
* @ingroup cpu_esp_common_conf | |||
*/ | |||
#ifndef ESP_NOW_STACKSIZE | |||
#define ESP_NOW_STACKSIZE (THREAD_STACKSIZE_DEFAULT) | |||
#ifndef CONFIG_ESP_NOW_STACKSIZE |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This macro is not generated by Kconfig, I think it's better that we try to keep the CONFIG_
namespace for those
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I decided to rename it for two reasons:
-
I wished the stack size would be configurable, but I couldn't find an usable approach til now. The option has to be an
int
which doesn't allow a default likeTHREAD_STACKSIZE_DEFAULT
. Maybe, I will add a combination of abool
option for using the default and anint
option for specifying a different value. -
I wanted to avoid naming inconsistencies from the users point of view in documentations where you have tables like
Configuration Parameter Description CONFIG_ESP_WIFI_SSID SSID of the AP to be used. CONFIG_ESP_WIFI_PASS Passphrase used for the AP as clear text CONFIG_ESP_WIFI_STACKSIZE Stack size used for the WiFi netdev driver I wanted to avoid tables like the following:
Configuration Parameter Description CONFIG_ESP_WIFI_SSID SSID of the AP to be used. CONFIG_ESP_WIFI_PASS Passphrase used for the AP as clear text ESP_WIFI_STACKSIZE Stack size used for the WiFi netdev driver
Therefore, I decided to name everything that is configurable by user also at command line in same way.
#ifndef ESP_NOW_KEY | ||
#define ESP_NOW_KEY (NULL) | ||
#ifndef CONFIG_ESP_NOW_KEY | ||
#define CONFIG_ESP_NOW_KEY ESP_NOW_KEY |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The configuration of the key with Kconfig is a problem. The option would have to be either 0 or a 64 character array. I have no idea how to realize it with Kconfig. I renamed it to CONFIG_
just for naming consistency.
@@ -0,0 +1,29 @@ | |||
# Copyright (c) 2020 Gunar Schorcht |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a reason to have the exact same Kconfig for esp8266 and esp32 in different places, instead of having one in esp_common
like the ESP-NOW?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, when RIOT was ported to both platforms, the ESP8266 SDK required an implementation of esp_wifi
that was completely different from that for ESP32.
With the new ESP8266 SDK and the complete reimplementation of the RIOT port on ESP8266 in PR #11108, a new esp_wifi
module was introduced for ESP8266 that is almost the same as for ESP32. That's why there is already PR #12955 which will do a complete code deduplication. Module esp_wifi
will then be moved to esp_common
completely.
But before PR #12955 is merged, we have to do it in both implementations 😟 I wished PR #12955 would be merged soon, doing everything twice is quite nerving.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But, we can just place this file in cpu/esp_common/Kconfig.wifi
and source it from both right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But, we can just place this file in
cpu/esp_common/Kconfig.wifi
and source it from both right?
Yes, this should be possible.
#ifndef ESP_WIFI_STACKSIZE | ||
#define ESP_WIFI_STACKSIZE (THREAD_STACKSIZE_DEFAULT) | ||
#ifndef CONFIG_ESP_WIFI_STACKSIZE | ||
#define CONFIG_ESP_WIFI_STACKSIZE ESP_WIFI_STACKSIZE |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Namespace
#ifndef ESP_WIFI_PRIO | ||
#define ESP_WIFI_PRIO (GNRC_NETIF_PRIO) | ||
#ifndef CONFIG_ESP_WIFI_PRIO | ||
#define CONFIG_ESP_WIFI_PRIO ESP_WIFI_PRIO |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Namespace
#ifndef ESP_WIFI_STACKSIZE | ||
#define ESP_WIFI_STACKSIZE (THREAD_STACKSIZE_DEFAULT) | ||
#ifndef CONFIG_ESP_WIFI_STACKSIZE | ||
#define CONFIG_ESP_WIFI_STACKSIZE ESP_WIFI_STACKSIZE |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Namespace
#ifndef ESP_WIFI_PRIO | ||
#define ESP_WIFI_PRIO (GNRC_NETIF_PRIO) | ||
#ifndef CONFIG_ESP_WIFI_PRIO | ||
#define CONFIG_ESP_WIFI_PRIO ESP_WIFI_PRIO |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Namespace
What whould be a better place from your point of view? |
I would expect to see this maybe in One thing that can be done is to have generic 'WiFi' symbols (e.g. |
Hm 🤔 ok. Maybe there should be a further menu
As long a there is no other WiFi netdev driver I would leave the symbols as they are. OK? |
The problem with having the ESP specific symbols is that then you need to source a file that is placed in |
Yeah, that was the reason why I placed them in CPU section. Having |
I couldn't find |
Sorry, I was just referring to the fact that they have generic |
|
||
if KCONFIG_CPU_ESP32 | ||
|
||
choice ESP32_DEFAULT_CPU_FREQ_MHZ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is no need to associate a symbol to the choice here, as it is not extended somewhere else.
|
||
if KCONFIG_CPU_ESP8266 | ||
|
||
choice ESP8266_CPU_FREQUENCY |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here
We could place ESP-NOW there as well |
That's good, and would be more in the direction of one of my proposals above, in order to have the WiFi parameters in a more generic place. Ok, I'll be tagging this for next release then. Thanks for the quick response! |
@leandrolanzieri @gschorcht still valid? |
Because of PR #13754, it is time to change the ESP specific WiFi configuration to a more general one. This must be done first. Then we can expose the configurations via Kconfig. I would say, that it nothing we can realize with this release. |
#13754 is in now, maybe @leandrolanzieri can help rework this one now |
@gschorcht any plans on moving forward with this one? |
Unfortunately not, I could not work on my RIOT contributions in the last months, because of other tasks related to the Corona online summer semester and the upcoming winter semester, which will be online again 😟 There are a number of open RIOT contributions just waiting to be completed. But I just don't have time to finish them and contribute at the moment. |
@leandrolanzieri @gschorcht |
Sure, I'm currently working on the modelling of the esp modules (minus networking), adding the configurations as well would be nice. |
@leandrolanzieri Is your modelling esp modules something different or will you provide a new PR which makes this one obsolete? |
It is something different, I will be providing a different PR (similar to #16929), but it does not make this one obsolete, as this adds configurations, not modules. |
So my first task would be to rebase this PR. |
@gschorcht see #17232 |
@leandrolanzieri Now were PR #17232 is merged, I would like to resume my work on the
|
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If you want me to ignore this issue, please mark it with the "State: don't stale" label. Thank you for your contributions. |
Contribution description
This PR adds
Kconfig
for ESP32 and ESP8266 CPUs as well as the ESP netdev driversesp_wifi
and
esp_now
.Testing procedure
Use
examples/gnrc_networking
with commandsto configure both CPUs and try to compile them afterwards.
Issues/PRs references
Part of issue #12888