Skip to content

boards/spresense: Add the nxdoom configuration. - #20774

Merged
xiaoxiang781216 merged 2 commits into
apache:masterfrom
wwlapaki310:nxdoom-spresense
Oct 20, 2026
Merged

xiaoxiang781216 merged 2 commits into
apache:masterfrom
wwlapaki310:nxdoom-spresense

Conversation

@wwlapaki310

@wwlapaki310 wwlapaki310 commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Add a configuration that plays NXDoom on a Spresense with an ILI9340 display attached to the extension board, and document it.

Depends-On: apache/nuttx-apps/pull/3869

Please merge apache/nuttx-apps#3869 first. This configuration uses the option it adds (CONFIG_GAMES_NXDOOM_UARTKBD); without it the option is silently ignored and the game cannot be controlled.

Getting NXDoom to run on the Spresense took three steps:

  1. Run on the board (this pull request). The display is used as a frame buffer through CONFIG_LCD_FRAMEBUFFER at 320x240 in landscape; up_fbinitialize() already calls board_lcd_initialize(), so no driver code is needed. The WAD file is kept in the on-board SPI flash (/mnt/spif) and sent over the console with rz.
  2. Make it playable. The Spresense has no keyboard, so the keys are read from the serial console (CONFIG_GAMES_NXDOOM_UARTKBD, added to nuttx-apps by a separate pull request).
  3. Keep it from stopping. With 1.5 MB of RAM the game stopped after about a minute, when the screen wipe asked for two more 64000 byte buffers. The wipe can now be disabled (CONFIG_GAMES_NXDOOM_NOWIPE, added by the memory improvements in games/NXDoom: memory improvements nuttx-apps#3860, a separate pull request by another author that is already merged).

Other boards that play NXDoom, for example linum-stm32h753bi, have a keyboard driver and enough RAM, so they did not need steps 2 and 3.

The configuration is spresense:lcd plus the NXDoom settings, with the screen wipe disabled, the render buffer in .bss, and rz enabled. The console UART receive buffer is raised from 256 bytes to 8 KB, because the default overruns while rz writes to the flash. The rz error limit, buffer sizes and connect time were raised together with it when the transfer failed; I did not test which of these changes are strictly needed.

Documentation is in two commits: the serial terminal keys option on the NXDoom page, and the procedure (getting a WAD, sending it, starting the game) on the Spresense page.

Related nuttx-apps pull requests: serial terminal keys (apache/nuttx-apps#3869, not merged yet) and the memory improvements with the screen wipe option (apache/nuttx-apps#3860, merged). Reviews of the configuration and the documentation are welcome while #3869 waits to be merged.

Impact

  • Users: new configuration only. No existing configuration is changed.
  • Build: none outside the new configuration.
  • Hardware: Spresense only. No driver or board code changes.
  • Documentation: the Spresense page gains an nxdoom section; the NXDoom page describes the new serial terminal keys option.
  • Compatibility: none.
  • Security: none.

Testing

Result: the game starts on a Spresense, is shown on the display and is played with keys sent over the serial console, at about 19 to 20 frames per second. Demo video: https://youtu.be/ikh1EEGco8Q

Host: Windows 11, build in a Docker container (Ubuntu 24.04), arm-none-eabi-gcc 13.2.1, on the current nuttx and nuttx-apps master (which includes apache/nuttx-apps#3860) with apache/nuttx-apps#3869 applied.
Board: Spresense main board with the extension board and an ILI9340 display, with the Sony loader v3.4.3 installed.

Built from scratch with ./tools/configure.sh spresense:nxdoom && make, flashed with flash_writer, and the one-level Squashware IWAD (672906 bytes) sent with rz -p /mnt/spif:

nsh> ls -l /mnt/spif
/mnt/spif:
 -rw-r--r--      672906 doom1.wad
nsh> nxdoom -iwad /mnt/spif/doom1.wad
                             NXDoom v0.0.0
...
hu_init: Setting up heads up display.
st_init: Init status bar.

The game is shown on the display. From keys sent over the console, a new game was started, and the player could move, turn, fire and use. The frame rate was about 19 to 20 frames per second while playing, measured with a temporary counter. The documentation was built with Sphinx and the new sections render.

The flash area that holds the WAD is 4 MB, so the shareware DOOM1.WAD (about 4.2 MB) does not fit in it; only the one-level Squashware IWAD was tried.

PR verification Self-Check

  • This PR introduces only one functional change.
  • I have updated all required description fields above.
  • My PR adheres to Contributing Guidelines and Documentation (git commit title and message, coding standard, etc).
  • My PR is still work in progress (not ready for review).
  • My PR is ready for review and can be safely merged into a codebase.

@wwlapaki310

Copy link
Copy Markdown
Contributor Author

Updated the dependencies: the screen wipe PR (#3870) is closed in favour of apache/nuttx-apps#3860. This needs #3860 and apache/nuttx-apps#3869 merged first.

acassis
acassis previously approved these changes Oct 18, 2026
@github-actions github-actions Bot added Area: Documentation Improvements or additions to documentation Size: M The size of the change in this PR is medium Board: arm labels Oct 18, 2026
@github-actions

github-actions Bot commented Oct 18, 2026 •

Copy link
Copy Markdown

MemBrowse Memory Report · Explore what changed →

No memory changes detected for:


Catch memory regressions in CI with MemBrowse. Free for open source.

Comment thread Documentation/applications/games/nxdoom/index.rst Outdated
Comment thread Documentation/platforms/arm/cxd56xx/boards/spresense/index.rst Outdated
@linguini1

Copy link
Copy Markdown
Contributor

Awesome! Was super cool to see you get this working at Community over Code!

@xiaoxiang781216

Copy link
Copy Markdown
Contributor

@wwlapaki310 please run ./tools/refresh.sh --silent spresense/nxdoom to fix the style issue:

====================================================================================
Configuration/Tool: spresense/nxdoom,CONFIG_ARM_TOOLCHAIN_GNU_EABI
2026-10-18 15:27:15
------------------------------------------------------------------------------------
  Cleaning...
  Configuring...
  Disabling CONFIG_ARM_TOOLCHAIN_GNU_EABI
  Enabling CONFIG_ARM_TOOLCHAIN_GNU_EABI
  Building NuttX...
  [1/1] Normalize spresense/nxdoom
52d51
< CONFIG_GAMES_NXDOOM_NOWIPE=y
56d54
< CONFIG_GAMES_NXDOOM_UARTKBD=y
Saving the new configuration file
HEAD detached at pull/20774/merge
Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git restore <file>..." to discard changes in working directory)
	modified:   boards/arm/cxd56xx/spresense/configs/nxdoom/defconfig

wwlapaki310 and others added 2 commits October 19, 2026 23:26
Document GAMES_NXDOOM_UARTKBD, which lets a board without a keyboard
driver read the keys from a serial terminal, with the key bindings and
the 250 ms release of each key.

The option is added to nuttx-apps by a separate pull request.

Assisted-by: Claude:claude-sonnet-5-5
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Signed-off-by: satoru akita <wwlap24@gmail.com>
Add a configuration that plays NXDoom on a Spresense with an ILI9340
display attached to the extension board, and describe it in the board
documentation.

* The display is used as a frame buffer through LCD_FRAMEBUFFER, at
  320x240 in landscape.
* The keys are read from the serial console (GAMES_NXDOOM_UARTKBD).
* The WAD file lives in the on-board SPI flash, which is mounted at
  /mnt/spif and filled over the console with rz.
* The board has 1.5 MB of RAM, so the screen wipe is disabled and the
  render buffer is placed in .bss.
* The console UART receive buffer is raised from 256 bytes to 8 KB,
  because the default overruns while rz writes to the flash.

The board page describes the whole procedure: getting a WAD file,
sending it with rz, checking its size and starting the game.

This depends on the GAMES_NXDOOM_UARTKBD option added to nuttx-apps by a
separate pull request. GAMES_NXDOOM_NOWIPE is already in nuttx-apps.

Tested with the one-level Squashware IWAD.

Assisted-by: Claude:claude-sonnet-5-5
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Signed-off-by: satoru akita <wwlap24@gmail.com>
@wwlapaki310

Copy link
Copy Markdown
Contributor Author

@xiaoxiang781216 Ran it: no diff with apache/nuttx-apps#3869 applied. Without it only CONFIG_GAMES_NXDOOM_UARTKBD is dropped, since that option comes with #3869. I added a Depends-On: line for the CI.

@wwlapaki310

Copy link
Copy Markdown
Contributor Author

Thanks for the review! Updated as above.

@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/actions/runs/39269037885

@xiaoxiang781216
xiaoxiang781216 merged commit e29a0b2 into apache:master Oct 20, 2026
44 of 57 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area: Documentation Improvements or additions to documentation Board: arm Size: M The size of the change in this PR is medium

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants