Skip to content

Split out SMP examples#127

Merged
jonathanpallant merged 5 commits intorust-embedded:mainfrom
thejpster:more-smp-examples
Mar 10, 2026
Merged

Split out SMP examples#127
jonathanpallant merged 5 commits intorust-embedded:mainfrom
thejpster:more-smp-examples

Conversation

@thejpster
Copy link
Contributor

@thejpster thejpster commented Feb 16, 2026

Moves the SMP example to its own example folder, and allocates stacks for all cores.

This makes it easier to share code across multiple SMP examples when adding more SMP examples in the future.

@thejpster thejpster force-pushed the more-smp-examples branch 2 times, most recently from a7d6747 to 71e5b79 Compare February 20, 2026 20:51
@thejpster thejpster force-pushed the more-smp-examples branch from e889cd5 to cd0bf0c Compare March 3, 2026 21:02
@thejpster
Copy link
Contributor Author

Rebased on main

@robamu
Copy link
Contributor

robamu commented Mar 5, 2026

The stacks are interleaved for each core? Just curious, is this common practice for SMP systems?

@thejpster
Copy link
Contributor Author

thejpster commented Mar 5, 2026

I couldn't think of a way to allocate the space for N CPUs in the linker script without doing it this way. I cannot remember where I got the idea from, but I definitely saw it somewhere.

Will make it easier to add other tests, like sharing the GIC across
cores.
We send a Software Generated Interrupt from Core 0 to Core 1, and then
another one back the other way.
* The `_num_cores` symbol controls how many copies of each stack you get
* Added better docs to link.x
* Added `enum Stack` to aarch32-rt, which can fetch information about
  each stack
* Simplified the SMP start-up code
* Stacks and stack related code are now all in the same order

If you want to put stacks into TCM, you'll need custom routines. This
code assumes stacks all live in the same region of RAM.
The parser thought the hyphen started a bullet list.
The two cores were racing and I saw output mismatches in CI
@jonathanpallant jonathanpallant added this pull request to the merge queue Mar 10, 2026
Merged via the queue into rust-embedded:main with commit 9cf44d2 Mar 10, 2026
50 checks 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.

3 participants