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

ESP32 support #4

Open
Klayflash opened this issue Oct 10, 2021 · 2 comments
Open

ESP32 support #4

Klayflash opened this issue Oct 10, 2021 · 2 comments

Comments

@Klayflash
Copy link

Hello!

Is context switching support planed for ESP32?
For example ESP32 DEVKITV1 (ESP-WROOM-32).

I've found following:

@Akaricchi
Copy link
Member

Hi, sorry for the delayed response.

No plans to support this, since I have neither a use-case nor the hardware for it, but I'll happily merge a pull request if someone is willing to implement it.

I have no experience with RTOS, but from reading a bit of those documents, their coroutine API doesn't look suitable for a Koishi backend implementation. Those coroutines are stackless, whereas Koishi coroutines have their own stacks akin to user-space threads. RTOS Tasks look like a closer fit, assuming the preemption is optional and tasks can yield to each other manually.

It's also possible to implement support for specific instruction set and ABI into the fcontext backend directly in assembly. The concept is fairly simple, you just need a way to manipulate the stack pointer and save/restore a few CPU registers to/from the coroutine stacks. (The ontop function is currently unused and can be ignored.)

@Klayflash
Copy link
Author

Klayflash commented Oct 30, 2021

Thanks for the reply.

I've created request on ESP-IDF. So, I think, this ticket can be paused until esp-idf ticket done.

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

No branches or pull requests

2 participants