-
Notifications
You must be signed in to change notification settings - Fork 1.3k
ESP32S2: move to official IDF submodule #3492
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 have no problem with my IDF local with espressif/esp-idf@6c17e3a I am not fully aware of what and when cause the issues, but we can start to go through commits list from there. There is an issue with persistent mode as mentioned by @me-no-dev in this tinyusb pr hathach/tinyusb#492 . I am not sure if the work on IDF got updated with this, or fixed else, maybe it is just pin config changing that happens as last time. |
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.
Without minimizing the amount of work this actually required, the changes to this point look quite sensible to the point of being simple and straightforward (to read).
I am surprised that the PR does not include a change to the esp-idf submodule itself, but that is presumably due to its draft state.
You can't see the Submodule changes? Should be visible in .gitmodules and as a ~1000 file submodule update further down the file list. They're visible for me, is it possible you expected the module change to be at the top and missed that it was further down? I'm not sure why it did that this time, normally it puts submodule updates at the top of the changelist. |
Yeah my bad, it's there. It just, uh, looked different than I was looking for (because it didn't call out the list of files modified in the submodule) I may just return to bed, I'm not doing so good at detail oriented stuff today. |
@hierophect thanks for the very clear summary; I was curious what the @hathach thanks for a known good working point. I have a mostly-admin task day today, so I'm going to learn about |
Woot- I'm liking
|
Green LED! @hierophect @hathach @me-no-dev: the following patch gets (CircuitPython) UF2 working:
@hathach - I think this means that the change to I've tried updating tinyusb in uf2_esp32 to the latest, adding me-no-devs fork as a remote, and merging in @hierophect & @hathach - so I think we have a short term work-around by patching esp_idf, but longer term should we be aiming for no changes to esp_idf and focus on getting hathach/tinyusb#492 working and update the reference in CircuitPython? |
@julianrendell thanks for putting in the work to help track this down! I've also been circling this issue and your contributions have been super helpful. In general, our goal is to transition completely over to the Espressif repo of the IDF as soon as possible. We need the latest changes to the ESP-IDF in order to enable the ADC calibration measures that allow ADC readings to be accurate to within 0.1V, and we don't want to be operating off a fork anyway (see the PR description for why that was done at all). So issuing another patch to solve this issue halfway is not something I'd like to do, if possible. I'm not confident enough with my USB familiarity to understand what exactly went wrong, here. So espressif/esp-idf@0aa1c13 broke USB on TinyUSB, if I understand properly? Why exactly was this change made by Espressif? Is the solution to submit a pull request to Espressif informing them of an error, or to change our own code in either Circuitpython or TinyUSB to reflect the changes they made? @hathach and @tannewt I'd appreciate your thoughts on next steps here. From a debugging standpoint, I can confirm that on Circuitpython, this issue does appear to be related to TinyUSB, since the debugger shows no obvious problems with the Circuitpython core. @julianrendell I assume your tests are referring to adafruit/tinyuf2#12 (comment), and you are still using your same methods for debugging? |
After a git mistake... I've just recompiled CP clean using esp_idf patched as per above, and at least the uf2 build appears to be working (REPL appears in mu.) |
Also, for reference, here are the relevant commits:
Edited to show submission dates, which I should have just checked in the first place. |
@hierophect - you're welcome. Here's what I've done:
I understand and agree re wanting to be able to use an unpatched esp_idf (to be super clear, I'm not proposing the we keep the change to esp_idf that got things working, just verifying this is the change that breaks uf2-esp32s) Here's my understanding from reading the PR @hathach linked to: there is a needed change to esp_idf for persistent USB to work (not sure what that means, but it sounds good :-) ). @me-no-dev proposed some required changes to tiny_usb (hathach/tinyusb#492) but there are some instabilities with it? I did try pulling the latest tinyusb into uf2-esp32s and applying hathach/tinyusb#492 (directly from @me-no-dev's branch) but that failed to work. So in summary, I think for uf2-esp32s (and maybe CP?) to work with the latest, unmodified esp_idf, there are changes/fixes needed to tinyusb. That's out of my realm of experience. @hathach @tannewt - does that sound about right? Suggestions for how to proceed appreciated :-) |
Ach, I figured out that the ADC calibration changes are actually the oldest of everything, which is why I had my timeline confused. So it's actually entirely feasible that by using the pre-break version, we'll also solve the ADC issue, and don't have to deal with any of the breaking file changes. Giving it a shot now. |
@hierophect I've just checked and discovered that CP and uf2-esp32s are pulling in different versions of tinyusb. My suggestion is that we aim to:
-edit- |
Ok, I reverted the changes representing the ESP-IDF's refactor from components/soc to components/hal, along with the system binary name change also included in that commit (5425ef4). Confirmed working on my Saola 1 Wrover! I'm merging this into my ADC branch so I can continue work on that. I don't think we have any other urgent reasons to be on the latest version of the ESP-IDF - if we merge this as is, we can always revisit IDF updates by simply reverting the above commit (e01e8dd). We can come back to it whenever TinyUSB is stable alongside an up-to-date ESP-IDF version. |
Actually, I spoke a little too soon there. TinyUSB does need a change for this to work. In
@hathach should I make a PR for this? Or should I be handling it some other way, like using the version of TinyUSB inside the IDF? |
If you use the version in esp_idf does that bring problems for the other CP platforms? I’m out of time for now, but I’d be curious to try the tinyusb from latest idf with uf2_esp32s2 and CP and see If that works- ie brute force copy and replace. Maybe they’ve added a fix and have yet to PR it to tinyusb. At this point it feels like a big enough problem that it’s worth trying to fix sooner than later- seems like it’s accumulating technical debt. |
To be honest, I don't like this change since IDF move files around quite a lot and there will be more mcu such as esp32s3, it is better if we could use the default include path set by IDF toolchain. Though if you think it is a must, please try to submit PR to tinyusb to see if it could pass the ci buld with stock IDF (which lots of people will also use as well), I am not sure if |
@hathach the issue is that we need these files to use the -isystem path, or they will cause errors like |
Sorry, I thought this was more complicated than it actually was. It just needs an update to override the |
I am glad you figure it out, espressif should really define this to |
@hierophect The Also I tried reverting |
@jepler @tannewt so, the current issue with this PR is that, while it works just fine on a host machine, the above I'm not sure what to do here. We could merge this PR anyway and accept CI failures on every ESP32 build for a little while. Or we could wait until TinyUSB becomes compatible with the latest ESP-IDF versions, and just put a hold on the Analog APIs until then. |
I don't think |
Interesting. I wonder why it does not with my setup on Mac OSX? |
I guess that means we have no choice but to wait for TinyUSB compatibility. @hathach do you have a moment to check out TinyUSB compatibility with the latest release of the ESP-IDF this week? @julianrendell mentioned it might have something to do with hathach/tinyusb#492 but I'm not familiar enough with USB specifics to be sure. All I know for certain is that TinyUSB does not work with any ESP-IDF commit after espressif/esp-idf@0aa1c13 |
I will test it out this week for sure 👌👌 |
@hierophect Sounds like you should make a new fork of the idf to fix gdbgui with tinyusb working. It'll still be better than mine because it'll be closer to the espressif version. |
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.
Thank you!
Up to now, the ESP32S2 port has been using a modified version of the ESP32-IDF (IoT Development Framework, the core framework for developing on the ESP32-S2 with all HAL APIs, drivers, FreeRTOS components, etc) forked by @tannewt. This was because the IDF itself contains a lot of
undef
type preprocessor errors that conflict with our use of-Werror
, which Scott manually fixed in his fork.We recently discovered a workaround for this, which involves using the "-isystem" directory option to mark all IDF files as system files, ignoring their warnings. This lets use use the official IDF, though it does require a lot of changes, both to make sure all preprocessor includes use an
-isystem
derived path, and to represent a bunch of other changes to the IDF since we forked (lots of files were moved refactored from "soc" locations to "hal" locations, and a critical system binary was renamed).With @hathach and @julianrendell's help, the USB issue with this has been fixed. Tested successfully on a Saola 1 Wrover.