Skip to content

iPod Nano 2G port (Rockbox plugin)#20

Merged
colemancda merged 27 commits into
mainfrom
feature/ipod
Jul 13, 2026
Merged

iPod Nano 2G port (Rockbox plugin)#20
colemancda merged 27 commits into
mainfrom
feature/ipod

Conversation

@colemancda

@colemancda colemancda commented Jul 13, 2026

Copy link
Copy Markdown
Owner

Adds ports/iPod: a Rockbox plugin port of Junkbot for the iPod Nano 2G, compiled as Embedded Swift for armv4t-none-none-eabi (the Nano's FPU-less ARM940T) and linked into junkbot.rock by Rockbox's own build system. Modeled on celeste-swift's iPod port.

Architecture

  • C owns the process (plugin/junkbot.c): the plugin loop, click-wheel input, scrolled world blit, level intro / win-lose / status text (Rockbox's own font, so no font asset), and the HOLD pause menu.
  • Swift owns the game (source/Plugin.swift): the GameEngine, current level, a click-wheel aiming cursor, and the scrolled viewport, exposed as @_cdecl entry points. source/Renderer.swift rasterizes the engine's RenderCommand list into an RGB565 canvas (adapted from ports/3DS).
  • Shim (plugin/rockbox_shim.c): TLSF allocator over the plugin buffer, non-atomic __atomic_* (single-threaded plugin on a core with no atomic instructions), mem* helpers, stack protector, entropy, and the libm gaps (floor/ceil/round).

Assets load from the filesystem

Unlike every other port, neither sprites nor levels are compiled in — both live in /.rockbox/junkbot/ and load into the audio buffer at startup:

  • sprites.bin (~5.6 MB RGB555 pixel data); only the small per-sprite offset table is compiled in.
  • levels.bin (~1.1 MB, all 121 campaign levels). The generated level data every other port embeds is ~1.6 MB of code — over 3× a plugin's entire 512 KB PLUGIN_RAM (the first device link overflowed by 1.3 MB). tools/LevelPack (a host tool importing JunkbotCore natively) serializes embeddedLevels into a binary catalog and round-trip-verifies the blob through the device decoder at build time; the codec is one file compiled into both the tool and the plugin so the field order can't drift. Final plugin: 167 KB text.

Controls

Input Action
scroll wheel / LEFT / RIGHT move cursor by one stud
MENU / PLAY move cursor up / down one brick
SELECT grab / drop
HOLD pause menu

Building

cd ports/iPod
make toolchain   # once: arm-elf-eabi-gcc into the rbdev Docker volume
make rock        # libjunkbot.a (host swiftc) + assets + Rockbox in-tree build
make install IPOD=/Volumes/<ipod>

Verified

  • make swift: armv4t Embedded Swift object passes the undefined-symbol audit and archives cleanly (swift-6.3.2-RELEASE).
  • make assets: LevelPack round-trips all 121 levels through the device decoder with zero field mismatches.
  • make sim: the C host compiles and links junkbot.rock against the pinned Rockbox tree's UI simulator with no warnings.
  • make rock: device build links at 167 KB text / 221 KB total, inside the 512 KB PLUGIN_RAM.
  • Installed to a real Nano 2G (make install) for on-hardware testing.

Audio is not started yet (rb_audio_sfx is a no-op); the README documents the phased plan.

IMG_3049

@colemancda
colemancda merged commit ab65e3e into main Jul 13, 2026
17 checks passed
@colemancda
colemancda deleted the feature/ipod branch July 13, 2026 13:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant