Can AI Write Low-Level UEFI Programs? A Hands-On Brick Breaker Test
This experiment evaluates whether an AI model can build a runnable Brick Breaker game from scratch for the UEFI Shell. Using only a basic Visual Studio 2019 and UEFI development environment, without reference code or a local knowledge base, the model produced an EFI application that rendered graphics, displayed Chinese text, accepted keyboard input, and ran from a USB drive. The results show promise for a narrowly defined low-level task, while also highlighting the need for hardware validation, specification checks, and broader comparative testing.
1. Why Test Low-Level Development?
Many developers believe that AI can handle application-layer code reasonably well but performs significantly worse when dealing with hardware programming, register operations, and firmware protocols. There are three common reasons:
- Public training data for these topics is relatively limited.
- Hardware platforms and chip manuals are often outside the model’s commonly available knowledge.
- Firmware bugs usually require long debugging cycles.
These concerns are reasonable, but they lack controlled, hands-on data. This experiment uses a specific task to evaluate the question: can an AI model build a Brick Breaker game from scratch that runs in the UEFI Shell and displays Chinese text?
2. Experiment Design and Scope
The experiment used three constraints:
- The development machine had only Visual Studio 2019 and the basic environment required for UEFI development.
- No reference code or local knowledge base was provided.
- The developer supplied the goal but did not provide professional implementation details.
The final deliverable was an EFI application copied to a USB drive and launched from the firmware Shell.
Brick Breaker was selected because it covers three core capabilities:
- Graphics rendering through direct framebuffer access
- Keyboard input through polling
- Collision detection and game-state management
UEFI does not provide an operating system, window system, or general-purpose graphics library. These supporting components must be implemented directly, making the task a useful test of whether an AI model can build a program from a relatively bare-metal starting point.
This experiment involved one machine, one model, and one complete run. Its conclusions apply only to this task and should not be generalized to all low-level development scenarios.
Model information: A Chinese-developed large language model was used through a programming plan provided by a cloud service provider. [To be completed: model name, version, and API call date]
Environment information: [To be completed: operating system version, Visual Studio 2019 version, EDK2 version and branch, execution environment such as QEMU or physical machine model, Shell version, and USB file system format]
Safety note: The program was run only from a USB drive in the Shell and did not modify or flash firmware. Similar experiments should not be performed on a primary productivity machine. The risk of permanently bricking a device is relatively low in this setup, but important data should still be backed up before testing.
3. Implementation Process
3.1 Start with a Project Specification
In CLI mode, permission confirmations were disabled to reduce interruptions during iteration. The first instruction asked the AI to generate a Chinese project specification describing the goal: a graphical Brick Breaker game that runs in the UEFI Shell and does not require sound.
The AI then planned an entry module, a graphics abstraction layer, a game-logic layer, and a font-rendering layer. It also assigned responsibilities to each module. This specification later served as the baseline constraint for every iteration.
A project specification should include at least:
- Project goals
- Directory structure
- Acceptance criteria
- Prohibited actions, such as modifying firmware
- A record format for each iteration
3.2 Three Key Technical Decisions
Graphics Output
The AI used the Graphics Output Protocol (GOP) to obtain the framebuffer address and screen resolution, then drew rectangles based on pixel coordinates.
The pixel format was obtained from the GOP mode information. Different firmware implementations may use different BGR and RGB channel layouts, so the code must read and handle the reported format rather than assume a fixed ordering.
Chinese Text Rendering
UEFI does not provide a system font or a built-in character set. The AI chose to embed bitmap glyphs covering only the characters required by the game interface, such as “score,” “level,” and “game over.”
The glyphs were stored as bitmap data and rendered pixel by pixel according to their bit layout. The glyph data is not included in this article. Readers can verify the implementation based on the glyph dimensions and bit-order conventions used by their own code.
Input and the Main Loop
The program polled the Simple Text Input Protocol for keyboard input and mapped keys based on the returned ScanCode and UnicodeChar values.
The main loop used a delay to control the refresh interval. Collision detection was implemented with axis-aligned bounding box (AABB) intersection checks, while the state of each brick was stored in a two-dimensional array.
3.3 Compilation and Execution
The AI generated the build script and project configuration. During compilation, the project encountered issues including type mismatches and incorrect protocol-call ordering. According to the experiment log, most problems were fixed within two or three iterations.
A detailed error list should be added here: [To be completed: error-fix table covering error type, observed behavior, corrective action, and iteration number]
The final EFI application was copied to a USB drive and launched from the firmware Shell. The graphics rendered correctly, Chinese text was displayed, and keyboard controls worked as expected.
This result comes from a single-machine, single-model, single-run experiment. It has not yet been validated on other hardware platforms.
4. Results and Limitations
In this experiment, the AI was relatively stable in the following areas:
- Calling standard protocols such as GOP and the input protocol
- Making engineering decisions under resource constraints, including using a minimal character set
- Accessing the framebuffer directly
- Building a compilable project structure from scratch
The limitations were equally clear. Pixel formats can vary between firmware implementations, and real-device feedback may be required to identify and correct those differences.
When dealing with undocumented platform-specific behavior, a model may produce interfaces that appear reasonable but do not actually exist. Such output must be checked against the relevant specifications and official documentation.
This experiment did not measure whether AI improved development efficiency. Answering that question would require tracking implementation time, validation effort, and the number of rework cycles across multiple tasks and models.
5. Three Practical Recommendations
- Anchor the context with a project specification. Use the document as the baseline for every iteration.
- Make small changes and test quickly. Compile and run as early as possible to shorten the feedback loop and reduce the cost of trial and error.
- Include platform specifications in the retrieval context. Providing relevant documentation can supplement details the model does not know well and may reduce fabricated interfaces. However, this experiment did not include a controlled comparison, so the effectiveness of this approach requires separate testing.
Conclusion
Within the scope of a Brick Breaker game running in the UEFI Shell, this experiment shows that AI can complete the full workflow from project setup to execution on hardware.
That result does not mean AI is ready to handle every type of low-level development. Future testing will use other models to complete the same task and compare implementation time, rework frequency, and validation results. A broader evaluation will provide a more reliable picture of AI’s capabilities in firmware development.
