FelipeMdeO opened a new pull request, #3296:
URL: https://github.com/apache/nuttx-apps/pull/3296
Fixed build issues
Added example to demonstate state machine framework
Removed unused file
Improve code quality | Fix thread termination issue
*Note: Please adhere to [Contributing
Guidelines](https://github.com/apache/nuttx/blob/master/CONTRIBUTING.md).*
## Summary
This change adds the State Machine Framework (SMF) to nuttx-apps as a
self-contained, reusable library.
The SMF provides a deterministic framework for implementing flat and
hierarchical state machines, based on explicit entry, run, and exit actions.
Event handling and scheduling remain fully under application control.
The implementation is a port of the SMF originally introduced in the Zephyr
RTOS, adapted to NuttX coding conventions and build infrastructure. The
library
does not perform dynamic memory allocation and is intended to be used with
statically defined state tables.
An example application is included to demonstrate correct usage.
## Impact
- Adds a new optional library to nuttx-apps, enabled via Kconfig.
- No impact on existing applications when the feature is disabled.
- No changes to existing APIs or build configurations.
- No dynamic memory usage introduced.
- Architecture-independent and suitable for both hosted and embedded targets.
## Testing
The change was validated using the provided SMF hierarchical state machine
(HSM) example application. Example available in:
| Prompt: State Machine Framework PSICC2 demo (HSM)
│
│ Location:
│
│ -> Application Configuration
│
│ -> Examples
| -> State Machine Framework PSICC2 demo
Testing was performed by enabling the SMF configuration options and building
the example for the simulator target. The example demonstrates:
- Initialization of the state machine using smf_set_initial()
- Execution of flat and hierarchical states
- State transitions triggered from run actions
- Entry and exit action sequencing
- Graceful termination using smf_set_terminate()
The example was built and executed using the sim:nsh configuration. Runtime
output was manually verified to confirm correct state transitions and
expected
execution order.
No regressions were observed, and existing applications build and run
unchanged when SMF is not enabled.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]