When AI Meets BIOS-Level Development: A Hands-On Experiment in Reshaping Firmware Programming
This article examines whether AI-assisted programming can handle low-level firmware development through a hands-on experiment: building a graphical Breakout game that runs in the UEFI Shell and supports Chinese text, with only Visual Studio 2019 installed and no code written by hand. It walks through the full process—toolchain and PE/COFF linking, UEFI entry conventions, physics and collision logic, and a custom 16x16 bitmap glyph renderer—while sharing pitfalls around EDK2 directory structure, batch-script escaping, and UTF-8/GBK encoding. It closes with a cost-and-retrospective analysis, arguing that AI's real value in firmware work is cutting boilerplate, accelerating trial-and-error, and shifting developers from implementers to spec-and-acceptance owners, while non-functional trade-offs still demand human judgment.
Introduction: Can AI really not handle low-level programming?
AI-assisted programming has been a hot topic in the tech community lately. Some jokingly call traditional hand-written coding “old-school programming,” while others insist that in domains close to “bare metal”—register operations, hardware initialization, protocol stack calls—AI is bound to fall short. Scarce training data, abstract context, and the lack of runtime feedback are all real obstacles.
That judgment has some merit, but it is not without a solution. Take firmware development: BIOS programming roughly falls into two categories—creative programming (designing new modules from scratch) and platform porting (bringing up new hardware and platforms). The former tests design ability; the latter tests your understanding and migration of existing frameworks. Adding AI coding tools, combined with a local knowledge base to fill in domain-specific corpus, can form effective assistance for both types of tasks. More importantly, it opens the door to reshaping the development process itself—compressing “humans find solutions, humans write code, humans debug” into “humans set goals, AI produces solutions, humans validate,” multiplying efficiency in the process.
The experimental setup: a deliberately tough test
To objectively gauge AI’s real level at the firmware layer, I set the rules to be quite strict:
- Minimal environment: on Windows, install only Visual Studio 2019, with no additional toolchain preinstalled;
- Zero code baseline: no reusable code locally, and I write not a single line myself;
- Minimal guidance: no domain-level hints or direction—AI completes the analysis and implementation entirely on its own;
- A difficult goal: build a graphical Breakout game that runs in the UEFI Shell environment, and it must support Chinese display.
In plain terms, the final product is a game program you copy onto a USB drive, plug into a computer, enter the BIOS Shell, and run directly.
I chose Breakout because it has a clear structure and a self-contained logic loop, while covering core programming elements like graphics rendering, keyboard input, collision detection, and state machine management—a classic benchmark for programming ability. I had run similar tests in web environments and mobile operating systems before, but this time switching to the BIOS environment raised the complexity sharply—for a simple reason: the supporting system is almost nonexistent. There is no ready-made graphics library, no font rendering, no input abstraction layer—everything has to be built from scratch.
There was also a trade-off in model choice. I had previously tried fast, logically clear cloud-based large models, but hourly billing made the cost of even a two-hour session clearly too high for everyday development. As an analogy goes: a Ferrari is indeed excellent, but what most people really need is an economical, practical family car. In the end I chose a coding package from a cloud provider and ran the entire experiment with one of its more economical models, in order to observe “just how far an affordable model can go in a low-level task.”
Round one: the breakthrough from zero to one
Setting up the build: getting “compile and link” right
AI’s first move was to map out the build chain. Compiling a UEFI application is not the same as building an ordinary Windows program—it requires a toolchain that produces PE/COFF format and conforms to EBC/x64 calling conventions. Working with only Visual Studio 2019, AI found its own way through:
.clw -> cl.exe compiles to .objlink.exe links to .efi (subsystem and entry point must be specified)
It automatically generated the project directory structure, including Game.c, Makefile, Build.bat, and a Pkg.dsc-style module description, and repeatedly corrected the entry function signature:
EFI_STATUSEFIAPIUefiMain (IN EFI_HANDLE ImageHandle,IN EFI_SYSTEM_TABLE *SystemTable);
The first problem to surface at this stage was matching the object file format to the linker parameters. AI initially used a generic MSVC configuration, which caused the linker to refuse to generate a bare module without a standard library. After several rounds of trial and error, it worked out on its own that it needed to disable the default library dependency and explicitly specify the entry symbol, and finally produced the first .efi file that the firmware loader could recognize.
Anecdote 1: the “taken-for-granted” EDK2 directory copy
While preparing the build environment, AI assumed it “knew” the standard structure of the EDK2 code tree and pieced together directories and files from memory. As a result, the copied skeleton was missing the key Conf and BaseTools components, and the build script immediately failed with “target definition not found” the moment it ran. AI then switched to confirming the directory listing first, then filling things in step by step, and the problem was resolved.
This anecdote is typical: AI has strong priors about “well-known” structures, but those priors fail when it comes to specific versions and specific directory details. In engineering practice, you must give it a verifiable source of truth.
Anecdote 2: the detour around shell-based compilation
The second episode came from the compile command itself. AI initially tried to call the low-level build tools directly through a shell script, ignoring the differences between Windows and Unix-style environments in path separators, environment variable passing, and batch escaping rules. Several consecutive runs failed silently. Rather than blindly retrying, it switched to printing intermediate outputs step by step—first verifying environment variables, then path resolution, and finally call parameters—gradually narrowing down the problem space.
This made me realize that AI’s debugging strategy is naturally suited to “binary search localization,” but the prerequisite is that every step has observable intermediate output; otherwise it gets stuck in an information-free loop.
The first successful run
After multiple corrections, the program finally ran on a physical machine: a green rectangle popped up in the center of the screen—the first pixel block AI drew for the “paddle.” There was no ball, no bricks, and no interaction yet, but the zero-to-one loop was complete—the code could be loaded by the firmware, could obtain the system table, could operate the framebuffer, and could draw something on the screen.
Round two: iterating from working to good
Round one verified “whether it can”; round two tackles “how well.”
Stage 1: feature build-out
AI broke tasks down into “minimum playable units” and filled them in one by one:
- Ball and paddle movement: establish basic physics parameters (speed, bounce angle) and implement left-right movement;
- Brick matrix: use a 2D array to describe brick states, supporting row-and-column layout;
- Collision detection: use axis-aligned bounding box (AABB) tests, distinguishing “ball-brick” from “ball-paddle” responses;
- Scoring and lives: add state variables and display logic;
- Game loop: drive updates with a fixed time step to avoid speed inconsistency at different frame rates.
This code came out of AI in clear module divisions, close to a textbook structure:
typedef struct {INT32 x, y;INT32 w, h;BOOLEAN active;} BRICK;typedef struct {INT32 x, y;INT32 vx, vy;} BALL;
Stage 2: visual polish
The first version was stitched together from solid-color rectangles and looked crude. AI proactively proposed optimization directions: add borders to the bricks, use different brightness levels to indicate remaining durability, round off the ends of the paddle, and add a motion trail to the ball. These changes do not add logical complexity, but they noticeably improve the sense of “playability.” This also shows that AI is not only capable of piling on features—it can recognize the dimension of “experience.”
Stage 3: tackling display
The real hard part was here. The UEFI environment has no directly usable ability to output Chinese text, and EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL supports only a limited ASCII range. AI explored three approaches:
- Option A: rely on Unicode fonts already loaded by the firmware—quickly rejected, since most platforms do not provide Chinese glyphs;
- Option B: hardcode a bitmap font—feasible but large, requiring trimming;
- Option C: build a simple glyph renderer that stores common Chinese characters as 16x16 bitmaps in an array and draws them to the framebuffer on demand.
AI ultimately chose Option C and implemented a complete “glyph cache–draw–refresh” pipeline:
// Illustration: draw a bitmap at the specified coordinatesVOIDDrawGlyph (IN UINT8 *Framebuffer,IN UINTN Stride,IN UINTN X,IN UINTN Y,IN UINT8 *Glyph // 16x16 bitmap, 1 bit per pixel);
Anecdote 3: compilation issues triggered by Chinese comments
When adding Chinese comments, AI hit a classic pit: the source file was saved as UTF-8, but the compiler parsed it using the local code page (such as GBK) by default, so multibyte characters were mistaken for syntax symbols and it produced a string of “illegal character” errors. AI first assumed it was an encoding-conversion problem and repeatedly adjusted the file format without success; it was finally resolved by explicitly specifying the source file’s character set as a compile option. This detail is a reminder: in low-level development that spans languages and encodings, “text is bytes,” and any implicit assumption can turn into a pit.
Stage 4: the Chinese breakthrough
Once glyph rendering worked, AI changed the score, lives, and game-over prompts all to Chinese and handled alignment and line wrapping. At this point, the project went from a “technical demo” to a “deliverable demo.”
Tally: what AI completed on its own
Looking back over the whole process, the work AI completed independently included:
- analyzing the basic structure and entry conventions of a UEFI application;
- planning and generating the complete project skeleton and build scripts;
- writing the core game logic (physics, collision, state machine);
- designing and implementing the Chinese bitmap rendering module;
- locating and fixing various compile, link, encoding, and runtime issues;
- iteratively optimizing the visuals and interaction feel.
The parts that required human involvement were concentrated on: providing a physical test machine that could be rebooted repeatedly, giving a directional hint when AI clearly went off track, and subjectively accepting the final experience.
Cost and retrospective
Time cost
The whole experiment, from zero to a playable version, took on the order of several hours, and the bulk of it was not spent “writing code” but on environment setup and problem localization—consistent with traditional low-level development experience: the bottleneck in hardware-related development has never been typing on the keyboard, but making the toolchain and runtime environment align with each other.
Economic cost
Using an economical model package for the whole process cost far less than an hourly-billed flagship model. For developers, this points to a pragmatic path: use an affordable model for daily iteration, and upgrade to a stronger model when hitting a hard problem, forming a “tiered calling” cost strategy.
Output statistics
The final codebase was about a few thousand lines, covering four layers: graphics, input, physics, and text. Although it was not polished through large-scale refactoring, as an experimental product in which no business code was written by hand, its structural completeness and runnability exceeded expectations.
Conclusion: AI is not a replacement, but a process restructurer
Back to the original question: can AI do low-level development?
The answer is: yes, but the approach is not “you say a sentence and it writes a paragraph.” It is “you set the framework, it fills in the flesh; you set the boundaries, it does the searching; you gatekeep quality, it takes on the repetition.”
For domains like BIOS, firmware, and drivers—where corpus is scarce and feedback chains are long—AI’s real value lies in:
- Lowering boilerplate cost—handing project skeletons, build scripts, and protocol boilerplate to AI;
- Accelerating knowledge retrieval and trial and error—turning “digging through the manual” into a “generate-and-verify” loop;
- Forcing a process upgrade—shifting the developer from “implementer” to “spec definer + acceptor.”
Of course, it also has clear capability boundaries: judgment when real hardware feedback is missing, sensitivity to implicit conventions, and the trade-offs among non-functional requirements (performance, power, compatibility) still require human experience as a backstop.
AI is not here to take away low-level engineers’ jobs; it is here to free engineers from repetitive labor so they can do the things that truly require judgment. Whoever gets this new paradigm working first will be the first to claim the next round of efficiency dividends.
