How to Verify LLM Coding Skills: A Firmware Game Repair Case Study
How do you actually verify whether a large language model can code? This article walks through a practical case study: fixing a graphics game in a firmware environment. It explains why firmware tasks expose the limits of AI coding tools, how to triage an unfinished project by risk instead of file order, how to build a minimal runnable loop, and how to evaluate LLM performance objectively across environment understanding, debugging, code quality, and maintainability.
1. From “Code Was Generated” to “Software Actually Works”
When discussing the coding capabilities of large language models, it is easy to focus on generation speed, file count, and code structure. A project with an entry point, rendering, input handling, and game logic may look like complete software—but that does not mean it will build successfully, let alone run correctly.
A graphics game running in a firmware environment is a typical task for observing AI coding capability. It combines well-defined business logic (like Tetris rules) with low-level constraints such as program entry, graphics output protocols, input events, memory management, and build configuration. A model cannot complete the task by relying on common application development templates alone; it must also understand the differences between the target runtime and a typical desktop operating system application.
The key insight from the original practice was not how many hours a model took to finish the task, but how an unfinished project was pushed toward an executable state through code review, runtime feedback, and incremental repair. This process is better distilled into a general development methodology than into a product ranking.
Three distinct levels of results need to be clarified first:
- Generation complete: code files have been output and the module structure is largely in place.
- Build passes: source code, dependencies, and configuration produce the target program.
- Runtime acceptance passes: the program behaves as expected in the target environment, including handling exit, exceptions, and resource cleanup.
Only the third level approaches what developers actually need as a deliverable.
2. Why Firmware Graphics Tasks Expose Capability Boundaries More Easily
2.1 The runtime environment cannot follow desktop assumptions
Ordinary applications can typically rely on operating system services for windows, drawing, file access, and timers. In firmware, the available services, initialization conditions, and exit behavior are determined by the specific execution environment—a full desktop runtime cannot be assumed.
As a result, even if the game rules are completely correct, the project may still fail at entry point declaration, linking configuration, or protocol calls.
If an AI coding tool does not confirm these conditions first, it may generate an implementation that “looks syntactically correct but is unsupported by the environment.” The problem lies not in the game algorithm but in an insufficient understanding of the execution boundary.
2.2 Graphics output involves multiple preconditions
Drawing a rectangle on screen appears to be a simple pixel modification, but it actually depends on a complete chain:
Program starts successfully → discovers the graphics output protocol → confirms an available mode → sets the target mode → obtains current display parameters → writes pixels in the correct format.
An error at any link can cause a black screen, incorrect colors, a misaligned image, or out-of-bounds writes.
This also explains why “the program did not report an error” is not equivalent to “graphics initialization succeeded.” Developers must check the return status of every step and confirm that the data obtained actually reflects the current runtime state.
2.3 Failures may occur before game logic even runs
If logs show the program exiting as soon as it enters the main loop, do not immediately conclude that the game loop is wrong. The real cause may occur earlier—for example, an invalid pointer saved during initialization that is only used later during rendering.
For low-level tasks, it is especially important to distinguish:
- where the failure appears;
- where the erroneous data was produced;
- the trigger that exposed the error.
The value of a large language model should lie in establishing and verifying this causal chain, not in editing code near the last log line.
3. Taking Over an Unfinished Project: Restore Facts First, Then Propose Changes
When facing existing code, simply asking the model to “fix everything” is usually ineffective. A safer approach is to have the model build a project map first, then handle issues layer by layer.
3.1 Inventory the project structure and runtime assumptions
First, confirm the entry function, build files, module dependencies, and main data flows. Review priorities include:
- whether the entry point and calling convention meet the target environment’s requirements;
- whether the libraries and services used are actually available in the runtime;
- how graphics, input, and timer objects are initialized;
- whether return statuses are checked completely;
- who allocates memory and who releases it;
- under what conditions the main loop starts and ends.
A clean code structure only shows that organization is clear—it does not prove these constraints are satisfied.
3.2 Fix by risk level, not file order
Divide problems into four layers:
Layer 1: Build issues. Missing declarations, wrong dependencies, entry configuration, and link failures. Do not modify game rules at the same time, to avoid expanding the change surface.
Layer 2: Initialization issues. Protocol discovery failure, unavailable modes, null return objects, and incorrect initialization order. These problems prevent the program from reaching a normal running state.
Layer 3: Runtime safety issues. Dangling pointers, array out-of-bounds access, size calculation overflow, double resource release, and mishandled events.
Layer 4: Functionality and experience issues. Rotation rules, line clearing, scoring, key response, screen flicker, and exit prompts.
This order prevents the situation where “more and more game features are written while the underlying program still cannot run.”
3.3 Require evidence for every judgment
An effective review result should not just say “there might be a problem here.” Each issue should ideally include:
- the relevant code location;
- the trigger condition;
- the expected behavior versus the actual risk;
- a verification method;
- a minimal fix suggestion.
Conclusions that cannot be confirmed from the source code should be explicitly marked as hypotheses to be verified—guesses must not be presented as confirmed root causes.
4. First Repair Round: Build a Minimal Runnable Loop
The goal of the first round is not to complete a polished game, but to validate the environment and the basic pipeline.
Recommended progression:
- Output a stage marker after the program starts;
- Successfully acquire graphics output capability;
- Complete one supported mode set;
- Clear the screen and draw a fixed color block;
- Read one exit key;
- Release resources and return normally.
Only after this chain is stable should full game state, piece falling, and collision detection be added.
4.1 Log state, not just actions
“Initializing graphics” only proves the program reached a certain line—it does not prove initialization succeeded. More valuable logs include return statuses and key parameters, for example:
Stage: graphics protocol discoveryResult: success or failureStage: mode setResult: success or failureCurrent width: value read at runtimeCurrent height: value read at runtimePixels per scanline: value read at runtime
The implementation should also record error branches, not just the happy path. For stages where graphics are not yet available, use a debug channel independent of display output—such as a serial port—to avoid “relying on an already-failed graphics system just to display the error message.”
4.2 Reconfirm current state after a mode switch
A mode query returns information about a candidate mode; a mode set changes the actual display state. The two should not be conflated.
If the program continues to use previously saved data after switching modes, check:
- who owns the data returned by the query;
- whether the caller must release it;
- whether it was released prematurely;
- whether a local object’s address was saved;
- whether the current framebuffer and dimensions have changed.
It is wrong to claim broadly that all query pointers become invalid after a mode switch. Validity depends on the interface contract, memory ownership, and actual code behavior. A more reliable principle: manage query results according to the specification, and obtain the currently effective display parameters after a successful mode set.
Below is a conceptual processing sequence, not actual interface code:
Discover graphics output capabilityCheck the discovery resultQuery candidate modesCheck whether a candidate mode meets requirementsSet the target modeCheck the set resultRead current mode parametersVerify width, height, pixel format, and framebuffer boundariesInitialize the rendering module
This prevents the rendering module from continuing to use parameters that no longer match the actual state.
4.3 Protocol identifiers must match their purpose
Firmware development may involve protocol identifiers, event identifiers, and identifiers for other purposes at the same time. Similar names do not mean they are interchangeable.
When graphics capability acquisition fails, check whether the identifier is used for the target protocol and whether the discovery result passed return-status and null-pointer checks. Do not judge an identifier’s purpose by its variable name, and do not assume an identifier is correct merely because compilation succeeded.
This type of problem shows that a large language model needs to understand the relationship between declarations, identifiers, the discovery process, and returned objects—not just perform text-level substitution.
5. Second Round Optimization: From Runnable to Maintainable
5.1 Separate game state from graphics output
Game logic should maintain the board, current piece, position, score, and end state. The rendering module should only convert state into frames. The input module should only convert key presses into actions.
This separation reduces debugging difficulty. For example, collision detection can be verified directly against board data without starting the full graphics environment, and a drawing error does not force the developer to also check line-clearing rules.
5.2 Make boundary conditions the testing focus
Errors in Tetris-like games tend to concentrate in boundary scenarios:
- rotating a piece adjacent to the left or right wall;
- continuing to drop after a piece touches the bottom;
- the spawn position of a new piece already being occupied;
- multiple lines meeting the clearing condition simultaneously;
- rapid consecutive inputs causing state transitions;
- input events arriving after the game has ended.
These scenarios need explicit expected outcomes. Model-generated code may demo correctly yet still produce out-of-bounds array access or state corruption under boundary conditions.
5.3 Handle pixel format and stride correctly
When writing directly to a graphics buffer, do not assume all environments use the same color layout, or that the per-row stride equals the visible width.
A rendering implementation should at minimum check coordinate bounds, pixel format, per-row stride, and buffer size. Offset calculations must also account for integer overflow, so that size multiplication or address computation does not produce errors.
For display modes unsuitable for direct writes, use a drawing path explicitly supported by the runtime rather than forcing the same buffer assumptions.
5.4 Input and timing should not rely on busy-waiting
Controlling drop speed with a high-speed spin loop makes game pacing dependent on machine performance and wastes processing resources.
A better design uses timing or wait mechanisms supported by the environment, separating input handling from automatic dropping: input triggers movement, elapsed time triggers the drop, and the screen is updated after state changes.
Single presses must also be distinguished from held keys, to prevent one input from executing repeatedly across multiple loop iterations.
5.5 The exit path is part of the delivery
Both normal and abnormal exits should consider resource cleanup. Allocated memory, created events, and display state changed by the program must be handled according to the environment’s conventions.
If a program behaves correctly only on the startup path but leaves resources or abnormal state behind after exit, the delivery is still not complete.
6. How to Objectively Evaluate LLM Coding Performance
The time taken for a single task is insufficient to prove a model’s overall capability. Different games, different initial projects, and different build environments all change task difficulty.
In particular, building from scratch and taking over existing code have different cost structures: the former requires architecture and implementation, while the latter requires understanding existing design and identifying hidden bugs—final elapsed times cannot be compared directly.
A more effective evaluation approach is to keep conditions consistent and record the following metrics:
| Dimension | What to observe |
|---|---|
| Environment understanding | Whether entry, build, and runtime constraints are confirmed first |
| Problem localization | Whether evidence is built from logs, return statuses, and source code |
| Change quality | Whether minimal changes are used and whether new bugs are introduced |
| Runtime results | Whether basic startup, functional verification, and normal exit are completed |
| Human intervention | How much extra diagnosis or manual repair the developer provided |
| Maintainability | Whether module boundaries, resource management, and tests are clear |
During evaluation, also preserve the task description, initial project, environment information, key logs, and change records. Only then can you determine whether results come from model capability or from environmental differences and human assistance.
7. Collaboration Advice for Developers
When using AI coding tools to repair low-level projects, the most valuable principle to follow is “small changes, independent verification.”
Set only one primary goal per round—for example, first fix the initialization exit, then verify graphics output, and finally add game logic. Require the model to explain the basis for each change and provide corresponding test steps. Runtime feedback should include reproducible conditions, complete error messages, and actual behavior—avoid simply saying “it still doesn’t work.”
Engineering teams should also incorporate automated builds, key logic tests, and target environment verification into the delivery process. Models can assist with analysis and implementation, but acceptance evidence must come from real execution results.
Ultimately, the LLM coding capability worth paying attention to is not how much code can be generated at once, but whether—under clear constraints and continuous feedback—a model can gradually converge a flawed project into a correct, stable, maintainable program. A firmware graphics game is just an entry point; the methods behind it—environment confirmation, evidence-driven debugging, resource lifecycle management, and staged acceptance—apply equally to other complex development tasks.
