Using AI Speeds Security Tooling
This article discusses a case study of using a large language model (LLM) to develop a tool for embedded security, that would have otherwise taken several weeks (or months) of effort in a few days. It shows how some embedded-specific issues come up, and walks the reader through the steps of getting these tools set up and running.
In the previous article (Circuit Cellar issue #430), I discussed using a simple tool to help with embedded security audits. This tool (called MapleLink) has a serial interface, SPI flash dump, and other features. What makes it unique is that the GUI uses a web interface served from the tool itself, which was a feature I particularly wanted for use in teaching and other environments where installing tools may be more difficult.
In this article, I’m going to discuss how I created that tool in a few days, using large language model (LLM) based coding assistants, such as OpenAI Codex or Claude Code. My experience with them has been positive, and I thought it would make an interesting article, as I find many people have not pushed them into their embedded workflow.
For security work, we often want application-specific tools that would normally be too time-consuming to build. LLM coding tools provide a shortcut: they can generate the boring scaffolding quickly enough that a one-off tool becomes practical.
I hope by showing you a practical example, it might give you the boost you need to try it with your own projects. I’m also going to be approaching them using the most straightforward method, one that lets you continue development in “almost” the same way you do now.
At a minimum, these coding agents speed up tedious work: writing boilerplate code, navigating unfamiliar libraries, generating tests, and creating small drivers or examples. But they aren’t perfect and can do things such as invent register names, confuse architectures, misunderstand timing constraints, and generally produce code that compiles but fails in real life. The practical lesson is that LLMs are most useful when they are treated less like an oracle and more like a junior engineer with unusual speed: helpful, tireless, sometimes brilliant, but in need of context, constraints, review, and real tests.
Chatting or Agentic Usage
There are two broad ways developers are using LLMs today. The first is simple code-assistant usage, which is typically how you would use it if limited to only the web chat interface. You can ask for something like a CRC routine, a linker-script explanation, a Python script to parse serial logs, or a minimal example using an existing HAL. The model produces code or explanation, and you review, paste, adapt, and test it. This mode works especially well for local, bounded tasks where the input and output are easy to inspect.
The second is agentic usage. In this mode, the model is not just answering a question. It is operating inside a repository using tools: reading files, editing code, running build commands, inspecting compiler output, adding tests, and iterating. Common Codex and Claude Code usage are examples of this style. You can ask more complex questions or generate more complex prompts, such as, “add support for the LIS3DH accelerometer using the existing I2C abstraction, follow the style of the existing BME280 driver, add unit tests for register packing, and run the firmware build for the nRF52840 target.” The agent explores the repository, proposes a plan, edits files, runs commands, and reports what passed or failed.
For embedded projects, the agentic workflow can be much more useful than isolated prompting because the important knowledge is rarely contained in a single file. The answer depends on the board definition, library configuration headers, and many other files. A coding agent that can inspect the project has a much better chance of using the existing architecture and giving you the expected results. The usefulness of these tools is bounded by the quality of the feedback loop you can close around them.
A model that can compile your code, run it, and read the results will converge on something that works; one that can’t is guessing. You can also close that loop “manually” if you want to understand how they work, and in fact that is exactly what I’m going to show you here. It’s not as efficient, but for getting started might be just what you need to convince yourself of the value.
Setting up Code Support
In this example, I used the OpenAI Codex tool, but the setup (and caveats) are similar between other tools. Currently, Claude Code and Codex are the most popular, but with a well-configured project, you shouldn’t worry too much about which vendor you use. A correctly configured project will constrain the tool to provide results closer to what you expect.
For a user interface, I used Visual Studio Code (VS Code) as my editor. This is a common editor I use, as it is reasonably lightweight and has good cross-platform support.
Enabling code support will typically require a paid subscription. My article in Circuit Cellar issue #430 used the ChatGPT Plus plan; at $20 a month (when the article was written) it’s easy to justify even for side projects. These plans typically have usage limits that you’ll hit as you ask the tool to do complex tasks, and need to take a pause for it to reset. The basic plans will use your credits more quickly than more expensive plans.
After installing VS Code, there is a small extension or chat setup needed. Once this is done you’ll get a sidebar as shown in Figure 1. This shows your typical file browser on the left, the code itself in the middle, and a “chat window” on the right.

The VS Code editor is configured with a LLM interface, shown on the right third of the screen.
That’s about all the setup we need to start working with your project!
Starting a New Project
One task that is worth doing before anything else is writing down any constraints you want the code generation to follow. This is typically part of a file called AGENTS.md (Codex) or CLAUDE.md (Claude Code).
This file lets you define how the tool will work with your code. You can tell it to use specific libraries, specific code styles, and you can also tell it about your personal preferences. In this file you can (should) also specify embedded-specific “requirements”, such as telling the tool to avoid using dynamic memory allocation, if certain sections of the code are timing-critical, and other factors that might be obvious to you but should be spelled out for any future changes.
In general, when working with these tools, you should treat them as a very gung-ho junior developer or intern. They may not have your experience, but they are willing to try different ways of accomplishing the goal. Giving them some constraints can be a very helpful thing to do!
For my project, I also started with a working base. In my case I used an example from the TinyUSB stack called net_lwip_webserver, which implemented a HTTP webserver over USB Ethernet. This meant that I had code I could compile for my target (Raspberry Pi Pico), which did some hardware bring-up. It also had an available SDK for the microcontroller, so when new peripherals were needed there was a trusted code-base.
But I didn’t even use a real agentic mode for my initial development, in that my Codex instance didn’t have access to a working compiler or hardware. This is a deliberate trade-off worth understanding. You stay in control and see every change, but you give up the agent’s ability to self-correct, so every regression is yours to catch. It’s a fine way to start; just know that’s the limitation you’re accepting. This will mean the LLM is giving you commands to run during debugging, but it was helpful to understand exactly where it struggled to help me better understand constraints to give it moving forward.
The other point with this, is that when just starting out you may find it easier to just have the code tools modifying the source code, and you are still looking at all the changes and compiling and testing. This lets you use a different IDE for compiling and debugging for example.
You’ll eventually want a way to automate testing, because the central lesson with these tools is that they need feedback. It will drastically improve your productivity when the agent isn’t waiting on you anymore.
Asking for Help
Once you’re up and running, it’s time to ask your new friend for some coding help! I’ve copied the planned architecture from my prior article into Figure 2, which shows how data is routed in my firmware. I started with just getting the serial console working, and asked it to generate an appropriate WebSocket connection to a HTML webserver, as well as generating the HTML page itself.

The architecture of the MapleLink tool, which has a webserver used to serve a HTML website (developed by the LLM) that gets data over a WebSocket interface.
In my initial setup it would show me each change, and afterward summarize what changed, as in Figure 3. This output was from one of the initial setup steps, so you can see a description of the initialization of the various server apps.

A more detailed example of a response, showing how it allows you to view specific changes to the files that are being made.
Changes can be simple or complex. Be sure to ask for changes that make life easier for whoever works on your code next, whether human or robot. This might include adding in various logging features, for example, but you can also ask for changes and improvements to the build system too. For example, I had the tool generate a Python script that would automatically convert a .html file into an embedded C array on every build.
Having the tools write documentation is another good idea, and something that can be added to the AGENTS.md file. You’ll see at minimum many projects include an ARCHITECTURE.md file or similar, with instructions for the ARCHITECTURE.md file to be updated with any changes in architecture.
Not Invented Here on Steroids
When asking for new features, one thing you might discover is that the tool might invent entire software stacks. These stacks are unlikely to be as well tested as existing libraries. Most embedded projects already have at minimum some hardware abstraction layer (HAL), but you can likely quickly find more advanced drivers and application-specific libraries such as graphic libraries, signal processing, and more.
Regular human engineers aren’t immune to this—many companies suffer from what is called “Not Invented Here” (NIH), where engineers decide to build their own software stacks because what was already there wasn’t as good as they would make. Making available these stacks, or asking in planning mode about available external libraries, is a good first step.
Hardware Challenges
One challenge I often ran into with the tools is that implementations weren’t appropriate for embedded systems, even though on a surface-level inspection it appeared to be. You can improve your results here by using a planning pass where the tool evaluates how to architect a change before implementing it.
As an example, one feature I asked it to add was a SPI “sniffer.” That is it should simply monitor the SPI data lines (both the input and output lines), and using the clock (CLK) and Chip Select (CS) lines frame the data lines into packets. If I asked you to implement it, you’d inherently understand that this would require using some hardware peripheral.
The first pass, however, attempted to use a “bit banging” approach—that is, to sample the CLK, CS, and data lines in a software loop. This might work at a few kilohertz (kHz), but at typical SPI speeds there was no hope of this working at all! It took several passes of this before the system used the Pico I/O block (PIO), which could then automatically sample the data and feed this into a FIFO buffer.
While I did eventually end up with a reasonable solution, it also showed the importance of writing down specific requirements. If I had dug into more details during the planning pass, I also could have likely gotten to the final solution more directly.
A similar issue happened with the eMMC implementation. This required careful consideration of where data sampling was happening on the clock edges. I found that in “chatting” with the tool it was thrashing around and changing the edges and trying to see if it “worked now.”
In this case I wrote the program myself to do the data sampling from first principles—perhaps with enough detail it would have got there, but in the end it was faster for me to feed in a working program.
Again, these tools may write a lot of software, but they are still missing the hardware and architecture context. That is where you provide the most value with using them in embedded systems. It may also be pulling in incorrect or bad assumptions, after all the training data isn’t only the best code, but might include bad code!
The Joy of Testing
One major use-case for LLM tools is to help with generating complex test harnesses. Even if you don’t trust the robot for writing your code, you might find that it could at least generate test vectors and harnesses for you!
This is especially important if you are using LLM tools for development. For example a problem that I didn’t uncover with MapleLink until much later was the UART terminal could bog down with lots of data, and drop characters. This requires setting up another device as part of the test, but if I had set up this environment first it could have been caught earlier in the development.
These tests are important because, as code is modified, there may be unintended side effects if the architecture isn’t as robust as you expected. Having tests is critical to provide feedback to correct problems.
While I don’t know if I’d use these tools for writing my safety-critical code, I’ve been very impressed with how they work overall (even for a sceptic on AI tooling). This is especially the case when it comes to many of the annoying tasks in embedded work, such as building a user interface or writing complex test vectors or test harnesses.
The browser-based UI that makes the MapleLink tool unique was the part I most wanted, but also the part I least wanted to hand-write. With a LLM helping this came together in a fraction of the time it would have taken by hand. That’s what turned the whole tool into a few-days of effort instead of a few weeks (or months).
If you’ve been avoiding trying out some of the tools, I’d encourage you to set up a basic VS Code chat with Codex or Claude Code and see what it can do on a simple codebase. You might find it provides an opportunity to finish off some of those projects that you let languish from lack of time!
PUBLISHED IN CIRCUIT CELLAR MAGAZINE • JULY 2026 #432 – Get a PDF of the issue
— ADVERTISMENT—
—Advertise Here—
Colin O’Flynn has been building and breaking electronic devices for many years. He is an assistant professor at Dalhousie University, and also CTO of NewAE Technology both based in Halifax, NS, Canada. Some of his work is posted on his website (see link above).

