Testing Chinese LLMs on Firmware Development: Building a Tank Game for UEFI Shell

    A UEFI Shell tank game provides a demanding test of AI coding ability beyond familiar programming exercises. This hands-on account covers the EDK2 build environment, a costly emulator configuration dead end, and the switch to QEMU and OVMF that enabled a playable result. It also examines debugging costs, build-system weaknesses, and the role of human judgment in AI-assisted firmware development.

    1. Why Choose Such a Difficult Coding Benchmark?

    Common exercises such as implementing quicksort or writing a web scraper are limited tests of a large language model’s coding ability. These tasks appear repeatedly in training material, so a model may produce plausible code through pattern matching without demonstrating a strong understanding of the underlying principles.

    Tasks with scarce reference material, long dependency chains, and a need for practical engineering judgment are more revealing.

    For this benchmark, I asked an AI coding assistant to build a complete, classic top-down tank battle game that runs in UEFI Shell, modeled on the console games of the 1990s. The core requirements were:

    • A fixed, top-down map where the player controls a tank and fires projectiles.
    • Enemy tanks that spawn in waves, with the player defending a home base represented by an eagle icon.
    • Destructible brick terrain and collectible power-ups, including invincibility, armor-piercing ammunition, and extra lives.
    • Victory after surviving all enemy waves.
    • No audio requirement.

    The task combines several challenges that make it a useful engineering benchmark.

    Firmware Development Is a Niche Domain

    UEFI application development is uncommon in everyday software work, and complete public examples are relatively scarce. A model has fewer opportunities to assemble a working project from familiar patterns.

    Build Configuration Is a Significant Hurdle

    An EDK2 project requires accurate DSC platform configuration and, where applicable, FDF firmware layout configuration. Module dependencies can be complex, and a configuration mistake can stop the build entirely. The resulting errors are often difficult to interpret.

    Graphics Output Has Strict Constraints

    Rendering must use UEFI’s Graphics Output Protocol (GOP). The model needs to understand how to locate the protocol, query the graphics mode, and write to the framebuffer. It cannot simply rely on the graphics libraries normally available to desktop applications.

    The Game Requires More Than a Minimal Demo

    Multiple maps, different enemy tank types, power-ups, particle effects, and stable frame updates require the model to break a substantial specification into compilable modules while keeping their behavior consistent.

    Before this run, I had tested six Chinese-developed LLMs on the same task. Only a small number completed the full workflow. Most either became stuck configuring the build environment or produced incomplete game logic that failed runtime validation.

    2. Test Environment and Evaluation Procedure

    To make results comparable across models, I used a consistent development and validation process.

    Development Setup

    • Use the coding assistant’s initialization command to create a Chinese-language project brief in the project directory. This document contains the full requirements and serves as a persistent reference during later sessions.
    • Place the code within an EDK2 project structure and compile it on Windows using the VS2019 toolchain.
    • Validate execution through two routes: EDK2’s emulator environment and QEMU running a UEFI firmware image such as OVMF.

    Acceptance Criteria

    The game had to:

    • Compile without errors.
    • Launch successfully from UEFI Shell.
    • Render pixels correctly through GOP.
    • Maintain approximately 30 frames per second.
    • Provide a complete, playable implementation of the core mechanics.

    The initial /init step cost only a fraction of one Chinese yuan. That made the planning stage inexpensive, consistent with the falling inference costs of routine LLM tasks.

    The substantial expense came later, during compilation and debugging. That phase provided the most useful lessons from this test.

    3. A Failed Build Path and a CNY 50 Lesson

    The first step was to place the generated code in the EDK2 emulator project directory, compile it, and run it. In earlier tests, only one or two of the strongest models had cleared this stage.

    The model tested in this run also became stuck here. Its failure pattern is worth examining for anyone using AI to assist with firmware development.

    What Went Wrong

    The model repeatedly tried to repair the emulator build configuration. It changed module declarations in DSC files, adjusted firmware volume packaging in FDF files, and investigated dependencies between INF files.

    Each attempt consumed a substantial number of tokens. Meanwhile, compiler errors continued to multiply: fixing one issue would reveal several more, with little progress toward a working build.

    After approximately CNY 50 in token spending, I stopped the attempts and gave a direct instruction:

    Stop building the emulator. Use QEMU for debugging and execution instead.

    This dead end exposed three broader weaknesses.

    1. No Reliable Stop-Loss Mechanism

    After repeated unsuccessful fixes, a human engineer is likely to question the approach itself. In an interactive session, a model may instead continue patching the same path, treating another attempt as the default answer.

    Users need to set both spending limits and limits on repeated attempts.

    2. Shallow Understanding of the Build System

    The relationships among package descriptions, platform configuration, and firmware layout are a recurring weakness. A model may reproduce valid-looking file formats yet struggle to resolve real dependency problems across those layers.

    Knowing the syntax of DSC, FDF, and INF files is not the same as understanding why a particular build configuration fails.

    3. Human Direction Remains Essential

    Models can execute efficiently when the approach is sound. Deciding when to abandon that approach still requires human judgment.

    Switching validation from the EDK2 emulator build to QEMU was the turning point that allowed this project to continue.

    4. Progress After Switching to QEMU and OVMF

    The workflow improved substantially after moving to QEMU with OVMF. The resulting game met the intended requirements:

    • Direct framebuffer rendering at 640 × 480 resolution using a BGRA pixel format.
    • Stable rendering at approximately 30 frames per second under QEMU with OVMF.
    • Eight maps, four enemy tank types, five power-ups, and a complete particle effects system.
    • Working brick destruction, base defense, and wave-based progression.

    The final level of playability exceeded my initial expectations for an AI-generated firmware-level game. It was not, however, a one-shot success: reaching that result required iterative debugging and a human-directed change in strategy.

    The code has been open-sourced for developers interested in reproducing the project. The cumulative debugging cost for the playable version was approximately CNY 150.

    5. Lessons for Evaluating AI Coding Models

    Use a Consistent, Demanding Benchmark

    Running the same difficult task across multiple models provides a more tangible comparison than benchmark rankings alone.

    Conventional scores can indicate knowledge coverage and performance on predefined tasks. A real project tests whether the model can close the engineering loop: understand requirements, generate code, configure the environment, and converge on a working result through debugging.

    Include Cost in the Evaluation

    Models can differ substantially in token consumption for the same task. For organizations choosing a coding model, cost per completed task may be more useful than a leaderboard score.

    An inexpensive planning step does not guarantee an inexpensive project. Repeated, unsuccessful build repairs can dominate the total cost.

    Real Usage Provides Valuable Feedback

    One reason I continue testing Chinese-developed models is that sustained practical use creates feedback for further improvement. This is an economic consideration rather than a matter of national preference: adoption gives model developers both an incentive and opportunities to improve their products.

    Define the Human–AI Division of Labor

    This project reinforced a practical division of responsibilities:

    • The model: Generate code and iterate quickly within a clearly defined approach.
    • The developer: Choose the approach, decide when to stop an unproductive path, and define acceptance criteria.

    That distinction becomes especially important in specialized, high-barrier domains such as firmware development.

    Conclusion

    The Chinese-developed LLMs tested so far show considerable maturity on general programming tasks. In less common domains such as UEFI development, however, environment configuration and build-system understanding remain clear weaknesses.

    The successful outcome here depended on more than code generation. It required explicit requirements, repeatable validation, cost controls, and a timely decision to change the execution path.

    For developers, the most useful framing is to treat these models as fast implementers that need clear direction and constraints—not as engineers capable of independently resolving every part of an unfamiliar system.