LLM-Assisted Firmware Development: New Board Porting and Debugging Practices

    For experienced embedded firmware engineers, this article examines two scenarios: porting an existing firmware baseline to a new board and debugging issues such as boot failures and peripheral anomalies. It covers where large language models can help—document analysis, change-list drafting, repetitive pin/clock/GPIO/device-tree edits, and hypothesis generation—and where engineers must retain control, including boot sequencing, power management, secure boot, production flashing, and hardware-timing-related register configuration. It also describes a practical workflow: converting PDFs to Markdown, staging work from requirements and specification through planning, execution, and review; using objective build-pass criteria; splitting tasks across subagents with write scopes and rollback; driving debugging with testable hypotheses; and capturing lessons as rules. The article recommends a small pilot before wider adoption.

    1. Scope

    This article is for experienced embedded firmware engineers and discusses two scenarios: porting an existing firmware baseline to a new board and troubleshooting debug issues such as boot failures and peripheral anomalies. The practices are based on common embedded development workflows and are not tied to a specific chip or toolchain. Platform differences, documentation quality, and validation conditions vary widely across projects, so readers should judge applicability for their own situation.

    2. What AI Can Do and What Must Remain Human-Led

    Large language models have some understanding of common chip architectures, boot-stage division, and configuration options. After receiving specifications for a new platform, a model can help identify which modules need to be rewritten and which only need parameter adjustments, and it can output a change list. This list is usually only a first draft; engineers need to check each item.

    Changes such as pin definitions, clock configuration, GPIO tables, and device tree descriptions are highly repetitive and suitable for batch completion by a model. The approach is to break tasks down to a single file or a single module and deliver only a small change at a time, instead of giving a vague goal such as “complete the port” in one shot.

    During debugging, a model can list failure hypotheses based on logs and provide a verification method for each hypothesis. This ordering comes from model inference, not measured results. Engineers need to confirm with an oscilloscope, logic analyzer, or serial logs.

    The following work should not be decided directly by AI: boot timing, power management, secure boot, production flashing flow, and register configuration related to hardware timing. When errors occur in these areas, problems may only surface at the hardware level, and the cost is high. AI output must be reviewed line by line by engineers.

    3. Prepare Materials First: Convert PDFs to Markdown

    When a large model reads a PDF, tables and register bit fields are often split apart, and misaligned columns can cause the model to give incorrect field meanings. After conversion to Markdown, table structure is usually preserved more completely and the model can locate content more reliably. However, the improvement depends on document layout and conversion tools; teams should test on their own documents.

    It is recommended to batch-convert platform specifications, register manuals, and display configuration guides into a reference directory, for example:

    1. refer/
    2. ├── docs/
    3. │ ├── platform_eds_v1.2.md
    4. │ ├── bios_spec_20261015.md
    5. │ └── display_config_rev3.md
    6. ├── schemas/
    7. │ └── register_map_soc_a.md
    8. └── CHANGELOG.md

    Put version numbers or dates in file names, and record the source file and modifications for each conversion in CHANGELOG. When the original PDF is updated, re-convert only the corresponding file; do not overwrite the entire directory.

    Conversion needs to handle three types of issues: watermark interference, table structure restoration, and extraction of information from images. A feasible process is to first perform layout analysis and remove watermarks, then restore table hierarchy, and finally add text descriptions for key diagrams. If documents contain internal keys, MAC addresses, or customer information, they should be desensitized before being added to the repository.

    Effectiveness can be verified with a small test. Prepare about twenty questions with known answers, covering register bit fields, pin multiplexing, and clock dividers; ask them against both PDF and Markdown and record accuracy. With too few samples, conclusions are not reliable enough, but this kind of test is sufficient to find obvious conversion errors.

    4. Workflow: Advance in Stages from Requirements to Verification

    Many intelligent programming tools support skill or rule orchestration. A process suitable for firmware porting can be divided into five stages:

    1. Divergent discussion: list modules involved in the port, known differences, and unknown points, and form a question list.
    2. Specification: write the goal as checkable items, for example, “UART0 outputs boot logs at 115200 baud on the new board.”
    3. Plan: split tasks by module, and specify input files, output files, and verification methods for each item.
    4. Execution: modify code item by item, and build immediately after each item is completed.
    5. Review: manually inspect changes and confirm each item against the specification.

    The point of this order is that the model will not directly modify files without a specification and plan.

    Teams need a unified criterion for “compilation passed” to prevent the model from drawing conclusions based on impressions. A reproducible approach is: run a fixed build command, save the complete log, check whether the exit code is 0, confirm that artifact size and memory usage are within the expected range, and finally run a smoke test on the target board, such as whether it can reach a serial prompt. The step passes only when all four are satisfied.

    In firmware projects, test-driven development can be implemented with host-side simulation. Write unit tests for pure logic parts and keep target-board tests for parts that depend on hardware. Teams should write the test framework and run commands in the rules file so that the model executes them the same way every time.

    5. Split Tasks with Subagents and Control Write Scope

    If a porting task involving dozens of files is all placed in the same conversation, details will quickly fill the context, and the model may forget the original goal. Assigning tasks to subagents can mitigate this: each subagent handles only one module, while the main conversation only dispatches tasks and aggregates results.

    Parallel execution carries risks of coverage and conflicts, so boundaries need to be set in advance:

    • Write scope: each subagent can modify only a specified directory. For example, one changes only board/new_board/, and another changes only drivers/display/.
    • Conflict detection: after a subagent finishes, the main flow checks git status and the list of modified files, and pauses merging when cross-modification is found.
    • Summary template: subagents return results in a fixed format, including modified files, build results, and unresolved issues.
    • Rollback mechanism: each subtask is completed on an independent branch or commit, and that commit is reverted if a problem occurs. Do not use forced reset to overwrite others’ changes.

    6. Debugging: Use Hypothesis Lists Instead of Blind Triage

    During debugging, the model can be asked to output a hypothesis list first, with each entry containing the symptom, possible cause, verification step, and expected result. For example, when there is no serial output, the list can include hypotheses such as the clock not being enabled, incorrect pin multiplexing, and a baud rate mismatch with the terminal, along with the verification method for each.

    Engineers eliminate hypotheses one by one from lowest to highest verification cost, and record the result back into the context after each elimination. A hypothesis list cannot replace actual measurement; final conclusions need support from logs, waveforms, or register readings.

    7. Turn Experience into Rules

    Problems encountered in a project can be organized into constraint rules and written into the rules file used by the model. For example, “after modifying the clock configuration, the readback value of the divider register must be checked.” Rules should be short, checkable, and annotated with the source problem. Too many rules increase context burden; outdated entries can be deleted periodically.

    8. Conclusion

    Large language models can take on part of the mechanical work in porting and can also help engineers organize debugging ideas. Whether they shorten the project cycle depends on the degree of difference between the platform and the old board, documentation quality, whether the validation environment is ready, and the time engineers invest in review. It is advisable to start with a small module as a pilot, record time consumption and the number of issues, and then decide whether to extend the approach to the entire porting process.