-
-
Notifications
You must be signed in to change notification settings - Fork 8.6k
esp32c2 support (IDF v5.3) #15906
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
esp32c2 support (IDF v5.3) #15906
Conversation
|
Isn't this already covered by #11869? |
That is about esp32c6 This PR has subject esp32c2. So c6 versus c2? |
|
@sanderjo I saw the ESP32C2 definition in |
|
@TrekMax Edit: forgot to mention that |
|
@agatti the latest changes on C6 (about to push) should enable the emitter on all risk chips based on the soc defines, rather than listing individual chips. I suggest this PR would be well placed to rebase on top of the C6 work once it's merged as lots of people have contributed to that PR to help it fill gaps / support that will then naturally apply to many of the newer chips. |
|
@andrewleech oh, that's nice to hear. Hopefully that would make support for the C5 easier to add once that chip shows up in production :) |
|
Thanks @TrekMax for updating your PR! (Note for housekeeping: this is replacing earlier PR #15440). Similar to discussions above, suggest we tackle in this order:
@TrekMax Let us know if we can help with any part of this process. It should be possible to update this PR with totally new commits without needing to close and open a new PR. There is a guide to doing this online at https://github.com/jimmo/git-and-micropython#README |
|
@projectgus Thanks. I will wait for esp32c6 support (IDF v5.2) #11869 to be merged, then rebase this branch, and then review and commit ESP32-C2 support. |
c7d3a2b to
67dec7c
Compare
|
@projectgus Hey , the commit has been rebased to the latest master, please review it. Thanks! |
|
@andrewleech Of course. I have ESP32C3, ESP32C2 and ESP32S3 to verify it. |
67dec7c to
2f8d960
Compare
|
@TrekMax please can you rebase this PR on the latest master, because there have been a lot of changes to the esp32 port, in particular support for IDF v5.3. |
0c8abf5 to
642eb25
Compare
projectgus
left a comment
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.
Thanks for your patience and for the quick update of this PR, @TrekMax ! I have some comments below, mostly minor.
3492a56 to
af01368
Compare
|
@TrekMax Thanks for updating the PR in response to the review! It's looking pretty tidy. There are a couple of unresolved questions above, do you know the answer to them? |
|
@TrekMax Any updates on this PR? |
|
Current status of this PR: it needs rebasing on latest master, and resolving the few questions above left by @projectgus . |
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
abb5131 to
777183b
Compare
Turns out this was possible! By tweaking various config settings it was possible to free up 40KB of static RAM (went from 60KB free static RAM to 100KB) and also reduce the runtime memory usage from Wi-Fi and TCP/IP. These tweaks are added in their own With the free RAM increases implemented, tests pass:
[*] I had to tweak the run-multitests.py script for ESP32C2 as (like ESP8266) the ESP8684 prints its early boot log at 74880bps which is interpreted as line noise by the script and can trigger encoding errors. Will submit another PR for this. [^] Except DTLS tests, it seems DTLS support has been disabled on ESP-IDF v5.4.2 (on all targets). Will investigate and submit a fix separately. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #15906 +/- ##
=======================================
Coverage 98.38% 98.38%
=======================================
Files 171 171
Lines 22257 22257
=======================================
Hits 21898 21898
Misses 359 359 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
Thanks @projectgus for getting this working, and tweaking the RAM for WiFi/BLE. That's really good, and this PR is relatively simple. Just a few minor comments above, but otherwise I think this is good to go in. |
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.
Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.
|
@dpgeorge Thanks for the detailed review, have updated! |
|
With these RAM tweaks there's almost as much free RAM on the C2 as the original ESP32 (without SPIRAM) - 142KiB vs 125KiB: Original: C2: |
dpgeorge
left a comment
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.
A few more minor comments.
Includes: esp32/esp32c2: Adapt to target chip ESP32C2. esp32/esp32c2: Fix heap size is too small to enable Bluetooth. Signed-off-by: TianShuangKe <[email protected]> Signed-off-by: Angus Gratton <[email protected]>
This is necessary for ESP32-C2 Wi-Fi & BT to work reliably (and for TLS to work at all). On IDF 5.4.2 the free static RAM goes from 60KB to 100KB, and there will also be a reduction in lwIP & Wi-Fi memory use at runtime. The performance trade-off seems low for most use cases, although it will probably be significant for certain combinations of load (i.e. heavy TCP/IP, heavy BT throughput, and some peripheral driver functions). Added as a set of config flags because this is potentially useful on other SoCs where the goal is to maximise RAM available for MicroPython. This work was funded through GitHub Sponsors. Signed-off-by: Angus Gratton <[email protected]>
ESP32-C2 ROM prints at 74880bps (same as ESP8266), so need a newline before first MicroPython output to avoid it being appended on end of a line of noise. This work was funded through GitHub Sponsors. Signed-off-by: Angus Gratton <[email protected]>
|
@dpgeorge Updated! |
dpgeorge
left a comment
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.
Looks good now, thanks!
Summary
The is esp32c2 officially supported in IDF v5.2 but requires a number of changes to work...
Pulling together changes and generic board support needed here.
Testing
Functions verified by actual hardware include: