nuttx-apps/examples/fdpicxip/Kconfig
Marco Casaroli 859c014d4d examples/fdpicxip: Demonstrate FDPIC modules executed in place.
The FDPIC counterpart of examples/nxflatxip, kept separate from it: that
example is about NXFLAT, and mixing the two module formats into one program
would leave neither demonstrating anything clearly.

Four subcommands, each showing one property of the loader.  'qsort' is the
simplest case it has -- one self-contained module, two concurrent instances,
one shared copy of the text in flash and a private copy of the data each,
with the pin count showing the extent held in place while they run and
released after.  'solib' adds a shared library, so two objects are mapped
and each instance still gets its own copy of both objects' data.  'cxx' is
the same in C++, which additionally requires global constructors to have run
in dependency order before main.  'jmprel' is a module whose imports are all
in DT_JMPREL rather than DT_REL.

The modules are embedded as headers rather than built as part of the app:
linking one needs arm-uclinuxfdpiceabi binutils, which the tree does not
require, so the headers are committed and both this example and
testing/fs/xipfs build with a plain toolchain.

Their sources are in modules/, with a makefile that rebuilds every header
from them on an explicit 'make regen NUTTX_DIR=...' and is never invoked by
the application build.  It drives nuttx/tools/fdpic and writes the headers
this example needs alongside the ones testing/fs/xipfs needs, so one source
tree serves both and the two cannot drift apart.  CPU is cortex-m3 there
deliberately: a v7-M module runs on the v8-M targets too, so one set of blobs
serves both the RP2350 and mps2-an500, while a cortex-m33 build produces
blobs the Cortex-M7 cannot execute at all.

This demonstrates; it does not assert.  The assertions are in the fdpic and
reject sections of apps/testing/fs/xipfs.

Verified on a Pimoroni Pico Plus 2: all four subcommands, and nxflatxip
unaffected alongside them.  Also verified on mps2-an500 under QEMU, which is
a Cortex-M7 -- a different core generation from the RP2350's Cortex-M33.

Assisted-by: Claude Code:claude-opus-5
Signed-off-by: Marco Casaroli <marco.casaroli@gmail.com>
2026-07-31 18:47:17 -03:00

39 lines
1.2 KiB
Text

#
# For a description of the syntax of this configuration file,
# see the file kconfig-language.txt in the NuttX tools repository.
#
config EXAMPLES_FDPICXIP
tristate "FDPIC modules executed in place from xipfs demo"
depends on FS_XIPFS && FDPIC && LIBC_EXECFUNCS
default n
---help---
Write FDPIC modules into xipfs at run time, the way a download
would, then run them. Their text is executed directly out of
flash and shared between concurrent instances, while each
instance gets its own data.
Subcommands:
qsort one self-contained module, two instances
solib a shared library across two instances
cxx the same in C++, checking global constructors ran
jmprel a module whose imports are all in DT_JMPREL
With no subcommand, qsort runs.
The modules are embedded in the image as C headers. Their
sources are in modules/, which rebuilds the headers on an
explicit 'make regen': linking one needs arm-uclinuxfdpiceabi
binutils, which this build does not.
This demonstrates; it does not assert. For the assertions see
the fdpic and reject sections of CONFIG_TESTING_FS_XIPFS.
if EXAMPLES_FDPICXIP
config EXAMPLES_FDPICXIP_MOUNTPT
string "xipfs mountpoint"
default "/mnt/xipfs"
endif # EXAMPLES_FDPICXIP