Repository navigation
Conversation
|
| config DISABLE_ALL_SIGNALS | ||
| bool "Disable all signal support" | ||
| select DISABLE_POSIX_TIMERS | ||
| select DISABLE_MQUEUE_NOTIFICATION |
There was a problem hiding this comment.
let change select to depend on
There was a problem hiding this comment.
move to new pr, don't mix the different fix in one pr
There was a problem hiding this comment.
It is encountered here when using DEFAULT_SMALL with DISABLE_ALL_SIGNALS, otherwise I wont see it. Since it is already a separate commit, what is the additional benefit of an extra PR?
3496698 to
f5b1b3e
Compare
f5b1b3e to
b8d9d5a
Compare
casaroli
left a comment
There was a problem hiding this comment.
Commit "math32.h: fix CI errors" fixes code from "libc: use div64_const for non-64bit".
Fix: squash it into that commit and keep wangzhi16's Signed-off-by.
No test prints numbers, so the ffs() error was not seen.
Fix: add a log that prints 0, 9, 10, 16 and UINT64_MAX with %llo, %llu and %llx on a 32-bit target.
b8d9d5a to
29249fe
Compare
2f97d4a to
420351f
Compare
|
@yf13 |
|
@yf13 correction to my earlier comment: I measured it, and excluding AVR would be a regression, Head 5c3a8e0 (commits 07c63f2, 0e1276e, 5c3a8e0 cherry-picked onto master 3122150),
Even though __ultoa_invert still calls __udivdi3 on AVR (the div64_const path doesn't fully so i guess we should avr enabled |
casaroli
left a comment
There was a problem hiding this comment.
The PR conflicts with master in boards/arm/stm32f3/stm32f334-disco/configs/buckboost/defconfig (aed8c30 removed CONFIG_ARCH_STACKDUMP there). On current master, buckboost links with the other commits of this PR and without CONFIG_LTO_FULL: 64096 of 65536 bytes with GCC 13.2. That commit also adds CONFIG_BASE_DEFCONFIG, which no defconfig on master has.
Fix: drop "stm32f334-disco/buckboost: turn on LTO_FULL", rebase, and correct the subject "compler.h" to "include/nuttx/compiler.h".
Note for Marco: a COMMENT review does not clear our CHANGES_REQUESTED. To unblock it: approve after the rebase
(the rebase dismisses all approvals anyway), or dismiss our 10-28 review now. Resolve our fixed threads
(clock.h, lib_ultoa_invert.c:77, compiler.h:663) when posting.
This fixes Kconfig error when using DISABLE_ALL_SIGNALS together w/ DEFAULT_SMALL: ``` warning: DISABLE_MQUEUE_NOTIFICATION (defined at sched/Kconfig:1827) has direct dependencies !DISABLE_MQUEUE || !DISABLE_MQUEUE_SYSV with value n, but is currently being y-selected by the following symbols: - DISABLE_ALL_SIGNALS (defined at sched/Kconfig:1642) ``` Signed-off-by: Yanfeng Liu <[email protected]>
This fixes nxtyle issue in lib_ultoa_invert.c Signed-off-by: Yanfeng Liu <[email protected]>
This adds MSEC2TICK32 marco to fix build errors like: ``` error: braced-group within expression allowed only inside a function 92 | .ddelay = MSEC2TICK(CONFIG_FRDMK28F_SDHC_AUTOMOUNT_DDELAY), ``` when MSEC2TICK uses expression statement which is only for use in functions. Signed-off-by: Yanfeng Liu <[email protected]>
|
Hi @yf13 — I reviewed #20996 after receiving feedback on #21214. Our changes overlap significantly in
Would you be open to integrating these approaches into #20996 while retaining your I'm happy to port and test the changes, including the size-sensitive configurations flagged by @casaroli. |
This enables LTO_FULL to reduce flash usage Signed-off-by: Yanfeng Liu <[email protected]>
This defines CONFIG_HAVE_EXPRESSION_STATEMENT for 32bit device using __GNUC__ and DEBUG_FULLOPT to enable div64_const. This is disabled for some archs for now. Signed-off-by: Yanfeng Liu <[email protected]>
This adds type casting for result of div_const() macro. Signed-off-by: Yanfeng Liu <[email protected]>
This enables use of div_const for non-64bit devices to avoid
pulling in 64bit divide libraries in toolchain.
Checked on Ubuntu 22 with local small config rv-virt:hello:
```sh
$ size -G nuttx ../orig/nuttx
text data bss total filename
23364 964 3760 28088 nuttx
24492 868 3760 29120 ../orig/nuttx
$ qemu-system-riscv32 -M virt,aclint=on -semihosting -nographic -bios nuttx
Hello, World!!
0 11 12 20 1777777777777777777777
0 9 10 16 18446744073709551615
0 9 a 10 ffffffffffffffff
```
And local small stm32f103-minimum:hello (compile only):
```sh
$ size -G nuttx ../orig/nuttx
text data bss total filename
18061 248 1680 19989 nuttx
18713 256 1680 20649 ../bbb/nuttx
```
Signed-off-by: Yanfeng Liu <[email protected]>
|
@arnavsharma990, per my test with rv32, using macro saves more than inline function, that is why I stopped using inline. The quoted Linux comment above also says that inline func isnt doing better than macro. Maybe you can double check if it is the same for your target. |
5c3a8e0 to
c2bd2c7
Compare
|
Thanks for explaining @yf13 , |
| #define NSEC2TICK(nsec) div_const_roundup(nsec, NSEC_PER_TICK) | ||
| #define USEC2TICK(usec) div_const_roundup(usec, USEC_PER_TICK) | ||
|
|
||
| #define div_roundup32(n, b) (((n) + (b) - 1) / (b)) |
There was a problem hiding this comment.
It is here because it is only for MSEC2TICK32 below to use.
Let me know if there is better place for it.
There was a problem hiding this comment.
look where we put div_roundup
| #if defined(CONFIG_DEBUG_FULLOPT) && !defined(CONFIG_ARCH_64BIT) && \ | ||
| !defined(CONFIG_ARCH_RENESAS) && !defined(CONFIG_ARCH_XTENSA) && \ | ||
| !defined(CONFIG_ARCH_SPARC) | ||
| # define CONFIG_HAVE_EXPRESSION_STATEMENT 1 |
There was a problem hiding this comment.
expression statement is compiler property why check CONFIG_DEBUG_FULLOPT/CONFIG_ARCH_xxx
There was a problem hiding this comment.
The div64_const optimization doesnt work when -O0 is used. Also it increases sizes for 64bit. The disabled archs showed size growth before in membrowse so they are disabled for now.
| { | ||
| int v; | ||
|
|
||
| #if defined(CONFIG_HAVE_EXPRESSION_STATEMENT) |
casaroli
left a comment
There was a problem hiding this comment.
rv-virt:nsh grows by 802 bytes of text with this PR (229998 to 230800, gcc 14.3, DEBUG_FULLOPT). div_const now expands inline in oneshot_callback (+192), timer_settime (+182), nxsig_clockwait (+112), up_alarm_set_lowerhalf (+98) and sysinfo (+92), and libgcc does not shrink on this target. On Cortex-M3 the same PR saves 912 bytes.
Fix: state the growth in the PR text, or apply the macro change only where it removes the libgcc division.
|
@Fix-Point will work on these patches in the upcoming day. |
|
let continue on #21491 |
Summary
This tries to help issues/20414 by enabling
div64_constin math32.h for 32-bit devices, asdiv64_constuses multiply operations to avoid compiler's 64bit dividing library when divisor is constant.The macro exists in math32.h for time but not enabled. This enables it selectively by adding the missed
CONFIG_HAVE_EXPRESSION_STATEMENTincompliler.hfor selected optimization and archs.Note if 64bit divisor library is unavoidable (e.g.
stm32f334-disco/buckboost), this method doesnt help.Impact
It enables div64_const() macro in math32.h, and uses it for lib_ultoa_invert.c to drop the dependency to 64bit divide library functions. Some MemBrowse result shall show reduced flash usage.
Testing
Checked on Ubuntu 22 with local small config rv-virt:hello with stock riscv64-unknown-elf 10.2:
$ size -G nuttx ../orig/nuttx text data bss total filename 23364 964 3760 28088 nuttx 24492 868 3760 29120 ../orig/nuttx $ qemu-system-riscv32 -M virt,aclint=on -semihosting -nographic -bios nuttx Hello, World!! 0 11 12 20 1777777777777777777777 0 9 10 16 18446744073709551615 0 9 a 10 ffffffffffffffffAnd local small stm32f103-minimum:hello (compile only) with stock arm-none-eabi-gcc 10.3.1 :