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

Implement starting a task on second core of ESP32 and ESP32-S3 #96

Merged
merged 1 commit into from
Jul 5, 2022

Conversation

bjoernQ
Copy link
Contributor

@bjoernQ bjoernQ commented Jul 5, 2022

This implements a way to start a task on the app CPU of ESP32 and ESP32-S3.

On ESP32-S3 this currently needs to use a ROM function since the register for the CORE1 boot address can't be found in TRM or SVD. Not a big deal but would be nice to get rid of the ROM function one day.

In this PR I tried to use closures for the APP CPU task - let us see how good that works ... if it doesn't for some reason we can revert to having a free-standing function that gets started and needs to get it's resources via statics.

Fixes #46

Copy link
Member

@jessebraham jessebraham left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall looks good, thanks for implementing this! Just left one comment, feel free to ignore it if you wish!

Comment on lines +76 to +80
#[cfg_attr(feature = "esp32", path = "cpu_control/esp32.rs")]
#[cfg_attr(feature = "esp32c3", path = "cpu_control/none.rs")]
#[cfg_attr(feature = "esp32s2", path = "cpu_control/none.rs")]
#[cfg_attr(feature = "esp32s3", path = "cpu_control/esp32s3.rs")]
pub mod cpu_control;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
#[cfg_attr(feature = "esp32", path = "cpu_control/esp32.rs")]
#[cfg_attr(feature = "esp32c3", path = "cpu_control/none.rs")]
#[cfg_attr(feature = "esp32s2", path = "cpu_control/none.rs")]
#[cfg_attr(feature = "esp32s3", path = "cpu_control/esp32s3.rs")]
pub mod cpu_control;
#[cfg_attr(feature = "esp32", path = "cpu_control/esp32.rs")]
#[cfg_attr(feature = "esp32s3", path = "cpu_control/esp32s3.rs")]
pub mod cpu_control;
#[cfg(any(feature = "esp32c3", feature = "esp32s2"))]
pub mod cpu_control {}

Probably nitpicking as usual (😁) but maybe something like this would be better? Seems kind of strange to require an empty source file to me, but also whatever works is fine at the end of the day.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah - unfortunately the compiler hates it this way 😆 so I think we need to keep the none.rs

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ahh fair enough, just a thought 😁

@jessebraham jessebraham merged commit 1655e36 into esp-rs:main Jul 5, 2022
@bjoernQ bjoernQ deleted the feature/multicore branch October 27, 2022 14:22
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.

Multicore support for ESP32 and ESP32S3
2 participants