Skip to content

graphics/microwindows: add Nano-X client/server support and examples for NuttX - #3689

Open
Acfboy wants to merge 6 commits into
apache:masterfrom
Acfboy:add-microwindows
Open

graphics/microwindows: add Nano-X client/server support and examples for NuttX#3689
Acfboy wants to merge 6 commits into
apache:masterfrom
Acfboy:add-microwindows

Conversation

@Acfboy

@Acfboy Acfboy commented Aug 1, 2026

Copy link
Copy Markdown
Contributor

Summary

This PR ports the Nano-X windowing system from Microwindows to NuttX so that X11-style client/server applications can run in a flat build. It contains three logical parts:

  • graphics/microwindows: Build the Nano-X client library and server from the bundled Microwindows tree. Add:
    • MICROWINDOWS_NANOX to enable Nano-X client/server support.
    • MICROWINDOWS_NANOX_NANOWM to optionally link the Microwindows window manager into the server.
    • MICROWINDOWS_NANOX_NONETWORK to link clients directly with the server without sockets or the network stack.
    • Export Microwindows public headers through EXPORTED_INCLUDES.
  • examples/nanoxcalc: Port the nxcalc demo. It connects to the running Nano-X server and displays a calculator keypad.
  • examples/nanoxterm: Port the nxterm demo. It creates a pseudo-terminal and starts the configured NSH program in the child with posix_spawn() instead of relying on /bin/sh, since flat builds have no filesystem binaries. In network mode, it starts the Nano-X server as a separate task before connecting. It can therefore be used as the init entry point: booting sim:nanox opens the nxterm window directly, and typing nanoxcalc in it opens the calculator.

Impact

Testing

  • Build host: Linux x86_64 with the GNU toolchain.
  • Target: qemu-intel64:nanox, flat build.
  • Run the following commands from the directory containing the nuttx repository:
cd nuttx
make distclean
./tools/configure.sh qemu-intel64:nanox
make -j$(nproc)
  • Follow the document to make the iso and then run it in qemu:
cp nuttx iso/boot/nuttx.elf
grub-mkrescue -o boot_nanox.iso iso
qemu-system-x86_64 -cpu host -enable-kvm -m 2G -cdrom boot_nanox.iso -serial stdio -monitor none -no-reboot -device qemu-xhci -device usb-kbd -device usb-mouse
  • The build completed successfully.
  • QEMU booted directly into nanoxterm.
  • The NSH terminal was usable, and running nanoxcalc opened the calculator window.

@cederom

cederom commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

Thank you @Acfboy :-)

For sure we need a documentation for that part :-) I just did a rewrite of components / graphics / nx, so other gfx components are in one place, like framebuffer, and maybe nano-x, will push in a free moment this week :-)

@ppisa

ppisa commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

Great, I will look into patches soon. Do not forget to update Microwidows HASH in the graphics/microwindows/Makefile. The current master one could be

MICROWINDOWS_COMMIT_HASH := 2108675308cf69a5c1c54b483e29e3c039f319be

but you have pending changes so it would be ideal to change nuttx-apps one when mainline is updated.

PS: I will not be available next week/till August 23 night. I leave on this Friday or Saturday evening.

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

Generally looks OK for me, question is if we need to export

CFLAGS += -DNUTTX=1

from graphics/microwindows/Makefile to control microwindows/microwindows/src/mwin/winmain.c not use dragwp in

int poll = (!canBlock || dragwp); 

for NuttX.

Comment thread graphics/microwindows/Make.defs
Comment thread Makefile
@acassis

acassis commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

Hi @Acfboy do you have some new? The final evaluation will start in a few days. I think this is the only project that didn't integrate anything into NuttX mainline yet. @ppisa please help us.

Acfboy added 6 commits August 20, 2026 22:02
…support for NuttX

Build the Nano-X client library, server and (optional) built-in window manager
from the bundled Microwindows tree

Signed-off-by: Acfboy <AcfboyU@outlook.com>
* Port the nxcalc demo from Microwindows
* Connects to the Nano-X server started by examples/nanoxterm
* Requires CONFIG_LIBC_FLOATINGPOINT for the result formatting

Signed-off-by: Acfboy <AcfboyU@outlook.com>
* Port the nxterm demo from Microwindows
* Starts the Nano-X server as a separate task before connecting
* Runs an NSH shell instance on a pseudo terminal in the spwaned child
  instead of exec /bin/sh (no filesystem binaries in flat builds)

Assisted-by: OpenCode:DeepSeek-V4-Flash
Signed-off-by: Acfboy <AcfboyU@outlook.com>
…h the server

* Add CONFIG_MICROWINDOWS_NANOX_NONETWORK which builds the Nano-X
  client library and server in the linked-in (NONETWORK) mode, so
  client applications are linked directly with the server and run in
  the same task, requiring no network stack or socket at all
* Reorganize the source lists: the drawing sources (nxdraw, nxutil,
  nxtransform, nxpaintnc) are shared by both modes, while the server
  is built from srvnet.c in the network mode and srvnonet.c in the
  NONETWORK mode
* Use MULTITHREAD_SERVER in the network mode so that several client
  tasks can run at the same time in the flat build
* Let the examples/nanoxterm start the server task only in the
  network mode (NONETWORK applications run the server inside main)

Assisted-by: OpenCode:DeepSeek-V4-Flash
Signed-off-by: Acfboy <AcfboyU@outlook.com>
* Introduce EXPORTED_INCLUDES in apps/Make.defs; every entry is
  prefixed with INCDIR_PREFIX and added to CFLAGS/CXXFLAGS so it
  takes effect in the in-tree build as well
* The export target in apps/Makefile copies the content of the listed
  directories into the include directory of the export package, so
  out-of-tree applications built from the package can still find the
  public headers

Signed-off-by: Acfboy <AcfboyU@outlook.com>
registers microwindows/src/include through the EXPORTED_INCLUDES
 mechanism in its Make.defs

Signed-off-by: Acfboy <AcfboyU@outlook.com>
@Acfboy

Acfboy commented Aug 20, 2026

Copy link
Copy Markdown
Contributor Author

@acassis Sorry for my slow progress. It's now ready for review.

@acassis

acassis commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

@acassis Sorry for my slow progress. It's now ready for review.

@Acfboy no problem! Sorry for pushing, but I was really worried because we need it finished for your final evaluation.

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.

5 participants