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

threads: add support for RISC-V (esp32 only) #182

Merged
merged 5 commits into from
May 6, 2024

Conversation

elenaf9
Copy link
Collaborator

@elenaf9 elenaf9 commented Mar 14, 2024

Initial support for threading on RISCV.

For now this only supports the esp32c3 and esp32c6 boards since we depend on specific features from esp-hal.
Adding support for other esp boards can be done in follow up PRs.

Most of the changes are only within the new riscv module, but one general change I'd like to mention:

  • Setting threads.current_id to the very first running thread is now done within sched when the thread actually starts running. Before, this was done already in start_threading, but it caused some problems in the RISC-V implementation because then we couldn't differentiate between the thread running for the first time and current_id == next_id. I've tested on both arch'es and it still works with this change, so I think it should be alright?

Note: I have not tested using threading and embassy tasks together. But we also don't have any examples that tested this for cortex-m, so I'd argue that it's out of scope for this PR. Wdyt?

Part of #157.

@kaspar030
Copy link
Collaborator

This looks already very nice!

@elenaf9
Copy link
Collaborator Author

elenaf9 commented Mar 15, 2024

This also supports the esp32c6 board now.

I've merged the master without a rebase for now to include #181 but not destroy the history. I'll rebase properly before merge.

@elenaf9 elenaf9 changed the title threads: add support for RISC-V (esp32c3 only for now) threads: add support for RISC-V (esp32 only) Mar 15, 2024
@emmanuelsearch emmanuelsearch added arch Architecture support threading labels Mar 15, 2024
@kaspar030
Copy link
Collaborator

Please squash & rebase!

@kaspar030
Copy link
Collaborator

kaspar030 commented May 6, 2024

I think this is good to go, just one thing we need to find a solution for: threading conflicts use of wifi on esp32. So we'll need to model both in laze. I'll come up with sth.

Preperation for riscv module, where setting up the stack requires access
to the `ThreadData`.
@elenaf9 elenaf9 force-pushed the threads/riscv branch 2 times, most recently from 023ad1a to 465a3e3 Compare May 6, 2024 09:09
@elenaf9
Copy link
Collaborator Author

elenaf9 commented May 6, 2024

Please squash & rebase!

Done. Sorry for the many force-pushes, I accidentally merged to commits during rebase that shouldn't have been merged.

@elenaf9
Copy link
Collaborator Author

elenaf9 commented May 6, 2024

I think this is good to go, just one thing we need to find a solution for: threading conflicts use of wifi on esp32. So we'll need to model both in laze. I'll come up with sth.

👍 I'll open an issue for it once this is merged.

Edit: #289.

@kaspar030 kaspar030 added this pull request to the merge queue May 6, 2024
@kaspar030
Copy link
Collaborator

Thanks!

Merged via the queue into future-proof-iot:main with commit e5af00f May 6, 2024
16 checks passed
@elenaf9 elenaf9 deleted the threads/riscv branch May 6, 2024 14:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
arch Architecture support threading
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants