JorgeGzm opened a new pull request, #19399:
URL: https://github.com/apache/nuttx/pull/19399
## Summary
The nsh `top` command exists since 2024 but was never documented.
- Add a `top` section to the NSH commands documentation page
(`Documentation/applications/nsh/commands.rst`): syntax, options,
example output and configuration dependencies.
- Add a `top` usage example to the linum-stm32h753bi board
documentation.
- Enable the command in the linum-stm32h753bi:nsh defconfig: procfs,
`SCHED_CPULOAD`, `STACK_COLORATION` and `TASK_NAME_SIZE`, so `top`
and `ps` are fully functional out of the box. This also configures a
dedicated interrupt stack and enlarges the IDLE/init task stacks:
with `SCHED_CPULOAD` the per-tick accounting runs in interrupt
context, and with `ARCH_INTERRUPTSTACK=0` it lands on the stack of
the interrupted task, overflowing the 1 KiB IDLE stack (~60% used at
rest) and corrupting the adjacent heap.
Companion PR (nshlib improvements shown in the examples):
https://github.com/apache/nuttx-apps/pull/3628
## Impact
- **User**: the `top` command is now discoverable in the documentation;
linum-stm32h753bi:nsh users get `top`/`ps` working out of the box.
- **Build**: none for the documentation. The defconfig adds procfs and
CPU load measurement to one board configuration (flash: ~186 KB,
1.7% SRAM on a 2 MB / 1 MB part).
- **Hardware**: linum-stm32h753bi only (defconfig change).
- **Documentation**: this PR is the documentation.
- **Compatibility**: none.
## Testing
- Documentation: `sphinx-build -b html` completes with no warnings on
the changed pages; new section renders at
`applications/nsh/commands.html#cmdtop`.
- Defconfig: `tools/configure.sh linum-stm32h753bi:nsh` from distclean
+ build, then verified on hardware:
```
nsh> top
top - up 00:00:19
Tasks: 2 total, 2 running, 0 sleeping
%Cpu(s): 8.1 busy, 91.9 idle
Mem : 1004876 total, 8140 used, 996736 free
TID PID PPID PRI POLICY TYPE NPX STATE EVENT SIGMASK
STACK USED FILLED CPU COMMAND
0 0 0 0 FIFO Kthread - Ready
0000000000000000 0002024 0000500 24.7% 91.8% Idle_Task
2 2 0 100 RR Task - Running
0000000000000000 0004048 0001952 48.2% 8.1% nsh_main
```
- Without the interrupt/IDLE stack changes, enabling `SCHED_CPULOAD`
on this board causes heap corruption and random asserts ("Stack
pointer is not within the stack") — reproduced and fixed on hardware.
- `tools/checkpatch.sh -g HEAD~1..HEAD`: all checks pass
--
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]