Add a cross-platform SDL emulator for developing the goggle UI without hardware#617
Add a cross-platform SDL emulator for developing the goggle UI without hardware#617christhomas wants to merge 1 commit into
Conversation
a50ee05 to
1c980e3
Compare
|
AI Generated comment Problem: Proposed solution: Have |
|
AI Generated comment Not authoritative — flagging for consideration, deferring to the author's judgment on implementation. Problem: Some floor has to be fixed regardless of implementation — whether via an older base image, a fully static build, or explicit glibc-ABI targeting in the toolchain, all three amount to picking a minimum glibc version the output supports. Tracking whatever LTS is newest leaves that floor undefined and drifting upward every two years. Proposed solution: Pin the build environment to a deliberately conservative glibc floor. Simplest: change |
1c980e3 to
58ae81d
Compare
|
Thanks @nerdCopter — both are good catches; fixed in 58ae81d. 1 — missing-image build step. Added an 2 — glibc floor. Pinned Both land in the single emulator commit. |
58ae81d to
95c8217
Compare
|
8c01fd8 to
ffac78c
Compare
|
@nerdCopter thanks for the follow-up testing — the Xubuntu-works / Debian-13-fails split was the key clue. Root cause. Your Fix (latest push to To pick it up on Debian 13: git pull # latest feat/sdl-emulator
bash .devcontainer/build.sh linux
objdump -T build_emu_linux/HDZGOGGLE | grep -oE 'GLIBC_[0-9.]+' | sort -V | tail -1
# expect: GLIBC_2.34 (runs on Debian 13's 2.41 and anything newer)(If you want to be certain the old image is gone: Fixing this partly blind. I don't have your exact Debian 13 box here, so I've been reproducing against the same pinned 22.04 base rather than your setup. I'm fairly confident the latest matches, but I'd really appreciate a re-test to confirm the floor drops to Why this isn't going to be whack-a-mole. glibc is forward-compatible: a binary built against 2.34 runs on 2.34 and every newer glibc (2.41, 2.45, …). We only ever have to pick the oldest glibc we want to support (2.35 here, via the 22.04 base) and build once — newer hosts are automatically covered. The bug was simply that the build environment's glibc had drifted too new (2.43). Won't silently regress again. Added a CI step that reads the built binary's max Downloadable binaries. For anyone not building locally, I've also re-cut the release as Mouse selection. Feasible — SDL can drive an LVGL pointer input device — but the goggle UI is built around the 5-way button + scroll-wheel model (focus-based navigation, not click targets), so it's a real feature rather than a flag flip. Noted as a nice-to-have follow-up; agree it's not important to the emulator's core purpose. Thanks again for the thorough testing 🙏 |
|
ffac78c to
6ff17f9
Compare
|
I think I understand what you want with mouse selections, but doesn't that kind of make the emulator diverge from the way the user interface is supposed to be used. It would add probably different user interface access patterns and perhaps not be really that useful. Can you give me a persuasive argument for it? |
436c787 to
d5fd8af
Compare
|
i dont need mouse. my last comment just called out that i cannot actually focus into the settings panes nor change any settings. maybe such is local-environment issue -- i do not know. |
|
ohhhhh, I think the latest update might fix that, I use the WSAD or the arrow keys, and I tried it out and played around with it and it seems to work quite nicely. Maybe it was something that was fixed. Try it out and let me know. |
|
oaky... WSAD technically works, but i get locked into a "video feed" screen rather quickly and cannot exit to test other panels.. i'll give you some time to work things out. good work! may simply need to list keys in PR description or potentially a HUD overlay 🤷♂️ . |
|
Isn't it the same as your goggles W = up = rotate left the only thing I don't like, which I didn't put much effort into thinking baout right now, is that I'm using WSAD and arrow keys WSD makes sense, but A doesn't, cause A represents the button on the right of the goggler UP, DOWN, RIGHT makes sense, but LEFT doesn't because of the same reason So I think I'm going to change it to WSD and L Then I think it maps better to how I visually think of how the buttons relate to each other and to enter the FPV view, you long push D, just like you would the jog wheel button and long press it to get out and back to the menu. Does that make more sense to you too? I'll make the change, then you can tell me whether you agree or not after you use it a bit |
Adds a desktop build of the goggle UI (Linux/macOS/Windows) that runs the real
application code -- the same main(), menu system, OSD and page logic that ships
on the goggle -- rendered through SDL2 instead of the framebuffer, with the
hardware peripherals replaced by compiled-in mocks. This lets the LVGL interface
be developed, previewed and regression-tested without hardware.
Build and run:
.devcontainer/build.sh {images,linux,windows,mac} build (in a container)
./run-native.sh run natively on the host
Every target compiles inside a devcontainer image, so builds are reproducible and
need no host toolchain; the resulting binary runs natively on its OS. macOS is
cross-compiled to Mach-O in the container too (LLVM/clang); its SDK is staged once
from your Xcode since Apple's is not redistributable. CI is the one place macOS
builds natively -- on a macos-latest runner -- because CI can't stage that SDK.
Zero cost to the firmware: all emulator code lives behind EMULATOR_BUILD or in
src/emulator/*, which CMake compiles only for the emulator, so the goggle binary
contains none of it. Hardware drivers that genuinely differ (UART, I2C, RTC, the
framebuffer) are split into per-target files selected by CMake, keeping the goggle
drivers free of emulator #ifdefs.
Peripherals are mocked at their hardware seam, so the app itself is unchanged:
- display engine -> SDL2 window + software compositor
- DM5680 video -> decodes a looping MPEG-1 clip (vendored pl_mpeg; no ffmpeg
is linked) behind the OSD, and only in the video view
- DM5680 serial -> socketpair-backed UART + a mock answering version/RSSI
- I2C bus, RTC -> no-op bus, in-memory clock
- system_exec -> logged and skipped, so device shell commands (display pokes,
register writes, wifi/passwd scripts) never touch the host
Also included: configurable filesystem roots (path_app/path_extsd from config+env,
compiled away on the goggle), POSIX compat shims for macOS/Windows hosts, a fix for
ATOMIC_VAR_INIT removed on newer toolchains (which the emulator build requires; also
offered standalone), and CI that builds all three targets on every push with a
headless screenshot, publishing binaries on a semver tag.
d5fd8af to
baa0fb0
Compare
|
awesome, now i know what the |
Adds a desktop build of the goggle UI (Linux, macOS, Windows) that runs the real
application code — the same
main(), menu system, OSD and page logic that ships on thegoggle — rendered through SDL2 instead of the framebuffer, with the hardware peripherals
replaced by compiled-in mocks.
The aim is to make the LVGL interface developable and previewable without hardware, and
to give CI a way to catch UI/driver regressions on every push.
Build and run
Every target compiles inside a devcontainer image, so builds are reproducible and need
no host toolchain; the resulting binary runs natively on its OS. macOS is the one exception
and builds on a mac, since a cross image would need Apple's non-redistributable SDK.
Zero cost to the firmware
All emulator code sits behind
EMULATOR_BUILDor insrc/emulator/*, which CMake compilesonly for the emulator — the goggle firmware binary contains none of it. Hardware drivers
that genuinely differ (UART, I2C, RTC, the framebuffer) are split into per-target files
selected by CMake, so the goggle drivers carry no emulator
#ifdefs.Verified by building the firmware from this branch: it compiles unchanged, with zero
emulator objects linked in.
What's mocked (at the hardware seam, so the app itself is untouched)
pl_mpeg; no ffmpeg is linked) behind the OSD, and only in the video viewsystem_exec)Also included: configurable filesystem roots (
path_app()/path_extsd()from a config file/mnt/appand/mnt/extsddefaults areunchanged), and POSIX compat shims for macOS/Windows hosts.
CI
.github/workflows/build_emulator.ymlbuilds all three targets on every push/PR with aheadless screenshot as a regression check, and publishes per-platform binaries on a semver
tag. The existing firmware workflows are untouched (and pass on this branch).
Notes
ATOMIC_VAR_INITfix), which the emulator build requires and whichthis branch therefore includes. Once Fix build on newer toolchains where ATOMIC_VAR_INIT was removed #616 merges, this rebases down to a single commit.
docs/emulator.md.