feature: GUI Panel#10
Merged
Merged
Conversation
MainWindow mixed five concerns: SoC ownership, run/step control, UI
construction, snapshot refresh, and file I/O. Pulled the simulator concerns
into gui/model/session.{hpp,cpp} — a Qt-free façade (owns SoC, loads firmware,
subscribes UART, produces IntrospectionSnapshot) that can be unit-tested
without QApplication. MainWindow now holds a Session and only does UI +
QTimer driving.
Pure refactor, no behavior change: GUI builds, offscreen AUTORUN loop runs
clean, core 355 ctests still green. Sets up the model/view split the panel
and dock work needs.
Each panel is now an independent QWidget under gui/view/panels/ exposing refresh(IntrospectionSnapshot). MainWindow sheds the inline table/label widgets and the register/GPIO fill logic — refreshFromSnapshot now just calls regs/serial/gpio->refresh(snap), so adding panels no longer bloats it. SerialPanel (read-only QTextEdit bound to USART output) is the first new panel: firmware output appears live as it runs (hello.elf demo). Layout is still fixed vertical; dock organization is the next commit. GUI builds, offscreen AUTORUN runs hello.elf clean, core 355 ctests green.
Replaced the fixed QVBoxLayout with a QMainWindow shell: a QToolBar for run/step/reset + state, the SerialPanel as the central widget (the surface the user watches), RegistersPanel docked left, GpioPanel docked bottom. Each dock is draggable / foldable / floatable — the debugger feel DIRECTIVES §E pointed at. Dock object names set for future saveState/restoreState. Layout still single-column-ish visually until more panels land on the right side; the framework is what matters here. GUI builds, offscreen AUTORUN runs hello.elf clean, core 355 ctests green.
Adds the three remaining numeric panels, all refreshed from the snapshot:
* StatusPanel — xPSR / PRIMASK / BASEPRI / FAULTMASK / CONTROL / MSP / PSP,
the interrupt-mask + stack-select registers (right dock).
* FaultPanel — kind / pc / lr / sp / xpsr / instruction (16/32-bit) and,
when present, access_addr + bus_error; shows '— none —' when clean.
* PeripheralPanel — SysTick ctrl/load/val + NVIC pending/irq/enabled +
SCB icsr/vtor/aircr/prigroup.
MainWindow wires them as stacked right-area docks. Every field the
introspection snapshot produces is now rendered. GUI builds, offscreen
AUTORUN runs hello.elf clean, core 355 ctests green.
Firmware that blinks via big software delay loops (e.g. examples/gpio_blink with delay(100000)) barely animates at the default 20k steps/tick (~400k cyc/s). A toolbar combo now picks steps-per-tick: 1×=20k (default, easy on the UI thread), 5×/25×/100× for watching delay-loop firmware at human speed. onTick reads the combo's currentData. GUI builds, offscreen AUTORUN runs hello.elf clean, core 355 ctests green.
The blink demo looped only 3 times then halted (for i<3), a leftover from when it was a test fixture. In the GUI that made the LED 'stop updating' after ~6 seconds and looked broken. Now it blinks forever (while(1)) with delay(20000) — 5× faster — so PA5 toggles continuously and visibly. Combined with the GUI speed selector, the LED animates at a comfortable rate. E2E.GpioBlink still passes (>=6 toggles; it now sees dozens within 4M steps).
Each panel had a bold QLabel title at the top that duplicated the QDockWidget title bar (e.g. 'CPU registers' appeared twice). Removed the in-panel titles; the dock title bar is now the single label. Central serial panel reads from its content (the output stream) without a heading. GUI builds, offscreen AUTORUN runs hello.elf clean, core 355 ctests green.
Session was extracted Qt-free (f81ab7d) precisely so it could be tested without QApplication. Adds test_gui_session (compiles session.cpp directly, no Qt link): rebuild validity + Halted state, step on a halted session, and with hello.elf loaded — run advances cycles, PC stays in flash, USART drains into the buffer, and a second rebuild clears it. Bumps test-count floor 353 -> 357. 4 new product tests, all green. Total 357 product + 2 meta = 359.
The runner hardcoded run(200000) then asserted toggle_count >= 6, so even after the firmware went infinite (e0f0ef1) the runner still stopped after ~6 toggles. Now it runs forever by default (Ctrl+C to stop) and prints each PA5 edge live — the visible blink on a headless run. A fault still breaks out and reports state + how far it got. 3s sample: 38 toggles (was 6 then halt).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.