Skip to content
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

Update esp-wifi and esp-hal #8

Merged
merged 5 commits into from
Jul 7, 2023
Merged

Update esp-wifi and esp-hal #8

merged 5 commits into from
Jul 7, 2023

Conversation

AnthonyGrondin
Copy link
Contributor

Update esp-wifi and esp-hal to the latest version.

I've currently only done esp32s3, because it's the only chip that I have on hand.

I'm getting multiple crashes, for many different reasons, like illegal instructions, or index out of bounds.. I'm also getting this kind of error on another project using this library, so it feels like it's specific to esp-wifi and / or esp-mbedtls. I can't figure this one out.

Tested on both 1.69.0 and 1.70.0.

@bjoernQ
Copy link
Collaborator

bjoernQ commented Jun 22, 2023

I can reproduce the IllegalInstruction with the sync example - results in this (1.70, 1.69 is similar with slightly different addresses)

Exception occured 'IllegalInstruction'
Context
PC=0x4037dacf       PS=0x00060011
0x4037dacf - hal_pwr_interrupt_clr_event
    at ??:??
0x00060011 - PS_WOE
    at ??:??
A0=0x8037da21       A1=0x3fcd9e70       A2=0x00000000       A3=0x00000001       A4=0x60038004
0x8037da21 - _rtc_fast_bss_start
    at ??:??
0x3fcd9e70 - _heap_end
...

With 1.68 it works however.

Given the PC is in IRAM I suspect something increased stack usage (plus maybe 1.69 and 1.70 reserve more stack somehow)

Not sure if this is caused by esp-hal or esp-wifi (probably it's esp-wifi). I had a look at the diff but there is nothing really obvious wasting stack.

Also esp-rs/esp-wifi-sys#196 suggests it's not an Xtensa-only thing.

However, I cannot reproduce it with the example here for ESP32-C3

@bjoernQ
Copy link
Collaborator

bjoernQ commented Jun 22, 2023

Update: Most probably not a problem with the stack BUT a linker script problem

4037dacf:	f01d      	retw.n

3fc8dad0 A _data_start
3fc8dad0 d _ZN8esp_wifi4wifi10os_adapter14FAKE_SPIN_LOCK17h713b30e6a3223c01E

@bjoernQ
Copy link
Collaborator

bjoernQ commented Jun 22, 2023

I can confirm it's a linker script issue. Needs some more testing and then I can hopefully create a PR for esp-hal tomorrow.

@AnthonyGrondin
Copy link
Contributor Author

I've added the examples for esp32 and esp32c3. I haven't tested if they run, as I don't have those chips on hand, but I've tested for esp32s3 and everything works fine, except for sync_client which seems to hang for me, at Making HTTP request

@bjoernQ
Copy link
Collaborator

bjoernQ commented Jun 23, 2023

The problem on ESP32-S3 should be fixed in esp-rs/esp-hal#616 - maybe you want to check it by patching the dependency

@bjoernQ
Copy link
Collaborator

bjoernQ commented Jun 23, 2023

Seems like it's working for all the targets now with a patched HAL. We plan to have new HAL releases soon (and update esp-wifi as soon as the HALs are released)

@AnthonyGrondin
Copy link
Contributor Author

Great! Thanks for taking care of it.
I'll wait until esp-hal and esp-wifi get updated, then update the changes in this PR.

@AnthonyGrondin AnthonyGrondin marked this pull request as ready for review July 5, 2023 18:33
@AnthonyGrondin
Copy link
Contributor Author

Needs testing on esp32 and esp32c3, but I've tested esp32s3 and everything works.

This gives me errors when I compile without --release

examples-esp32c3/Cargo.toml Outdated Show resolved Hide resolved
Copy link
Collaborator

@bjoernQ bjoernQ left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@bjoernQ
Copy link
Collaborator

bjoernQ commented Jul 7, 2023

Compiles fine now for ESP32-C3. I had some problems with the ESP32-C3 async_client example since it seems that something (probably the WiFi drivers) now allocate more memory and I had to remove the last certificate in CERT to make it work.

I will merge this anyways to not block you from making progress in #9

@bjoernQ bjoernQ merged commit 9689ee6 into esp-rs:main Jul 7, 2023
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants