cpu/esp8266: fix problems with ESP WiFi and migration to ztimer#17427
Merged
benpicco merged 2 commits intoRIOT-OS:masterfrom Dec 21, 2021
Merged
Conversation
`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`.
446053c to
d6b5945
Compare
esp_wifi_any problem arose with migration to ztimerdff483f to
fe72971
Compare
kaspar030
approved these changes
Dec 19, 2021
Contributor
kaspar030
left a comment
There was a problem hiding this comment.
ACK. Trusting your testing.
fe72971 to
48f59a1
Compare
Contributor
Author
|
Thanks for reviewing and merging. |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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_rttis provided as feature,ztimeruses by defaultperiph_rttwhenever possible.Unfortunately, the
periph_rttimplementation 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_rttimplementation (#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,
ztimermust not useperiph_rttwhenesp_wifi_anyis used. Therefore,ztimer_no_periph_rttis enabled ifesp_wifi_anyis used. Sincextimeralways usedperiph_timerinstead, we never ran into a problem withxtimerandesp_wifi_any.This PR also includes a fix for the linker script.
ztimer_corefunctions 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.Kconfigalready takes the migration of ESP WiFinetdevinto account.Testing procedure
With commit fe72971 two test applications have been provided for compilation tests. They are copies of
tests/shellbut enable additionallyztimerandztimer+esp_wifi, repsectively.app.config.testfiles 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_rttandperiph_rttare used fortests/shell_ztimerw/oesp_wifiztimer_no periph_rttandperiph_timerare used fortests/shell_ztimer_esp_wifiwithesp_wifiIssues/PRs references
Fixes #17386