AI on my bench: an agent-friendly embedded dev setup

Tuesday, November 24, 2026

TL;DR

  • I made my PineTimePro dev environment “AI-friendly”: agents can build, flash, debug, read logs, take screenshots and use the UI by themselves.
  • They can now check their own work.
  • This works surprisingly well, but it’s not magic: it took a lot of time to set up, and I still review everything.

Introduction

I’ve been working on the bring-up of the PineTimePro for quite a while now, and I recently started working on the software that will be its foundation: the PineTimePro SDK, and NeoTime , the InfiniTime for the PineTimePro.

Bringing up new hardware is mostly experimenting: browse a huge SDK to find the parts that matter, write a driver, flash it, see what happens, test a new hypothesis, try again… Even with docs and examples, it’s rarely possible to set all the registers correctly the first time. It takes a lot of time and energy, and I thought this is where AI could help: it can read a whole SDK in minutes, and it can run many of those experiments for me.

But for that, the AI needs to be able to do what I do at my desk: build the firmware, flash it, see what happens on the watch, interact with it and check the results.

This post is about that: how I set up my development environment and my projects so that both humans and AI can easily experiment with the hardware.

I use several coding agents, some hosted and paid, some self-hosted. I won’t name them, because this setup doesn’t depend on any of them: the goal is to show the process, not to advertise tools. To be clear, I’m not into AI for the hype. I see those agents the same way I see my logic analyzer : tools that help me work faster, and it’s up to me to decide when and how to use them.

I’d like to take this opportunity to thank TL Lim, founder of Pine64 and PineStore , for sponsoring a generous LLM subscription for my work on the PineTimePro!

The hardware setup

Let’s start with the hardware setup. In addition to my desktop computer and the watch itself, I use:

  • a J-Link probe (generously donated by TL Lim as well!) to flash and debug the code running on the hardware
  • a USB-serial adapter for the debug serial port
  • an ALIENTEK DP100 lab power supply, which can be controlled from the computer over USB
  • an nRF PPK2 power profiler
  • a Saleae Logic 8 logic analyzer

With those tools, I can flash and debug the code, check the power usage, probe the signals (I²C, SPI, etc.) on the PCB, and read the logs from the serial port. That’s basically everything I need to build great firmware for the PineTimePro!

My dev setup: the PineTimePro, the J-Link probe, the USB-serial adapter, the lab power supply, the power profiler and the logic analyzer

Without those tools, I would be coding blind: I couldn’t see the code running on the hardware, debug it, diagnose communication issues or read logs.

And the same is true for the agents: without any additional “tools”, all they can do is write code from a prompt, the existing source code, documentation and online searches. And then, you, the developer, still need to flash, debug, diagnose, probe, measure and provide all that data to the agent so that it can fix or improve the code accordingly.

But what if the agent could use the J-Link probe and GDB to flash and debug? What if it could use the serial port, get data from the power measurement tool and drive the power supply?

That’s exactly what we’ll explore in the next sections.

Step 1: Experiments with AI, or how can an agent help me?

While experimenting with the new PineTimePro hardware and writing the basic infrastructure for NeoTime, I noticed that the “AI-assisted” workflow was:

  • Let’s write a plan to implement this feature / experiment with this driver / figure out how that part of the SDK works
  • The agent writes the plan, I review it (and often remove a lot of garbage and unneeded stuff)
  • When the plan is ready, I let the agent do its work
  • And when the agent is done, in addition to reviewing the code extensively, I build the firmware, run it and test it. If anything goes wrong (build issue, runtime issue, crash, feature not working as expected), I either fix it myself or report back to the agent.
  • … rinse and repeat until it works the way I want.

This workflow can be quite frustrating: the agent announces with a very high degree of confidence that it’s finished, but the project does not even build or run properly.

So the idea was simple: give the agent a way to check its own work so that it can loop until the project builds and runs as expected on the hardware.

The first tool the agent needs is a way to build the project. This one is quite easy since many harnesses already provide a way for the agent to run commands on the computer. This allows the agent to read the documentation of the project and run cmake and make to build it and check for any errors.

When working on desktop applications, the agent can also use the command line to run and debug the application. But in this case, the application does not run on the local computer. Instead, it runs on external hardware that is connected to the computer with an SWD probe and a serial port.

Just around that time, I learnt about a new feature in CLion 2026.1: agentic debugging . CLion basically exposes the IDE’s debugger through an MCP server, which allows any agent to discover and use it.

And it worked… with smart enough models. Self-hosted models that are small enough to run on my computer would sometimes make silly mistakes in tool calls or hit an error and try to work around it in very unexpected ways, but bigger models would work quite well (and even better with a skill, more on that in the next section).

Of course, the agent could also use GDB and OpenOCD directly from the command line, but using the CLion tools allows the agent to use exactly the same tools as me. I can see what it is doing, I can see the breakpoints in the code, I can see the debugger output. There is exactly one place where the whole interaction with the hardware happens, so I can always follow what the agent is doing and jump in whenever I want.

Building and debugging already provide a lot of feedback to the agent, but we can do more! The PineTimePro is equipped with a serial port that can be used to output debugging logs. Why not instruct the agent to use that communication channel as well? The agent can read the logs and also add new debugging logs when trying to figure out how things work at runtime!

When working on NeoTime, I also use my eyes (to check what’s displayed on the screen) and hands (to interact with the UI). How can I give eyes and hands to the agent?

Most models have vision capabilities: they can analyze a picture and describe what’s in it. And it turns out that taking a “screenshot” in the current implementation of the graphics driver is quite easy: the whole frame buffer sits in RAM. This allows the agent to read that frame buffer and convert it to a PNG file using a small Python script.

Last but not least: user inputs. The agent needs to be able to interact with the UI like a human can. I don’t want to build a whole robot to allow the agent to actually tap and swipe on the touch panel. Instead, I instructed it to implement a small “debug console” that allows it to send commands via the serial port. These commands are then received by the firmware which executes the corresponding action, like swiping and tapping on the display or pressing a button.

Those were all ad hoc experiments: I just chatted with the agent, asked it if it had any way to build, flash, debug, read the serial port, get a screenshot,… There was some back and forth, and some trial and error, and the agent eventually figured out how to do all of those tasks. But in the next session, a new agent would start from scratch and figure everything out again. That’s where skills come in.

Step 2: Skills

Now that I knew agents were able to run those tasks, I wanted to make sure they could run them over and over again:

  • without making new mistakes (LLMs are very good at inventing new ways to mess things up),
  • without having to rediscover everything and re-invent the wheel,
  • and even with smaller models.

Skills are the perfect way to reach that goal. A skill is basically a text file (usually written in Markdown) that describes how to execute a specific task. It contains everything the agent needs to know to execute that task as reliably as possible.

You can write those skills yourself or… make the agent write them for you. Here’s how I did it:

  1. Make the agent succeed at the task.
  2. Ask it to write the corresponding skill.
  3. Start a new session, with a fresh context, and ask the agent to follow that skill.
  4. If something goes wrong, ask the agent to fix the skill so that it doesn’t run into that issue next time, and go back to step 3.

I ended up with skills that work but… I don’t like the wording. When you read them, you immediately notice that they were written by an LLM. I’ll definitely review those skills before publishing them!

I also wrote a small AGENTS.md file that describes the project to the agent:

  • short description of the project
  • project layout
  • list of skills
  • rules that are specific to my setup (for example: build the project with the CLion tools, not manually with cmake/make)
  • rules about how I want the agent to behave (for example: if an unexpected error happens, don’t try to work around it: stop and report back to me)

This file is injected into the context of every new session, so it’s important to keep it short (so it doesn’t bloat the context), but with enough information that the agent doesn’t need to rediscover the project each time a new session is started.

The skills and the AGENTS.md file made those tasks much more reliable, even with smaller (self-hosted) LLMs!

Step 3: See it in action

It honestly felt like magic the first time I asked the agent to make a small change in the code (make this button red), build it, flash it, run it and take a screenshot as proof! I could see everything happening in real time in my IDE, in the serial console and on the watch. And the agent eventually showed me the screenshot, with the button now drawn in red.

For this post, I recorded a similar demo. In a single prompt, I asked the agent to build, flash and run the firmware, stop on two breakpoints and show some local variables, use the debug console to switch to the analog watch face, and finally take a screenshot of it:

The agent builds and flashes the firmware, stops on breakpoints, switches watch faces through the debug console and takes a screenshot, while I watch in CLion and on the watch

Remember the frustrating loop, where I had to build, flash and test everything myself? Here, the agent does all of it on its own, using every tool we set up in the previous steps: build, debugger, serial port, user inputs and vision.

Step 4: Do some actual work

Now, does it work for actual development tasks? Oh yes, it does!

One of the first things I tried with this setup was to… make the agent run Doom on the watch. I did not expect much out of it, and my prompt was very short, something along the lines of “This is the firmware for a smartwatch. It implements most of the low-level drivers (display, button, touch panel, audio). I want you to port Doom to it. The first step will only implement the video, we’ll add user inputs and audio afterward”.

And to my surprise, it worked! If I remember correctly, the very first try was not functional, but after a couple more messages, I could admire Doom running pretty well on my PineTimePro. And within a few more turns, the agent implemented the audio and the user inputs.

While the agent was working, I could see it editing the code, flashing and running it, reading the logs and taking screenshots. And it only stopped once it had checked that the code worked as expected and that Doom was actually running.

Doom running on the PineTimePro

Afterward, I used those same skills to do more serious work like planning and implementing a more complete debug console, analyzing the performance of the video pipeline and testing a few optimization ideas, and adding unit tests to the code.

Each time, the agent could check its own work on the real hardware. It worked surprisingly well… but it was not all magic.

Caveats and lessons learned

Reading this article, you might be tempted to think that building this setup was fast and easy.

But you would be wrong! All of this took way more time than I expected and was often quite frustrating. The agent can be very useful at times (I would have spent hours porting Doom, it did it in a few minutes) but also very stubborn. For example, even though I told the agent to “stop and report back to me in case of unexpected errors”, it would often try to work around issues it couldn’t fix (like the J-Link probe crashing and needing a full power cycle to come back to life).

Then, when a skill seemed good, I would use it in real tasks, and the agent would fail once again. And in that case, I needed to stop what I was doing and figure out what went wrong.

And even when this setup worked fine, it’s still not a silver bullet that makes AI-generated code ready to be pushed to the repo. I, as the human developer, still need to review the changes, make sure the original design is respected, that the code looks exactly how I want it, and that the agent hasn’t been overzealous and added unnecessary things “just in case” or for “future-proofing”. That review often takes way longer than writing the code took the agent.

Conclusion and what’s next

I’m very impressed by what this environment made possible. I can now delegate boring tasks (like adding debug code, trying multiple ideas to reach a goal, rapid prototyping) that would have taken me hours to do by myself.

Even if the project is now “AI-friendly”, I want it to stay “human first”. Most of the things I added are usable by a human developer as well: for example, the scripts the agent uses to take a screenshot or read the serial port can also be run from the command line. To be honest, I would have built most of these tools anyway. Every step the agent executes can also easily be done by a human. The goal of this setup is to have AI agents assist human developers, not replace them.

The key takeaway of this experiment is that an agent that can check its own work stops being a code generator and becomes an experimenter. That feedback loop is what took the agent from “sounding very confident that it was finished” to actually getting things done.

And there is still a lot to add. The next step is to give the agent access to the rest of my bench: drive the power supply (to power cycle the watch when the probe crashes, for example), read the measurements from the power profiler, and maybe even use the logic analyzer. I also want to try the new hard fault analyzer in CLion .

All in all, it was a great learning experience, and I’m sure it’s just the beginning!

Embeddedpine64pinetimeproneotimeAIembedded

JF

I am passionate about IT, (embedded) software development and open source technologies in general. I’m mainly working on the InfiniTime project , an open source firmware for the PineTime smartwatch from Pine64 .

A Week with OpenClaw: My Experience as a Tech Tinkerer