-
Notifications
You must be signed in to change notification settings - Fork 1k
Add intercore communication example for STM32H755CM4 and CM7 #4184
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
Open
Ragarnoy
wants to merge
9
commits into
embassy-rs:main
Choose a base branch
from
Ragarnoy:stm32h755-intercore
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…ot work in release for now (for some reason)
…probably things that can be done to be able to keep lto, I haven't found yet)
@diondokter Asking for your point of view on this since you did all of the work for the dual core H7 on embassy |
diondokter
reviewed
May 10, 2025
Comment on lines
+59
to
+60
self.led_states.store(new_value, Ordering::SeqCst); | ||
core::sync::atomic::fence(Ordering::SeqCst); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In a bunch of places you do this fence after an atomic operation. I don't think this is necessary (though I could be wrong)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request introduces intercore communication examples for the STM32H755CM4 and CM7.
This runs fine in dev.
A lot of inlining has to be disabled for this to work in release, otherwise the following symptoms may appear:
Expected behaviour of the example
CM7 Main Loop
Counter increment: every 100 ms, CM7 does counter.store(counter+1).
Green LED toggle: when counter % 10 == 0 (i.e. every 1 s), CM7 flips the green‐bit in led_states.
Yellow LED toggle: when counter % 30 == 0 (i.e. every 3 s), CM7 flips the yellow‐bit.
CM4 Observer Task
Heartbeat Task: CM4’s blink_heartbeat toggles the red LED every 500 ms, independent of shared memory.
Shared‐LED Sync: In its main loop (polled every 10 ms), CM4:
Visual Result
Red LED blinking steadily at 2 Hz (heartbeat).
Green LED blinking at 0.5 Hz (1 s on/off).
Yellow LED blinking at ≈0.166 Hz (3 s on/off), phase-aligned to the green toggles.
When detaching the RTT logging, the first core is halted, but the red led will keep blinking since it's driven by the second core.