cmake: Omit default priority ELF symbol.

nuttx_add_application() encoded SCHED_PRIORITY_DEFAULT as a zero-valued nx_priority linker symbol. A zero priority is invalid for a runnable ELF application task.

Do not emit nx_priority for the symbolic default. When the symbol is absent, the ELF loader retains its scheduler default. Continue emitting nx_priority for explicit numeric priorities.

Companion to apache/nuttx-apps#3667.

Assisted-by: Zed:GPT-5.6 Terra

Signed-off-by: Marco Casaroli <marco.casaroli@gmail.com>
This commit is contained in:
Marco Casaroli 2026-07-27 03:49:01 +02:00 committed by Xiang Xiao
parent 7fc26fd50c
commit 7eb9bb0be6

View file

@ -153,10 +153,7 @@ function(nuttx_add_application)
set(SYMBOL_STACKSIZE $<$<NOT:$<BOOL:${USE_LINKER}>>:-Wl,>--defsym
nx_stacksize=${STACKSIZE})
endif()
if(PRIORITY)
if(PRIORITY STREQUAL "SCHED_PRIORITY_DEFAULT")
set(PRIORITY "0")
endif()
if(PRIORITY AND NOT PRIORITY STREQUAL "SCHED_PRIORITY_DEFAULT")
set(SYMBOL_PRIORITY $<$<NOT:$<BOOL:${USE_LINKER}>>:-Wl,>--defsym
nx_priority=${PRIORITY})
endif()