Skip to content

Conversation

mathieuchopstm
Copy link
Contributor

Update existing support for Zephyr RTOS to use proper thread state definitions from a modern release.

See: https://github.com/zephyrproject-rtos/zephyr/blob/8d202cb9485558b24310334ef000c171de94ff07/include/zephyr/kernel_structs.h#L51-L73

Also simplify the code by using a common class for most thread states.

Demonstration on samples/philosophers (tested on nucleo_l552ze_q, but other boards should work fine):

  • Before:
image
  • After:
image

Note

When the idle is not running, its status will be displayed as ??? because idle threads are special.
This edge could be handled but this would require more changes so I have not done it as part of this PR.

Update existing support for Zephyr RTOS to use
proper thread state definitions from a modern
release.

Also simplify the code by using a common class
for most thread states.

Signed-off-by: Mathieu Choplain <[email protected]>
Comment on lines +438 to +442
/**
* NOTE: the base.thread_state bit _THREAD_QUEUED
* is NOT cleared on the thread that is currently
* running if Zephyr is built without SMP support.
*/
Copy link
Contributor Author

Choose a reason for hiding this comment

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

See: https://github.com/zephyrproject-rtos/zephyr/blob/8d202cb9485558b24310334ef000c171de94ff07/kernel/sched.c#L186-L194

I'm not sure whether this will be important at any point, but it puzzled me for quite a while as I was expecting running threads to not have this bit set, so it is best to have the comment and save headaches for the next person to edit this.

@haneefdm haneefdm merged commit 4c2c1fa into mcu-debug:main Oct 14, 2025
3 checks passed
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.

2 participants