-
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/esp8266: fix problems with ESP WiFi and migration to ztimer #17427
Merged
benpicco
merged 2 commits into
RIOT-OS:master
from
gschorcht:cpu/esp8266/fix_ztimer_esp_wifi_problem
Dec 21, 2021
Merged
cpu/esp8266: fix problems with ESP WiFi and migration to ztimer #17427
benpicco
merged 2 commits into
RIOT-OS:master
from
gschorcht:cpu/esp8266/fix_ztimer_esp_wifi_problem
Dec 21, 2021
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
`ztimer_core` functions have to reside in IRAM for timing reasons and to be available also when the IROM cache is disabled. Although the module is called `ztimer`, its object files are generated in directory `ztimer_core`.
If the WiFi interface is enabled by module `esp_wifi_any`, binary SDK libraries use the RTT. Therefore, `ztimer` must not use `periph_rtt`as backend, if the WiFi interface is enabled by module `esp_wifi_any`.
gschorcht
requested review from
cgundogan,
jia200x and
leandrolanzieri
as code owners
December 19, 2021 15:38
github-actions
bot
added
Area: cpu
Area: CPU/MCU ports
Area: Kconfig
Area: Kconfig integration
Platform: ESP
Platform: This PR/issue effects ESP-based platforms
labels
Dec 19, 2021
gschorcht
added
Type: bug
The issue reports a bug / The PR fixes a bug (including spelling errors)
CI: ready for build
If set, CI server will compile all applications for all available boards for the labeled PR
labels
Dec 19, 2021
gschorcht
requested review from
aabadie,
fjmolinas,
kaspar030,
MichelRottleuthner,
miri64 and
smlng
as code owners
December 19, 2021 16:11
github-actions
bot
added
Area: CI
Area: Continuous Integration of RIOT components
Area: doc
Area: Documentation
Area: tests
Area: tests and testing framework
labels
Dec 19, 2021
gschorcht
force-pushed
the
cpu/esp8266/fix_ztimer_esp_wifi_problem
branch
from
December 19, 2021 16:17
446053c
to
d6b5945
Compare
gschorcht
changed the title
cpu/esp8266: fix the
cpu/esp8266: fix the ESP WiFi problems arose with migration to ztimer
Dec 19, 2021
esp_wifi_any
problem arose with migration to ztimer
gschorcht
force-pushed
the
cpu/esp8266/fix_ztimer_esp_wifi_problem
branch
2 times, most recently
from
December 19, 2021 17:30
dff483f
to
fe72971
Compare
gschorcht
changed the title
cpu/esp8266: fix the ESP WiFi problems arose with migration to ztimer
cpu/esp8266: fix the ESP WiFi problems with migration to ztimer
Dec 19, 2021
gschorcht
changed the title
cpu/esp8266: fix the ESP WiFi problems with migration to ztimer
cpu/esp8266: fix the ESP WiFi problems and migration to ztimer
Dec 19, 2021
kaspar030
approved these changes
Dec 19, 2021
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.
ACK. Trusting your testing.
gschorcht
force-pushed
the
cpu/esp8266/fix_ztimer_esp_wifi_problem
branch
from
December 20, 2021 07:54
fe72971
to
48f59a1
Compare
github-actions
bot
removed
the
Area: CI
Area: Continuous Integration of RIOT components
label
Dec 20, 2021
github-actions
bot
removed
Area: doc
Area: Documentation
Area: tests
Area: tests and testing framework
labels
Dec 20, 2021
gschorcht
changed the title
cpu/esp8266: fix the ESP WiFi problems and migration to ztimer
cpu/esp8266: fix problems with ESP WiFi and migration to ztimer
Dec 20, 2021
Thanks for reviewing and merging. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Area: cpu
Area: CPU/MCU ports
Area: Kconfig
Area: Kconfig integration
CI: ready for build
If set, CI server will compile all applications for all available boards for the labeled PR
Platform: ESP
Platform: This PR/issue effects ESP-based platforms
Type: bug
The issue reports a bug / The PR fixes a bug (including spelling errors)
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Contribution description
This PR fixes the problem with all types of ESP WiFi
netdev
's (esp_now
|esp_wifi
|esp_wifi_ap
=esp_wifi_any
) that arose with the migration toztimer
.With PR #17386, ESP implementations were migrated to
ztimer
. Ifperiph_rtt
is provided as feature,ztimer
uses by defaultperiph_rtt
whenever possible.Unfortunately, the
periph_rtt
implementation for ESP8266 is quite tricky and uses a combination of the completely undocumented ESP8266 RTC module and the FRC2 counter to support deep sleep. However, this FRC2 counter also seems to be used by the binary SDK libraries for the WiFi interface once it is enabled by any ESP WiFinetdev
(esp_wifi_any
). I already pointed out this problem when I provided theperiph_rtt
implementation (#13640 (comment) and #13640 (comment)). Due to the fact that the SDK libraries for the WiFi interface are closed-source and completely undocumented, nobody knows what actually happens in these libraries.As a result of this conflict,
ztimer
must not useperiph_rtt
whenesp_wifi_any
is used. Therefore,ztimer_no_periph_rtt
is enabled ifesp_wifi_any
is used. Sincextimer
always usedperiph_timer
instead, we never ran into a problem withxtimer
andesp_wifi_any
.This PR also includes a fix for the linker script.
ztimer_core
functions have to reside in IRAM for timing reasons and to be available also when the IROM cache is disabled. Although the module is calledztimer
, its object files are generated in directoryztimer_core
.Kconfig
already takes the migration of ESP WiFinetdev
into account.Testing procedure
With commit fe72971 two test applications have been provided for compilation tests. They are copies of
tests/shell
but enable additionallyztimer
andztimer
+esp_wifi
, repsectively.app.config.test
files also enable these modules. It will be removed before merge.Compilation should succeed in CI.
Use for example commands:
and compare enabled modules:
ztimer_periph_rtt
andperiph_rtt
are used fortests/shell_ztimer
w/oesp_wifi
ztimer_no periph_rtt
andperiph_timer
are used fortests/shell_ztimer_esp_wifi
withesp_wifi
Issues/PRs references
Fixes #17386