Skip to content

esp32: Workaround for ringbuf functions required by ISRs. #14145

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

Merged
merged 1 commit into from
Mar 22, 2024

Conversation

jimmo
Copy link
Member

@jimmo jimmo commented Mar 21, 2024

See espressif/esp-idf#13378

Workaround for #14005 (cc @Tangerino)

Note that this means that all esp32-og builds get non-isr ringbuf functions placed in flash now, whereas previously it was just the spiram variant. This might be a good thing (e.g. free up some iram for native/viper).

This work was funded through GitHub Sponsors.

@jimmo
Copy link
Member Author

jimmo commented Mar 21, 2024

Verified from disassembly:

4009a3ec <xRingbufferSendFromISR>:
...
4009a429:       02ad            mov.n   a10, a2
4009a42b:       003665          call8   4009a790 <prvGetCurMaxSizeByteBuf>
4009a42e:       030c            movi.n  a3, 0
...

(prvGetCurMaxSizeByteBuf is the de-duplicated symbol, same as prvGetFreeSize)

Previously this was:

4009a430 <xRingbufferSendFromISR>:
...
4009a46d:       02ad            mov.n   a10, a2
4009a46f:       9b2a81          l32r    a8, 40081118 <_iram_text_start+0xd14>
4009a472:       0008e0          callx8  a8
4009a475:       030c            movi.n  a3, 0
...

(where _iram_text_start+0xd14 is 0x401ec634, i.e. prvGetCurMaxSizeByteBuf in flash)

This workaround makes sure that all ringbuf functions that may be called
from an ISR are placed in IRAM.  See
espressif/esp-idf#13378

Note that this means that all esp32-og builds get non-ISR ringbuf functions
placed in flash now, whereas previously it was just the spiram variant.
This might be a good thing (e.g. free up some IRAM for native/viper).

Fixes issue micropython#14005.

This work was funded through GitHub Sponsors.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants