zephyrproject-rtos / zephyr

Primary Git Repository for the Zephyr Project. Zephyr is a new generation, scalable, optimized, secure RTOS for multiple hardware architectures.
https://docs.zephyrproject.org
Apache License 2.0
10.51k stars 6.44k forks source link

smf: state history tracking #77768

Open brandon-exact opened 2 weeks ago

brandon-exact commented 2 weeks ago

Is your feature request related to a problem? Please describe.

Add a optional feature to SMF that tracks a history of states and its reason for transition. Add a shell command to dump the history to console in a nice way. It should be implemented in a way so it can be useful in a coredump

Describe the solution you'd like

One idea would be to add a ring buffer of size N to struct smf_ctx that has the new state and the reason it transitioned. The ring buffer would be of a type with:

keith-zephyr commented 2 weeks ago

There was a previous effort to add some tracing https://github.com/zephyrproject-rtos/zephyr/pull/52161 to the SMF.

However, that specific proposal was rejected as it did not use Zephyr's existing tracing framework.

@wysman - did you make any progress with converting your SMF specific tracing mechanism to Zephyr's tracing framework?