diff options
| author | Dario Nieuwenhuis <[email protected]> | 2025-08-31 18:54:21 +0000 |
|---|---|---|
| committer | GitHub <[email protected]> | 2025-08-31 18:54:21 +0000 |
| commit | a475dbbda897266bff6314c43ae55025624e02c7 (patch) | |
| tree | 3646ad79bdedf07b2530366c03c857ebac52a6ee | |
| parent | 71a2e81754c3fa56cf7e3e1135a5805d6e1b77ec (diff) | |
| parent | 4cd86e5e76ca8eaa2e2cb8bcca0ec9a0f574b409 (diff) | |
Merge pull request #4372 from fg-cfh/feat/name-main-task
executor-macros: rtos-trace: name main task
| -rw-r--r-- | .github/workflows/changelog.yml | 4 | ||||
| -rw-r--r-- | embassy-executor-macros/src/macros/main.rs | 16 | ||||
| -rw-r--r-- | embassy-executor/CHANGELOG.md | 1 |
3 files changed, 17 insertions, 4 deletions
diff --git a/.github/workflows/changelog.yml b/.github/workflows/changelog.yml index 13e04d954..8ee143cad 100644 --- a/.github/workflows/changelog.yml +++ b/.github/workflows/changelog.yml | |||
| @@ -161,9 +161,9 @@ jobs: | |||
| 161 | if: steps.changes.outputs.embassy-executor-macros == 'true' | 161 | if: steps.changes.outputs.embassy-executor-macros == 'true' |
| 162 | uses: dangoslen/changelog-enforcer@v3 | 162 | uses: dangoslen/changelog-enforcer@v3 |
| 163 | with: | 163 | with: |
| 164 | changeLogPath: embassy-executor-macros/CHANGELOG.md | 164 | changeLogPath: embassy-executor/CHANGELOG.md |
| 165 | skipLabels: "skip-changelog" | 165 | skipLabels: "skip-changelog" |
| 166 | missingUpdateErrorMessage: "Please add a changelog entry in the embassy-executor-macros/CHANGELOG.md file." | 166 | missingUpdateErrorMessage: "Please add a changelog entry in the embassy-executor/CHANGELOG.md file." |
| 167 | - name: Check that changelog updated (embassy-executor-timer-queue) | 167 | - name: Check that changelog updated (embassy-executor-timer-queue) |
| 168 | if: steps.changes.outputs.embassy-executor-timer-queue == 'true' | 168 | if: steps.changes.outputs.embassy-executor-timer-queue == 'true' |
| 169 | uses: dangoslen/changelog-enforcer@v3 | 169 | uses: dangoslen/changelog-enforcer@v3 |
diff --git a/embassy-executor-macros/src/macros/main.rs b/embassy-executor-macros/src/macros/main.rs index fcc04d9c0..f043ff7f6 100644 --- a/embassy-executor-macros/src/macros/main.rs +++ b/embassy-executor-macros/src/macros/main.rs | |||
| @@ -170,6 +170,14 @@ For example: `#[embassy_executor::main(entry = ..., executor = \"some_crate::Exe | |||
| 170 | let f_body = f.body; | 170 | let f_body = f.body; |
| 171 | let out = &f.sig.output; | 171 | let out = &f.sig.output; |
| 172 | 172 | ||
| 173 | let name_main_task = if cfg!(feature = "rtos-trace") { | ||
| 174 | quote!( | ||
| 175 | main_task.metadata().set_name("main\0"); | ||
| 176 | ) | ||
| 177 | } else { | ||
| 178 | quote!() | ||
| 179 | }; | ||
| 180 | |||
| 173 | let (main_ret, mut main_body) = match arch.flavor { | 181 | let (main_ret, mut main_body) = match arch.flavor { |
| 174 | Flavor::Standard => ( | 182 | Flavor::Standard => ( |
| 175 | quote!(!), | 183 | quote!(!), |
| @@ -181,7 +189,9 @@ For example: `#[embassy_executor::main(entry = ..., executor = \"some_crate::Exe | |||
| 181 | let mut executor = #executor::new(); | 189 | let mut executor = #executor::new(); |
| 182 | let executor = unsafe { __make_static(&mut executor) }; | 190 | let executor = unsafe { __make_static(&mut executor) }; |
| 183 | executor.run(|spawner| { | 191 | executor.run(|spawner| { |
| 184 | spawner.spawn(__embassy_main(spawner).unwrap()); | 192 | let main_task = __embassy_main(spawner).unwrap(); |
| 193 | #name_main_task | ||
| 194 | spawner.spawn(main_task); | ||
| 185 | }) | 195 | }) |
| 186 | }, | 196 | }, |
| 187 | ), | 197 | ), |
| @@ -191,7 +201,9 @@ For example: `#[embassy_executor::main(entry = ..., executor = \"some_crate::Exe | |||
| 191 | let executor = ::std::boxed::Box::leak(::std::boxed::Box::new(#executor::new())); | 201 | let executor = ::std::boxed::Box::leak(::std::boxed::Box::new(#executor::new())); |
| 192 | 202 | ||
| 193 | executor.start(|spawner| { | 203 | executor.start(|spawner| { |
| 194 | spawner.spawn(__embassy_main(spawner).unwrap()); | 204 | let main_task = __embassy_main(spawner).unwrap(); |
| 205 | #name_main_task | ||
| 206 | spawner.spawn(main_task); | ||
| 195 | }); | 207 | }); |
| 196 | 208 | ||
| 197 | Ok(()) | 209 | Ok(()) |
diff --git a/embassy-executor/CHANGELOG.md b/embassy-executor/CHANGELOG.md index 953f4b9b6..69c82653b 100644 --- a/embassy-executor/CHANGELOG.md +++ b/embassy-executor/CHANGELOG.md | |||
| @@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 | |||
| 9 | ## Unreleased - ReleaseDate | 9 | ## Unreleased - ReleaseDate |
| 10 | 10 | ||
| 11 | - Added new metadata API for tasks | 11 | - Added new metadata API for tasks |
| 12 | - Named main task when rtos-trace feature is enabled. | ||
| 12 | - Upgraded rtos-trace | 13 | - Upgraded rtos-trace |
| 13 | - Fixed performance regression on some ESP32 MCUs. | 14 | - Fixed performance regression on some ESP32 MCUs. |
| 14 | 15 | ||
