AI-Assisted Low-Level Graphics Development in BIOS/Firmware: A Practical Experiment and Cost Review
This article examines a focused technical question: can a general-purpose AI coding assistant make meaningful progress on firmware graphics work when there is no local codebase, minimal human guidance, and only a basic build environment? Instead of comparing commercial products, it abstracts the problem into an experiment: build a Breakout-style game that runs in a firmware command-line environment, supports Chinese text, and can be launched from removable media. The article covers the constraints, project scaffolding, early build failures, feature and rendering iterations, UTF-8 font handling, cost control, risk review, and the boundary between AI-generated code and human verification. The main takeaway is that AI can handle substantial verifiable code generation and debugging support, but low-level hardware details, protocol semantics, memory layout, and release quality still require human review.
1. Background: Why Low-Level Development Faces More Skepticism
In discussions of intelligent coding assistants, a common disagreement is whether AI can participate only in higher-level application code, or also in low-level work such as BIOS, firmware, register operations, and protocol stacks. This article does not benchmark any specific commercial product. Instead, it abstracts the problem into a general technical question: under constraints of an empty local codebase, minimal human guidance, and only a basic build environment, how far can a general-purpose AI coding assistant push a firmware graphics program? What are the costs, risks, and engineering practices involved?
The key difference between low-level development and higher-level application development is not language syntax. It is the lack of runtime support, limited debugging tools, and tight coupling between protocols and hardware details. Higher-level development can rely on mature frameworks, standard libraries, package managers, and abundant examples. A firmware environment often provides only a minimal runtime, a limited graphics output protocol, hand-written resource management, and a strict build pipeline. As a result, a common industry view is that AI can handle business UIs but tends to produce hardware-related code that “looks plausible and then fails at runtime.”
This judgment has some merit, but it should not be simplified into “AI cannot do low-level work.” A more accurate statement is that AI can take on a large amount of verifiable code generation and debugging support, but it must form a closed loop through knowledge-base supplementation, interface contracts, minimal runnable validation, and critical human review. The practical goal of this article is to test how far that loop can go under strict constraints.
2. Challenge Setup: Minimizing Variables
To avoid manual code patching masking the AI’s capability, the challenge rules were strict:
- Environment constraint: In a desktop operating system environment, only a basic integrated development environment and compiler toolchain were installed; no additional helper tools were prepared.
- Code constraint: The local codebase was empty. No business code was written by hand; the main source code, resource handling logic, and build scripts were generated by AI.
- Guidance constraint: No professional implementation guidance was provided. Only runtime behavior, error logs, and acceptance results were fed back.
- Goal constraint: Develop a graphics Breakout game that runs in a firmware command-line environment, supports Chinese text display, and can be launched from removable media.
- Acceptance constraint: It must build, start, provide basic input and collision behavior, include level and state switching, display Chinese text, and come with build instructions.
Breakout was not chosen at random. It has a clear structure and complete logic, and it covers core elements such as graphics rendering, user input, collision detection, state machines, resource management, and level design. It is a classic case for testing programming capability. Similar tests had been run in web and mobile environments, where complexity was relatively controllable. In a firmware environment, however, support such as standard graphics libraries, file system wrappers, and font support is notably missing, so complexity rises significantly.
3. Tool and Cost Strategy: Not “Strongest,” but “Sustainable”
High-performance models often perform better in response speed, logical coherence, and decomposition of complex tasks, but pay-as-you-go costs are higher. For daily development, occasionally using a high-performance model for key decisions is acceptable, but long-term high-frequency use requires a more controllable cost structure. A useful analogy: a high-performance sports car is excellent, but most engineering teams need an economical family car that can keep running.
Therefore, this experiment used a subscription-based general-purpose code generation service as the main tool, supplemented by a local knowledge base for context. The knowledge base contained only necessary materials: firmware project directory notes, summaries of graphics output protocol headers, coding conventions, build script samples, and typical error logs. The point was not to compare model rankings, but to verify whether stable output could be achieved under a controllable cost by supplying context and accepting results in stages.
4. Phase 1: From Zero to One
4.1 Requirements Breakdown and Project Skeleton
The AI first produced a module breakdown: program entry, graphics drawing, input handling, game logic, font parsing, resource packaging, build scripts, and documentation. An illustrative directory layout is shown below:
project/src/main.csrc/gfx.csrc/input.csrc/game.csrc/font.cassets/scripts/buildREADME.md
The value of this step was to establish interface contracts first: fix data structures, function signatures, and module boundaries, and then let the AI fill in implementations. Otherwise, the AI tends to change naming and parameters across rounds, causing rework.
4.2 Incident 1: Copying an Entire Firmware Project Directory by Mistake
In the early stage, the AI suggested copying a complete firmware project directory as a base. This led to build target conflicts, overly long paths, missing dependencies, and a confused output directory. The reason is that low-level project directories are tightly coupled, and a complete example is not the same as a minimal project. The fix was to keep only a minimal startup skeleton, define the build entry point, linker script, and output directory clearly, and isolate the game modules in a separate directory.
The lesson: in low-level development, a “compilable example” cannot be treated directly as a “maintainable minimal project.” Trim first, then add incrementally.
4.3 Incident 2: A Detour in Command-Line Builds
The first build ran into issues with path separators, case sensitivity, link order, resource packaging, and target format. The AI could provide directional advice, but the solution had to converge using actual error logs. An effective approach was to paste only several lines around key errors in each round, ask the AI for a minimal patch, and require it to explain the basis for the change and the rollback method. This was more efficient than submitting a large batch of logs at once, and it was less likely to introduce new problems.
4.4 First Successful Run
The minimal runnable version drew only a rectangular paddle, a ball, and bricks, and supported keyboard paddle movement and collision bounce. The acceptance criteria were: the build artifact starts, does not crash, exits normally, and responds to input. The core logic can be represented by the following pseudocode:
typedef struct { int x, y, vx, vy, w, h; } ball_t;void ball_step(ball_t *b, int left, int right, int top, int bottom) {b->x += b->vx;b->y += b->vy;if (b->x <= left || b->x + b->w >= right) b->vx = -b->vx;if (b->y <= top) b->vy = -b->vy;if (b->y + b->h >= bottom) {/* Lose a life, reset ball position, or switch state */}}
A real implementation also needs to handle coordinate clipping, frame-rate control, input debouncing, resource lifetimes, and abnormal exit. The significance of the first successful run was that it established a feedback loop: from then on, every round could proceed through build, run, screenshot/log, and fix.
5. Phase 2: Iterating from a Working Prototype to a Better One
5.1 Feature Enhancements
On top of the minimal version, the work added multiple levels, brick durability, scoring, pause, restart after failure, and a state machine. The AI first provided a state diagram and then generated code; humans pointed out problems based on runtime feedback. The most effective method here was to fix interface contracts: for example, define game state enums, input event structures, and drawing function signatures to prevent the AI from repeatedly refactoring during iteration.
5.2 Visual Improvements
Visual improvements included double buffering or partial refresh, color themes, boundary hints, and simple animations. Low-level graphics output requires attention to pixel format, row alignment, refresh regions, and clipping. The AI can generate drawing wrappers, but pixel formats and coordinate mapping must be validated on the actual screen; code cannot be accepted merely because it looks correct.
5.3 Display Challenges
Display work mainly involved resolution adaptation, coordinate scaling, clipping, and font rendering. Incident 3 was a compilation issue caused by Chinese comments: source file encoding, compiler handling of non-ASCII comments, and inconsistent encoding in build scripts can all cause compilation errors that appear unrelated to logic. The solution was to unify source file encoding, separate comments from strings, manage resource files independently, and specify encoding requirements in the build instructions.
The path to Chinese text display was to embed a font subset, use bitmap glyphs, parse UTF-8 code points, look up glyphs by code point, and draw them into the framebuffer. The logic is illustrated below:
int draw_utf8_text(int x, int y, const char *s) {while (*s) {uint32_t cp = utf8_decode(&s);const glyph_t *g = font_find(cp);if (g) blit_glyph(x, y, g);x += g ? g->advance : 0;}return 0;}
A real implementation needs to handle missing glyphs, character width, transparent color, clipping regions, and resource size. Chinese text display is not as simple as “writing one more string”; it is a combined problem of encoding, font data, rendering, and clipping.
6. What the AI Completed Independently
Under the constraints of this experiment, the AI mainly completed: requirements breakdown and module division, interface drafts, game loop, collision detection, levels and state machine, graphics drawing wrappers, input handling, font parsing and rendering, build scripts, resource packaging suggestions, error log analysis, and documentation. Work that humans could not omit included: runtime verification, screenshot and log feedback, compliance review, review of critical low-level details, and final acceptance.
The conclusion is that AI can complete a large amount of “verifiable code generation,” but it cannot replace the developer’s responsibility for hardware timing, protocol semantics, memory layout, and release quality. In low-level development, AI is more like an efficient code drafter and debugging assistant than an unsupervised final owner of quality.
7. Cost and Retrospective
Time cost was roughly distributed across environment setup, first build, feature iteration, Chinese text and display work, and documentation/retrospective. First builds often take longer than expected because low-level projects are more sensitive to paths, encoding, linking, and output formats. On the economic side, high-performance models used on a pay-as-you-go basis can be costly. Using a subscription-based general-purpose code generation service, compressing context, reusing summaries, submitting changes in stages, and sending only key errors can significantly control the budget.
Output metrics should not focus only on lines of code. They should focus on runnable artifacts, build scripts, resource files, documentation, and reusable prompt templates. Risks mainly include hallucinated AI interfaces, encoding issues, unclear resource licensing, and non-reproducible builds. Best practices are: establish a minimal knowledge base, fix interface contracts, build a minimal runnable version first, change only one variable per round, keep version rollback options, close the loop with logs and screenshots, and manually review critical register and timing operations.
8. Conclusion
The value of AI in low-level BIOS development is not a simple “can it write code” question. It is whether AI can form a verifiable engineering loop under constraints. General-purpose AI coding assistance is suitable for scaffolding, algorithm implementation, UI drawing, debugging support, and documentation. Critical hardware details, protocol consistency, and release quality still require human review. If teams use general infrastructure services such as Baidu AI Cloud to retain build logs, test screenshots, requirements documents, and knowledge bases, they can improve the efficiency of context supply, but the core remains the validation loop and responsibility boundaries.
A reusable prompt template can be summarized in five parts: role and constraints, current project structure, key error logs, request for a minimal patch, and acceptance criteria plus rollback plan. Putting AI inside a verifiable process, rather than handing the process over to AI, is the safer approach for low-level development.
