apps/nshlib: Using lib_get_tempbuffer() to save stack space#2943
Conversation
Applications should not depend on any properties of nshlib Signed-off-by: chao an <anchao@lixiang.com>
LINE_MAX: apache/nuttx#15344 Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
|
[Experimental Bot, please feedback here] This PR description mostly meets the NuttX requirements but could be improved. Here's a breakdown: Strengths:
Weaknesses:
Suggested Improvements: Summary
Impact
TestingI confirm that changes are verified on local setup and works as intended:
Testing logs before change: Testing logs after change: Stack Usage Comparison: (Include your tables as before) CI Status: [Link to CI run] or "CI passed successfully." By making these improvements, the PR description will be clearer, more complete, and better aligned with the NuttX requirements. This will make it easier for reviewers to understand and approve the changes. |
|
@xiaoxiang781216 @anchao Could you review this PR please? |
|
TODO: Remove
|
c97e003 to
07f57b3
Compare
cederom
left a comment
There was a problem hiding this comment.
Thank you @JianyuWang0623 amazing work squeezing every bit and byte out of hw :-)
Lets just wait for the CI to complete test builds :-)
Comparison
Config: "esp32s3-devkit:adb" with `CONFIG_LINE_MAX=512`
Test CMD: `ls | cat | cat | cat`
Without this patch
| | Before Test CMD | After Test CMD |
|---------------:|----------------:|----------------:|
| nsh_main.STACK | 0002624/0008096 | 0002624/0008096 |
| sh.STACK | 0003360/0004008 | 0003360/0004008 |
| Free/Total | 355288/403116 | 355288/403116 |
With this patch
| | Before Test CMD | After Test CMD |
|---------------:|----------------:|----------------:|
| nsh_main.STACK | 0001616/0008096 | 0001616/0008096 |
| sh.STACK | 0002352/0004008 | 0002352/0004008 |
| Free/Total | 355288/403116 | 354760/403116 |
Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
07f57b3 to
a2c74cf
Compare
Details: apache/nuttx-apps#2943 Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
Details: apache/nuttx-apps#2943 1. find boards/ -name defconfig | xargs sed -i 's/CONFIG_NSH_LINELEN/CONFIG_LINE_MAX/g' 2. ./tools/refresh.sh --silent --defaults all Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
Details: apache/nuttx-apps#2943 1. find boards/ -name defconfig | xargs sed -i 's/CONFIG_NSH_LINELEN/CONFIG_LINE_MAX/g' 2. ./tools/refresh.sh --silent --defaults all Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
apache/nuttx#15541 apache#2943 Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
apache#15541 apache/nuttx-apps#2943 Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
NSH_LINELEN is replaced by POSIX standard LINE_MAX. apache/nuttx#15541 apache#2943 Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
Details: apache/nuttx-apps#2943 1. find boards/ -name defconfig | xargs sed -i 's/CONFIG_NSH_LINELEN/CONFIG_LINE_MAX/g' 2. ./tools/refresh.sh --silent --defaults all Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
NSH_LINELEN is replaced by POSIX standard LINE_MAX. apache/nuttx#15541 #2943 Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
Details: apache/nuttx-apps#2943 1. find boards/ -name defconfig | xargs sed -i 's/CONFIG_NSH_LINELEN/CONFIG_LINE_MAX/g' 2. ./tools/refresh.sh --silent --defaults all Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
Details: apache/nuttx-apps#2943 1. find boards/ -name defconfig | xargs sed -i 's/CONFIG_NSH_LINELEN/CONFIG_LINE_MAX/g' 2. ./tools/refresh.sh --silent --defaults all Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
NSH_LINELEN is replaced by POSIX standard LINE_MAX. apache/nuttx#15541 apache/nuttx-apps#2943 Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
Details: apache/nuttx-apps#2943 1. find boards/ -name defconfig | xargs sed -i 's/CONFIG_NSH_LINELEN/CONFIG_LINE_MAX/g' 2. ./tools/refresh.sh --silent --defaults all Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
Details: apache/nuttx-apps#2943 1. find boards/ -name defconfig | xargs sed -i 's/CONFIG_NSH_LINELEN/CONFIG_LINE_MAX/g' 2. ./tools/refresh.sh --silent --defaults all Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
NSH_LINELEN is replaced by POSIX standard LINE_MAX. apache/nuttx#15541 apache/nuttx-apps#2943 Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
Details: apache/nuttx-apps#2943 1. find boards/ -name defconfig | xargs sed -i 's/CONFIG_NSH_LINELEN/CONFIG_LINE_MAX/g' 2. ./tools/refresh.sh --silent --defaults all Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
Details: apache/nuttx-apps#2943 1. find boards/ -name defconfig | xargs sed -i 's/CONFIG_NSH_LINELEN/CONFIG_LINE_MAX/g' 2. ./tools/refresh.sh --silent --defaults all Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
Summary
Using
lib_get_tempbuffer()to save stack spacelib_get_tempbuffer()to save stack spaceCONFIG_NSH_LINELENtoLINE_MAXCONFIG_NSH_LINELENtoLINE_MAX(Picked from apps/system: replace CONFIG_NSH_LINELEN to LINE_MAX #2918 by @anchao )Impact
Testing
Config: "esp32s3-devkit:adb" with
CONFIG_LINE_MAX=512Test CMD:
ls | cat | cat | catWithout this patch
With this patch