yangsong8-a1 opened a new pull request, #18244:
URL: https://github.com/apache/nuttx/pull/18244
## Summary
This PR introduces a comprehensive safety driver module:
1. **Safety Upper-Half Driver**: A new generic safety module driver that
supports multiple safety monitoring functions:
- Clock monitoring
- Power monitoring
- Memory (RAM/ROM) monitoring
- Bus monitoring
- Temperature monitoring
- Register monitoring
- CPU monitoring
- MPU monitoring
2. **Register Monitor Module**: A specialized register monitoring component
that continuously monitors hardware registers for anomalies and corruption,
improving system reliability in multi-core environments.
3. **Coverity Fixes**: Multiple code quality improvements including:
- Single entry/exit point functions for better flow control
- Proper type conversions for unsigned long to pointer handling
- Symbol scope optimization
- Data type conversion improvements
- Mutex unlock issue fixes
## Impact
- **Stability**: Improved system stability through continuous hardware
monitoring
- **Reliability**: Better detection and handling of register corruption in
multi-core systems
- **Compatibility**: No breaking changes, fully backward compatible
## Testing
### Test Environment
- Host: ubuntu
- Devices: qemu and local tc4dx evb board
- Configuration: CONFIG_SAFETY and CONFIG_SAFETY_REGISTER_MONITOR enabled
### Test Steps
1. Enable safety module in menuconfig: `CONFIG_SAFETY=y`
2. Enable register monitor: `CONFIG_SAFETY_REGISTER_MONITOR=y`
3. call reg_monitor_initialize when initialize to register node.
4. Compile NuttX kernel
5. Test safety monitoring via ioctl and poll operations
[hello_main.c](https://github.com/user-attachments/files/24911134/hello_main.c)
### Test Results
```
nsh> safety_ctl
please input para:
1: test open and close
2: test read fail
3: test selftest
4: test inject and safety_handler
5: test poll
6: test hardware safe state
nsh> safety_ctl 1
-----test open close success----
nsh> safety_ctl 2
ret: -1, result.type: 0x0
-----can not read any result----
nsh> safety_ctl 3
ret: -1, result.type: 0x0
-----success: can not find any failed----
nsh> safety_ctl 4
ret: 2, result.type: 0x1
-----rewrite operation success----
nsh> safety_ctl 5
ret: 2, result.type: 0x1
-----rewrite operation success----
-----test poll finish----
nsh> safety_ctl 6
-----Register modification detected, rewrite successful.----
nsh> safety_ctl 2
ret: 2, result.type: 0x1
nsh>
```
--
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]