aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xci.sh2
-rw-r--r--embassy-executor/src/metadata.rs1
-rw-r--r--embassy-executor/src/raw/mod.rs10
-rw-r--r--embassy-executor/src/raw/trace.rs17
-rw-r--r--embassy-executor/src/spawner.rs10
5 files changed, 13 insertions, 27 deletions
diff --git a/ci.sh b/ci.sh
index 94bf83675..4934c6d8e 100755
--- a/ci.sh
+++ b/ci.sh
@@ -31,7 +31,9 @@ cargo batch \
31 --- build --release --manifest-path embassy-executor/Cargo.toml --target thumbv6m-none-eabi --features defmt \ 31 --- build --release --manifest-path embassy-executor/Cargo.toml --target thumbv6m-none-eabi --features defmt \
32 --- build --release --manifest-path embassy-executor/Cargo.toml --target thumbv6m-none-eabi --features defmt,arch-cortex-m,executor-thread,executor-interrupt \ 32 --- build --release --manifest-path embassy-executor/Cargo.toml --target thumbv6m-none-eabi --features defmt,arch-cortex-m,executor-thread,executor-interrupt \
33 --- build --release --manifest-path embassy-executor/Cargo.toml --target thumbv7em-none-eabi --features arch-cortex-m \ 33 --- build --release --manifest-path embassy-executor/Cargo.toml --target thumbv7em-none-eabi --features arch-cortex-m \
34 --- build --release --manifest-path embassy-executor/Cargo.toml --target thumbv7em-none-eabi --features arch-cortex-m,trace \
34 --- build --release --manifest-path embassy-executor/Cargo.toml --target thumbv7em-none-eabi --features arch-cortex-m,rtos-trace \ 35 --- build --release --manifest-path embassy-executor/Cargo.toml --target thumbv7em-none-eabi --features arch-cortex-m,rtos-trace \
36 --- build --release --manifest-path embassy-executor/Cargo.toml --target thumbv7em-none-eabi --features arch-cortex-m,trace,rtos-trace \
35 --- build --release --manifest-path embassy-executor/Cargo.toml --target thumbv7em-none-eabi --features arch-cortex-m,executor-thread \ 37 --- build --release --manifest-path embassy-executor/Cargo.toml --target thumbv7em-none-eabi --features arch-cortex-m,executor-thread \
36 --- build --release --manifest-path embassy-executor/Cargo.toml --target thumbv7em-none-eabi --features arch-cortex-m,executor-interrupt \ 38 --- build --release --manifest-path embassy-executor/Cargo.toml --target thumbv7em-none-eabi --features arch-cortex-m,executor-interrupt \
37 --- build --release --manifest-path embassy-executor/Cargo.toml --target thumbv7em-none-eabi --features arch-cortex-m,executor-thread,executor-interrupt \ 39 --- build --release --manifest-path embassy-executor/Cargo.toml --target thumbv7em-none-eabi --features arch-cortex-m,executor-thread,executor-interrupt \
diff --git a/embassy-executor/src/metadata.rs b/embassy-executor/src/metadata.rs
new file mode 100644
index 000000000..957417f6b
--- /dev/null
+++ b/embassy-executor/src/metadata.rs
@@ -0,0 +1 @@
pub struct Metadata {}
diff --git a/embassy-executor/src/raw/mod.rs b/embassy-executor/src/raw/mod.rs
index 4b17d4982..bcd4ee432 100644
--- a/embassy-executor/src/raw/mod.rs
+++ b/embassy-executor/src/raw/mod.rs
@@ -97,8 +97,6 @@ pub(crate) struct TaskHeader {
97 #[cfg(feature = "trace")] 97 #[cfg(feature = "trace")]
98 pub(crate) name: Option<&'static str>, 98 pub(crate) name: Option<&'static str>,
99 #[cfg(feature = "trace")] 99 #[cfg(feature = "trace")]
100 pub(crate) id: u32,
101 #[cfg(feature = "trace")]
102 all_tasks_next: AtomicPtr<TaskHeader>, 100 all_tasks_next: AtomicPtr<TaskHeader>,
103} 101}
104 102
@@ -148,6 +146,12 @@ impl TaskRef {
148 pub(crate) fn as_ptr(self) -> *const TaskHeader { 146 pub(crate) fn as_ptr(self) -> *const TaskHeader {
149 self.ptr.as_ptr() 147 self.ptr.as_ptr()
150 } 148 }
149
150 /// Returns the task ID.
151 /// This can be used in combination with rtos-trace to match task names with IDs
152 pub fn id(&self) -> u32 {
153 self.as_ptr() as u32
154 }
151} 155}
152 156
153/// Raw storage in which a task can be spawned. 157/// Raw storage in which a task can be spawned.
@@ -192,8 +196,6 @@ impl<F: Future + 'static> TaskStorage<F> {
192 #[cfg(feature = "trace")] 196 #[cfg(feature = "trace")]
193 name: None, 197 name: None,
194 #[cfg(feature = "trace")] 198 #[cfg(feature = "trace")]
195 id: 0,
196 #[cfg(feature = "trace")]
197 all_tasks_next: AtomicPtr::new(core::ptr::null_mut()), 199 all_tasks_next: AtomicPtr::new(core::ptr::null_mut()),
198 }, 200 },
199 future: UninitCell::uninit(), 201 future: UninitCell::uninit(),
diff --git a/embassy-executor/src/raw/trace.rs b/embassy-executor/src/raw/trace.rs
index f484abf58..e769d63da 100644
--- a/embassy-executor/src/raw/trace.rs
+++ b/embassy-executor/src/raw/trace.rs
@@ -176,12 +176,6 @@ pub trait TaskRefTrace {
176 176
177 /// Set the name for a task 177 /// Set the name for a task
178 fn set_name(&self, name: Option<&'static str>); 178 fn set_name(&self, name: Option<&'static str>);
179
180 /// Get the ID for a task
181 fn id(&self) -> u32;
182
183 /// Set the ID for a task
184 fn set_id(&self, id: u32);
185} 179}
186 180
187impl TaskRefTrace for TaskRef { 181impl TaskRefTrace for TaskRef {
@@ -195,17 +189,6 @@ impl TaskRefTrace for TaskRef {
195 (*header_ptr).name = name; 189 (*header_ptr).name = name;
196 } 190 }
197 } 191 }
198
199 fn id(&self) -> u32 {
200 self.header().id
201 }
202
203 fn set_id(&self, id: u32) {
204 unsafe {
205 let header_ptr = self.ptr.as_ptr() as *mut TaskHeader;
206 (*header_ptr).id = id;
207 }
208 }
209} 192}
210 193
211#[cfg(not(feature = "rtos-trace"))] 194#[cfg(not(feature = "rtos-trace"))]
diff --git a/embassy-executor/src/spawner.rs b/embassy-executor/src/spawner.rs
index 2909d19a0..7550e8ea4 100644
--- a/embassy-executor/src/spawner.rs
+++ b/embassy-executor/src/spawner.rs
@@ -36,12 +36,12 @@ impl<S> SpawnToken<S> {
36 } 36 }
37 } 37 }
38 38
39 /// Returns the task id if available, otherwise 0 39 /// Returns the task ID if available, otherwise 0
40 /// This can be used in combination with rtos-trace to match task names with id's 40 /// This can be used in combination with rtos-trace to match task names with IDs
41 pub fn id(&self) -> u32 { 41 pub fn id(&self) -> u32 {
42 match self.raw_task { 42 match self.raw_task {
43 None => 0, 43 None => 0,
44 Some(t) => t.as_ptr() as u32, 44 Some(t) => t.id(),
45 } 45 }
46 } 46 }
47 47
@@ -223,10 +223,8 @@ impl SpawnerTraceExt for Spawner {
223 223
224 match task { 224 match task {
225 Some(task) => { 225 Some(task) => {
226 // Set the name and ID when trace is enabled 226 // Set the name when trace is enabled
227 task.set_name(Some(name)); 227 task.set_name(Some(name));
228 let task_id = task.as_ptr() as u32;
229 task.set_id(task_id);
230 228
231 unsafe { self.executor.spawn(task) }; 229 unsafe { self.executor.spawn(task) };
232 Ok(()) 230 Ok(())