Skip to content

examples/hello: Build a loadable module for "m" in CMake. - #3883

Merged
acassis merged 1 commit into
apache:masterfrom
casaroli:cmake-hello-module
Oct 20, 2026
Merged

acassis merged 1 commit into
apache:masterfrom
casaroli:cmake-hello-module

Conversation

@casaroli

Copy link
Copy Markdown
Contributor

Summary

With CONFIG_EXAMPLES_HELLO=m, the Make build makes hello a loadable module (MODULE = $(CONFIG_EXAMPLES_HELLO) in the Makefile). examples/hello/CMakeLists.txt does not give MODULE to nuttx_add_application(), so the CMake build makes no program at all: hello is not built in, and there is no bin/hello (nsh: hello: command not found).

This PR gives MODULE ${CONFIG_EXAMPLES_HELLO} to both nuttx_add_application() calls, as the other examples do.

Impact

CMake builds with CONFIG_EXAMPLES_HELLO=m: bin/hello is now a loadable module. No change for y.

Testing

qemu-armv8a:nsh (flat, CMake, QEMU HVF) with CONFIG_ELF, CONFIG_EXECFUNCS_SYSTEM_SYMTAB and CONFIG_EXAMPLES_HELLO=m, bin/ loaded from a 9p share:

master this PR
bin/hello not built; nsh: hello: command not found built; Hello, World!!

The test needs apache/nuttx#20807 (get_environ_ptr in libc.csv) to load any ELF program with the system symbol table.

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

With CONFIG_EXAMPLES_HELLO=m, the Make build makes hello a loadable
module (MODULE = $(CONFIG_EXAMPLES_HELLO) in the Makefile).  The
CMakeLists.txt does not give MODULE to nuttx_add_application(), so the
CMake build makes no program at all: hello is not built in, and there
is no bin/hello.

Give MODULE ${CONFIG_EXAMPLES_HELLO} to both nuttx_add_application()
calls, as the other examples do.

Assisted-by: Claude Code:claude-opus-5-5
Signed-off-by: Marco Casaroli <[email protected]>

@cederom cederom 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.

Thank you @casaroli :-)

@acassis
acassis merged commit 37080d4 into apache:master Oct 20, 2026
41 checks passed
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.

4 participants