nuttx/binfmt
Marco Casaroli a85f2dfa1b binfmt/elf: treat nx_priority == 0 as "use the default"
apps/Application.mk stamps each program's configured priority into its ELF
as an absolute nx_priority symbol, and encodes PRIORITY =
SCHED_PRIORITY_DEFAULT as zero:

  SYM_PRIORITY = $(if $(filter SCHED_PRIORITY_DEFAULT,$(PRIORITY_$@)),0,\
                   $(PRIORITY_$@))

elf_loadbinary() took that literally, so any program whose Makefile
declares SCHED_PRIORITY_DEFAULT -- testing/ostest, among others -- was
created at priority 0.  That ties with the idle task, and the new task is
queued behind it, so it never runs.

The failure gives nothing to go on: the loader reports success, the task
appears in the task list as READY-TO-RUN, and the program never executes
an instruction.  Found on an ESP32-S3 BUILD_KERNEL target where ostest
loaded and then sat with sched_priority=0 behind Idle_Task in
g_readytorun across repeated JTAG samples, while programs with explicit
numeric priorities (nsh=100, getprime=50) ran normally.

Signed-off-by: Marco Casaroli <marco.casaroli@gmail.com>

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-25 20:53:43 +02:00
..
libnxflat include/debug.h: Move to include/nuttx/debug.h 2026-04-07 07:50:06 -03:00
binfmt.h fs/binfmt: Enforce POSIX execute permissions prior to binary load 2026-06-13 21:07:01 +08:00
binfmt_checkexec.c fs/binfmt: Enforce POSIX execute permissions prior to binary load 2026-06-13 21:07:01 +08:00
binfmt_copyactions.c include/debug.h: Move to include/nuttx/debug.h 2026-04-07 07:50:06 -03:00
binfmt_copyargv.c include/debug.h: Move to include/nuttx/debug.h 2026-04-07 07:50:06 -03:00
binfmt_dumpmodule.c include/debug.h: Move to include/nuttx/debug.h 2026-04-07 07:50:06 -03:00
binfmt_exec.c fs/binfmt: Enforce POSIX execute permissions prior to binary load 2026-06-13 21:07:01 +08:00
binfmt_execmodule.c include/debug.h: Move to include/nuttx/debug.h 2026-04-07 07:50:06 -03:00
binfmt_execsymtab.c sched: binfmt remove csection 2026-01-11 20:44:35 +08:00
binfmt_exit.c include/debug.h: Move to include/nuttx/debug.h 2026-04-07 07:50:06 -03:00
binfmt_globals.c binfmt: migrate to SPDX identifier 2024-09-10 11:34:18 +08:00
binfmt_initialize.c include/debug.h: Move to include/nuttx/debug.h 2026-04-07 07:50:06 -03:00
binfmt_loadmodule.c fs/binfmt: Enforce POSIX execute permissions prior to binary load 2026-06-13 21:07:01 +08:00
binfmt_register.c include/debug.h: Move to include/nuttx/debug.h 2026-04-07 07:50:06 -03:00
binfmt_unloadmodule.c include/debug.h: Move to include/nuttx/debug.h 2026-04-07 07:50:06 -03:00
binfmt_unregister.c include/debug.h: Move to include/nuttx/debug.h 2026-04-07 07:50:06 -03:00
builtin.c fs/binfmt: Enforce POSIX execute permissions prior to binary load 2026-06-13 21:07:01 +08:00
CMakeLists.txt fs/binfmt: Enforce POSIX execute permissions prior to binary load 2026-06-13 21:07:01 +08:00
elf.c binfmt/elf: treat nx_priority == 0 as "use the default" 2026-07-25 20:53:43 +02:00
Kconfig binfmt: Add a configuration flag to store the module filename 2025-11-01 22:59:47 +08:00
Makefile fs/binfmt: Enforce POSIX execute permissions prior to binary load 2026-06-13 21:07:01 +08:00
nxflat.c fs/binfmt: Enforce POSIX execute permissions prior to binary load 2026-06-13 21:07:01 +08:00