-
-
Notifications
You must be signed in to change notification settings - Fork 8.2k
esp32: switch esp-idf to v4.2, add CI, support MICROPY_BOARD #6731
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
Conversation
I took another stab at handling the board definitions. That's the "update boards and add toothless configuration" commit. cmake is a torture! I'm sure there's a better way, but at least what I've got seems to work. To build for GENERIC_OTA, say, do a Each board has a I extended the CI to build all the boards, I think that's useful and another sanity check. The boards build sequentially, that could be improved. I have not tackled setting the port or speed for flashing, I assume setting the right env vars when running |
I've been tinkering some more (which I threw away...) and came to the following conclusions:
Right now I don't have energy to play with all this and what's in this PR works for me for now... |
I've been trying to get a project of mine running on the cmake version and so far have not been successful. I worked around #6733 by setting sys.path explicitly, but after initializing everything and connecting with MQTTS the esp running my app crashes. I tried two different builds (with BT and without) and get similar but not identical crashes. The last one looks like this:
In both cases the crash happens in the IDF heap components as it's called from the VM and in both cases the EXCVADDR is some small number (0x2 in the other case). I then remembered that there are unit tests (DUH!). The basic tests pass, but extmod/usocket_tcp_basic.py hangs. and vfs_fat_finaliser vfs_lfs_mtime inf_nan_arith fail. I have not yet investigated. While fixing #6734 I noticed that Sadly it looks like the cmake branch needs quite some more work before it is usable. Hard to tell whether the problems are related to cmake, to edp-idf-v4.2, or to the xtensa compiler suite change. |
I'm having similar issue. Is the crash happening in a call to |
micropython/ports/esp32/modesp32.c Line 157 in f7aafc0
Here a check for a null pointer should be added as done in idf: This is probably worth another pr and issue. ... Not tested yet! |
Sorry, ignore my previous comment. That is just random rubbish. Turns out this does not solve the problem.
mp uses private imports here which is probably odd anyway. micropython/ports/esp32/modesp32.c Line 38 in f7aafc0
might this be related to code and symbol placing? |
The following solutions gets rid of the private import, works (i just tested) and most likely is backwards compatible.
|
|
I know. But this function seems of no use if there is no way to actually get the pointers to the heaps. And the linked list to get the heaps is in the private header. Did you find a public way to get the pointers to the heaps at runtime? |
Some more random BS related to 4.2 and psram: manually setting in modnetwork.c
EDIT: |
And why is setting CONFIG_ESP32_WIFI_CACHE_TX_BUFFER_NUM to 0 not sufficient? |
You cannot (https://github.com/espressif/esp-idf/blob/c40f2590bf759ff60ef122afa79b4ec04e7633d2/components/esp_wifi/Kconfig#L96). The build system claims that 0 is out of range (if you have psram enabled) and the minimum is 16. Also be aware, that with a setting of zero wifi ap does not work anymore. I'm currently using 4 which seems to be a hacky tradeoff ... I asked in the esp32 forum but did not get any answer yet: https://www.esp32.com/viewtopic.php?f=2&t=18966 |
I'm just catching up with this now.
Ok, that makes it hard, too many things changing at once. I had hoped that we could just abandon IDFv3 completely and move to the latest IDFv4, and that would fix everything. But it sounds like that's too optimistic, that there are too many moving pieces, and IDFv4 is not yet stable enough (at least, it has changes which reduce available RAM which we cannot take in yet). Given the new MCUs (S2, C3) and the fact they need separate toolchains, I don't think it's feasible to maintain a standard Makefile based build system. We need to switch to cmake and leverage as much of the IDF's tooling as possible. So how about sticking to IDF 4.0.1 (or minor update to 4.0.2) to start with and just converting to cmake? Then we can update te IDF 4.1.1, then IDF 4.2. |
Agreed that it's probably wise to first get 4.0.2 working and not change everything all at once. The biggest issue I have, though, is that I think it would be great to really switch build systems and use the idf tool and menuconfig. |
Ok, I'll try this.
You mean use But for menuconfig, do you mean to replace MICROPY_xxx with menuconfig? |
Yes, at least partially. I'm not sure how it would work. But the current situation is not good. Specifically:
I realize it wouldn't make sense to move/mirror all MICROPY_ options in menuconfig. |
See #6906 . |
ESP-IDF v4.2 is now supported, as of a915002 Probably this PR can be closed now. |
Feel free to re-open if there are outstanding items here. |
Decode percent encoded file paths and set charset
This PR puts together several comments in #6473 to make the esp32 cmake branch more usable and move it to esp-idf v4.2.
I did some hacky stuff WRT include directories for the soc component in main/CMakeLists.txt. I believe the fundamental issue is that the include dirs are not "exported" by the cmake stuff for that component 'cause they're not supposed to be public. I'm cmake illiterate and am sure there's a better way...
Unfortunately IRAM is becoming very, very tight and I played with some config settings in sdkconfig.ble ('cause without BLE it's a non-issue). In this PR I'm disabling sdcard support because with it iram0_0_seg is 30 or so bytes over. There are some other suggestions linked in #6473 (comment) and I'm not particularly set on which solution to pick. I did kill a day trying all kinds of options...
make size-components
is your friend, but it only works if things fit, so at least this PR gets us into a "it works" state.The CI just does esp32 cmake, the master branch needs to be merged into this branch to get the full complement. I commented out the old make-based CI steps, I hope they can become history. One issue is that the cmake stuff doesn't know how to do
make submodules
as far as I can tell.Also, would be good to rename this branch to reflect the esp-idf version.
I have lots of follow-on improvements, including all the stranded ussl stuff, but unless the ball gets rolling there's not much point queuing them up.