nuttx-apps/system/uorb/Kconfig
Felipe Moura 34ca2a5ed8 system/uorb: bump listener stack when float print extension is on
uorb_listener's %pB debug printing (orb_info() -> lib_bsprintf()) does
real floating-point-to-string conversion synchronously, in the
listener's own task -- not a lightweight pointer dump. With
CONFIG_LIBC_PRINT_EXTENSION off, %pB just prints a raw pointer and the
default CONFIG_UORB_STACKSIZE (DEFAULT_TASK_STACKSIZE, 2048 on most
configs) is plenty. With it on, decoding a topic's float fields through
this path silently overflows a 2048-byte stack -- confirmed on real
hardware (ESP32-S3, one push every ~10-20ms from two subscribed
topics): uorb_listener hangs completely after printing only a partial
topic name, no panic, no stack dump, nothing -- because
CONFIG_SCHED_STACKGUARD/CONFIG_STACK_COLORATION aren't on by default
either, so there's no guard to catch the overflow before it corrupts
adjacent memory.

Raising the default only when CONFIG_LIBC_PRINT_EXTENSION is set (not
unconditionally, and not keyed off CONFIG_DEBUG_UORB specifically,
since anything else that selects the same libc extension hits the same
path) keeps the common case -- raw pointer output, small stack --
exactly as before, and only pays for the extra stack when the feature
that needs it is actually enabled.

4096 was verified sufficient (tested against 2048, which reproduces
the hang, and 8192, which also works but wastes RAM); reproduced
cleanly across multiple fresh boots.

Note: this default only applies when CONFIG_UORB_STACKSIZE has never
been explicitly recorded in .config. Like any Kconfig int default,
flipping CONFIG_LIBC_PRINT_EXTENSION on in an existing .config that
already has an explicit CONFIG_UORB_STACKSIZE value won't retroactively
raise it; the value has to be re-picked (e.g. via a fresh olddefconfig
after removing the stale line, or manually).

Signed-off-by: Felipe Moura <moura.fmo@gmail.com>
2026-09-22 14:44:19 +08:00

85 lines
1.4 KiB
Text

#
# For a description of the syntax of this configuration file,
# see the file kconfig-language.txt in the NuttX tools repository.
#
menuconfig UORB
tristate "uorb(micro object request broker)"
depends on SENSORS && USENSOR
default n
if UORB
config UORB_PRIORITY
int "task priority"
default 100
config UORB_STACKSIZE
int "stack size"
default 4096 if LIBC_PRINT_EXTENSION
default DEFAULT_TASK_STACKSIZE
config UORB_FORMAT
bool
select LIBC_PRINT_EXTENSION
default n
config UORB_LISTENER
bool "uorb listener"
select UORB_FORMAT
default n
config UORB_GENERATOR
bool "uorb generator"
select UORB_FORMAT
default n
config UORB_TESTS
bool "uorb unit tests"
default n
config UORB_LOOP_MAX_EVENTS
int "uorb loop max events"
depends on EVENT_FD
default 0
if UORB_TESTS
config UORB_STORAGE_DIR
string "uorb test result storage dir"
default "/data/"
endif # UORB_TESTS
config DEBUG_UORB
bool "uorb debug output"
select LIBC_PRINT_EXTENSION
select UORB_FORMAT
depends on LIBC_FLOATINGPOINT && SENSORS_USE_FLOAT
default n
if DEBUG_UORB
config UORB_ALERT
bool "uorb panic output"
default n
depends on DEBUG_ALERT
config UORB_ERROR
bool "uorb error output"
default n
depends on DEBUG_ERROR
config UORB_WARN
bool "uorb warn output"
default n
depends on DEBUG_WARN
config UORB_INFO
bool "uorb info output"
default n
depends on DEBUG_INFO
endif # DEBUG_UORB
endif # UORB