Skip to content

examples/fdpicxip: Build the module fixtures without nuttx/tools/fdpic. - #3762

Open
casaroli wants to merge 1 commit into
apache:masterfrom
casaroli:fdpicxip-in-tree
Open

casaroli wants to merge 1 commit into
apache:masterfrom
casaroli:fdpicxip-in-tree

Conversation

@casaroli

@casaroli casaroli commented Aug 28, 2026 •

Copy link
Copy Markdown
Contributor

Summary

The FDPIC fixtures this example and testing/fs/xipfs carry were built by an explicit make regen that reached into nuttx/tools/fdpic. Review of apache/nuttx#19940 asked that NuttX not carry a module build of its own, so the build moves here, beside the sources it builds.

They keep a build of their own because they are loader edge cases, not ordinary modules: a library with a SONAME, a module with more DT_NEEDED entries than the loader will follow, one whose imports stay in the lazy binding table, and one naming a symbol the firmware does not export. Application.mk cannot say -soname, or "no entry point", or "link against that other module".

The build uses the configured tree's module flags (CMODULEFLAGS, CXXMODULEFLAGS, LDMODULEFLAGS), linker script and crt0 source. Three things are pinned so the committed headers do not depend on how the tree is configured: the CPU (cortex-m3, so one set of headers runs on v7-M and v8-M), no debug information, and -Os. A library is compiled with default visibility, because the module flags hide every symbol and a library must export its functions.

fdpic-embed.py becomes xxd and a template. fdpic-verify.sh and nuttx-exports.sh go with no replacement: they checked at build time what the xipfs suite already asserts at run time.

depends-on: apache/nuttx/pull/20388
depends-on: apache/nuttx/pull/20368

Impact

make regen is not part of the application build, and the *_bin.h headers stay committed, so both apps still build with a plain toolchain and no FDPIC linker.

The headers are regenerated here. A fixture now starts in the tree's crt0, which needs apache/nuttx#20388 to run its constructors under FDPIC, and the library fixtures need apache/nuttx#20368. NUTTX_DIR has to be configured with CONFIG_FDPIC, and CONFIG_HAVE_CXXINITIALIZE decides whether crt0 runs constructors, so the headers were generated with it on.

Testing

mps2-an500:xipfs with CONFIG_FDPIC under QEMU, xipfs_test fdpic:

nuttx fixtures result
master apps master 28 passed, 6 failed
master + #20388 + #20368 apps master 32 passed, 2 failed
master + #20388 + #20368 this PR 34 passed, 0 failed

Regenerating against a tree configured with CONFIG_DEBUG_NOOPT and against one with CONFIG_DEBUG_FULLOPT gives byte for byte the same headers.

tools/checkpatch.sh -c -u -m -g passes.

@github-actions

Copy link
Copy Markdown

🔗 Cross-repo PR dependencies

The read-only Build run reported the following dependent PR(s) and fetched head SHA(s):

CI run: https://github.com/apache/nuttx-apps/actions/runs/33193062300

Comment thread examples/fdpicxip/modules/Makefile Outdated
Comment thread examples/fdpicxip/modules/Makefile Outdated
acassis
acassis previously approved these changes Sep 8, 2026

@acassis acassis left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@casaroli please include the CMakefile.txt too

@casaroli
casaroli force-pushed the fdpicxip-in-tree branch 2 times, most recently from 2c01062 to 68ddc94 Compare September 8, 2026 20:37
@casaroli

casaroli commented Sep 8, 2026

Copy link
Copy Markdown
Contributor Author

@casaroli please include the CMakefile.txt too

Done

acassis
acassis previously approved these changes Sep 8, 2026
@github-actions

github-actions Bot commented Sep 9, 2026

Copy link
Copy Markdown

🔗 Cross-repo PR dependencies

The read-only Build run reported the following dependent PR(s) and fetched head SHA(s):

CI run: https://github.com/apache/nuttx-apps/actions/runs/34276056553

Comment thread testing/fs/xipfs/missingsym_bin.h
Comment thread examples/fdpicxip/modules/Makefile
@github-actions

Copy link
Copy Markdown

🔗 Cross-repo PR dependencies

The read-only Build run reported the following dependent PR(s) and fetched head SHA(s):

CI run: https://github.com/apache/nuttx-apps/actions/runs/36120398868

The fixtures were built by makefiles and scripts in nuttx/tools/fdpic.
Review of apache/nuttx#19940 asked that NuttX not carry a module build
of its own, so the build moves here, beside the sources it builds.

They keep a build of their own because they are loader edge cases: a
library with a SONAME, a module with more DT_NEEDED entries than the
loader follows, one whose imports stay in the lazy binding table, and
one naming a symbol the firmware does not export.  Application.mk cannot
say any of that.

The build uses the configured tree's module flags (CMODULEFLAGS,
CXXMODULEFLAGS, LDMODULEFLAGS), linker script and crt0 source.  Three
things are pinned instead, so that the committed headers do not depend
on how the tree is configured: the CPU (cortex-m3, so one set of headers
runs on both v7-M and v8-M), no debug information, and -Os.  A library
is compiled with default visibility, because the module flags hide every
symbol and a library must export its functions.

fdpic-embed.py becomes xxd and a template.  fdpic-verify.sh and
nuttx-exports.sh go with no replacement: they checked at build time what
the xipfs suite already asserts at run time.

The headers are regenerated, and the .fdpic suffix is gone: a module is
named like any other module.  A fixture now starts in the tree's crt0,
which needs apache/nuttx#20388 to run its constructors, and the library
fixtures need apache/nuttx#20368.

Assisted-by: Claude Code:claude-opus-5-5
Signed-off-by: Marco Casaroli <marco.casaroli@gmail.com>
@github-actions

Copy link
Copy Markdown

🔗 Cross-repo PR dependencies

The read-only Build run reported the following dependent PR(s) and fetched head SHA(s):

CI run: https://github.com/apache/nuttx-apps/actions/runs/36467652465

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants