Skip to content

Baremetal multicore support #4851

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

Draft
wants to merge 3 commits into
base: dev
Choose a base branch
from
Draft

Baremetal multicore support #4851

wants to merge 3 commits into from

Conversation

aykevl
Copy link
Member

@aykevl aykevl commented Apr 12, 2025

Use multiple cores of the "baremetal" riscv-qemu target. The goal is to iron out all the bugs on an easy-to-debug target before moving on to more interesting targets like RP2040. After this PR is done, the RP2040 should be relatively easy to add support for (since I already wrote most of that code).

Work in progress. This already mostly works, but there are a few things that still need to be fixed:

  • There's a timing bug where if one goroutine pauses, and another already running goroutine pauses for a shorter time, the second may not be woken up at the earlier time.
  • Timers (time.NewTimer etc) need to be implemented.
  • Stack scanning (for the GC) needs to be implemented.

aykevl added 3 commits April 12, 2025 10:51
This is more descriptive: the call is to exit a task, not to pause it.
This also makes it more obvious that there's an optimization
opportunity: to free the stack explicitly after the goroutine returns
(or to keep it as a cache for the next stack allocation).
This variable is only necessary on the cooperative scheduler. It is not
actually used on the "none" scheduler, so can be removed there.
Copy link

Size difference with the dev branch:

Binary size difference
drivers/sizes-dev.txt has more commands than drivers/sizes-pr.txt
    tinygo build -size short -o ./build/test.hex -target=feather-rp2040 ./examples/adafruit4650
 flash                          ram
 before   after   diff          before   after   diff

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.

1 participant