Skip to content

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

Merged
jessebraham merged 1 commit into
esp-rs:mainfrom
bjoernQ:feature/multicore
Jul 5, 2022
Merged

Implement starting a task on second core of ESP32 and ESP32-S3#96
jessebraham merged 1 commit into
esp-rs:mainfrom
bjoernQ:feature/multicore

Conversation

@bjoernQ

@bjoernQ bjoernQ commented Jul 5, 2022

Copy link
Copy Markdown
Contributor

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

@bjoernQ
bjoernQ requested review from MabezDev and jessebraham July 5, 2022 10:21
@bjoernQ bjoernQ mentioned this pull request Jul 5, 2022

@jessebraham jessebraham left a comment

Copy link
Copy Markdown
Member

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 thread esp-hal-common/src/lib.rs
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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