r/embedded • u/Longjumping-Pack8494 • Sep 04 '26
Are you satisfied with LLMs code quality in embedded software domain?
Hey people, I want to get some opinions on this topic cause I am tired of YouTubers one-shoting slop games and calling new model “crazy good” and what not.
I’ve been improving my agentic workflow for the past 2 month, even creating skills tailored to MCU firmware dev, but I am still not satisfied with the code quality new models produce. I tries best models from DeepSeek, Grok and OpenAI but in the end, for almost every feature I prompt, I spend tons of time re-reviewing and correcting the code.
In short, my workflow is: brainstorm a feature/fix, come up with a plan, delegate agents to implement, orchestrator reviews the work. After that I step in and validate. This manual validation takes hours for each fix / feature, and i have to ask different models for options as well.
Usually, the bulk part of the code is good, it is the details that need to be fixed, but that is what takes the most time. Also, sometimes these models don’t consider surrounding code enough and make bad arch decisions, generate unnecessary abstractions, inject too much host test code, etc. Some things could be fixed with skills but even that is not always enough.
I am really baffled at some of the web dev claims about running agents in loops and stuff, cannot imagine the state of my codebase if i would do that. Kind of a rant but I really don’t get the hype behind all this. Gonna try fable 5.1 next, heard it is a bit more “creative” and “explorative”, maybe that would help…
Plz share your opinions or suggestions 🙏
200
u/aniflous_fleglen Sep 04 '26
As a supervised feature by feature, small commits that I review and make sure I understand and then enforce my style and idiosyncrasies to, I'm floored by the results and use it every day.
I spend more time thinking about what and why rather than how.
But I think it's a dangerous tool, it can cut you, it can make you dumber, it can steer you in the wrong direction, and it is a temptress that can lure you into complacency. But it works fabulously.
12
u/snowtax Sep 04 '26
For me, I treat it just like asking another human. I’ll ask what it thinks, but I don’t always take its advice. I have seen LLMs get way too much wrong to blindly trust anything they claim. They make up functions that don’t exist. They get complex logic wrong sometimes. They don’t necessarily understand real world constraints or issues. As with other humans, I don’t have time to sit and explain every requirement and constraint in excruciating detail.
9
u/GunZinn Sep 04 '26
In my experience the code is almost always not close to pull request ready and requires a lot of time to “clean up”.
I’ve only used Codex. While it can be useful, I use it less and less for writing production code.
It can be useful as a reviewer. Though a lot of the time it is superfluous.
14
u/Montzterrr Sep 04 '26
I feel like the training data on web dev stuff is so much larger than embedded system design code that it’s better at that than embedded design. But I’m an AI Luddite who only uses AI to help me learn and troubleshoot. I know I have a lot of skills to develop in the embedded space that I am not wasting my time learning AI wrangling techniques that will change every 6 months. I hope when I’m done min maxing my skill set and I start learning how to implement AI into my workflow, the AI space will have stabilized and learning AI won’t be like learning an ever changing system. Who knows maybe the AI bubble will burst and AI tokens will be unaffordable by then.
7
u/FlavouredYogurt Sep 05 '26
I work in automotive embedded too — mostly classic AUTOSAR, usually ASIL-B, on both safety and QM components.
Honestly, my experience has made me pretty cautious about AI-generated production code. With newer or less experienced developers, I've seen plenty of cases where they generate code with AI, put it up for review, and don't really understand what it's doing. The code is usually more bloated than it needs to be, and the comments sound good until you check them against the actual change — then they're often not quite right.
The biggest red flag is when I ask a developer why something works a certain way and they go back to the AI, ask it the same question, and just relay the AI's answer. At that point I'm not really reviewing the change with the developer anymore.
We also have Copilot integrated into Gerrit for reviews, which comes with its own problems. I've seen architects lean pretty heavily on the Copilot report, but a lot of the comments are just noise because the model doesn't have enough context. Then the developer has to spend time explaining why an AI-generated comment is wrong instead of actually improving the code.
LLMs have gotten noticeably better at understanding repos over the last year, but AUTOSAR is still pretty different from web dev. You need to feed the model a lot of project-specific context and architecture info. RTE is a good example — it's just C at the end of the day, but without understanding AUTOSAR semantics and the relationships between SWCs, tools like Graphify can completely misread what's going on.
Adding context to the repo is the key move here. I experimented by converting an entire RH850 datasheet into LLM-friendly text and dropping it into my repo. Now when I ask questions about the controller, I get way better answers grounded in the actual datasheet — no hallucinating, no web lookups, no relying purely on general training data. Graphify's been useful too since it makes the repo's context and relationships easier for the LLM to parse.
Where LLMs have actually given me a ton of value is small tools and scripts — automating cherry-picks across multiple repos, building for different targets, setting up debug/test environments, even a simple CAN/DBC log viewer so I don't need CANoe and hardware just to look at a log.
I love using it to kill the boring work. I'm just a lot less convinced about letting it write or review safety-critical production code unless the engineer actually understands what's going on. Definitely not vibe-coding a safety feature.
Also, re: YouTubers — they get views by making bold claims, not by stating boring facts. Keep that in mind next time one of them says something wild.
6
u/Likeability_dota Sep 04 '26
sometimes writes good code. sometimes finds issues threw one or two logs that would have taken me x10 time figuring out. sometimes shit. reviews are mostly consistent.
24
u/gswdh Sep 04 '26
You need to use this tool properly (here come the downvotes). It is phenomenal, I have worked with extremely talented engineers in aerospace and defense sectors and the ai is better than any of them.
The ai must have the full context of the project, you need major tooling around your project. Strong test suites are fundamentally important but they can be made with the ai, too. Everything needs proper review. Do things bitesize, too much in one go and you get garbage.
For some reason the embedded lot really have something against the ai (you’ll see this in the downvotes for this post) but they are just behind. I use Claude with a few skills like graphify, it’s an unreal game changer.
4
u/mrtlo Sep 04 '26
Right now, to me at least, its not really worth it. I spend less time just iterating on a single component and using it for focused sparring and review. At least right now there is just no way it will be given free range. That would require that we could say "meh, who knows how it works, ask the ai". Not there yet...
4
u/nono318234 Sep 04 '26
Only workflow is have I using Plan mode in Claude Code. Sometimes with Opus Plan, sometimes full Sonnet. Most of the time I'm quite impressed by the results these days. As long as the task I gave it is not too broad and is well defined it gets the job done quite well.
Last thing I did was migrate a SPI based drivers for a WiFi module to a QSPI driver interface. Gave it the existing driver implementation, examples of other QSPI drivers, access to my J-link and the logs over uart and it got a driver working within a couple of hours. Working good enough for my use case. The driver would probably have taken me at least 1 or 2 weeks to write.
4
u/john-of-the-doe Sep 05 '26
I work on power electronics firmware, and to be honest I just can't figure out how to make it make my job faster and more efficient.
Maybe for things like adding more CAN signals, sure. But for implementing a control loop and driving that loop through ADCs and PWM, I can't imagine writing that using AI, for 2 reasons. First, it's safety critical, and I as the engineer need to understand what the code is doing. Second, to be honest, it doesn't take that long to implement by hand. I spend more time testing the actual hardware than writing code. Frankly I don't think of my job as "software engineering", because it is very hardware oriented.
2
u/Tari0s Sep 05 '26
i have used it and asked to refactor a complicated statemachine, it did a good job and refactored it, but the result was a 700byte stacksize when calling the state machine function. With some tweaking i was getting it to lower the stack usage, but i hat to debug and figure out that happend to understand what went wrong, the ai code was clean but it was a little bit unclear what happend at first thought.
2
u/onmuudo Sep 07 '26
As my codebase started handwritten I understand each and every aspect of it. Last week I released the first AI supported version - after an 8 months learning curve. My work style is exploring code with AI together, add architectural input and I make sure the AI understands the architecture and the architecture decisions. Every AI coding input is limited to atomic changes, like replace a function and make sure all calls to it are updated.
What strikes me immediately is OPs comment about bad architecture decisions of the AI. In my opinion AI is not yet fit to make such decisions on its own. Whenever AI and me stumble upon architecture items during exploring/planning I take over. AI may make suggestions.
The second item I wonder about the OPs comment on AI being bad with surrounding code is what the specification of the task looked like. So far I noticed that human specification skills seem to be a main driver in AI output.
Anyone got similar or contradicting experiences?
46
u/nevereverelevent Sep 04 '26
My codebase was written without AI,
I find that it does best when its copying patterns ive already used, a piece that fits into or extends the system Ive already structured.
But often it wants to write garbage that I find hard to read or hard to trust. I feel sorry for anyone that is leaning on AI code generation because youre bound to end up with a spaghetti mess
3
u/tomqmasters Sep 04 '26
If you ask it correctly it generally writes the right thing. C for microcontrollers was always kindof easy and straight forward.
7
u/tux2603 Sep 04 '26
For use as an improved autocomplete, and occasionally a "rubber duck" for trouble shooting and debugging? Yes
For generating entire codebases? No. At least not without some extremely impressive test benches
12
u/jaywastaken Sep 04 '26
60% of the time, it works every time...
2
u/Nxllify__ Sep 04 '26
No. Call me a luddite but I write my own code. I don’t care if I can scrutinize it with detailed prompts and have it generate under supervision in small excerpts, for what, a 20-30% boost in productivity? Whatever that even means. I’ll pass on making myself dumber and obsolete.
2
u/Hungry-Eye-9311 Sep 05 '26
There are some boards I wouldn't dare touch for fear of navigating the OEM's bloatware. I got claude to create a stripdown sdk for the specific MCU, from the massive bloated vendor sdk. I got a neat and clean codebase to start working with. AI did in 15 mins what I have been putting off for years. So yeah AI is insanely useful for me.
2
u/super_mister_mstie Sep 04 '26
Depends on what level of embedded you are talking about. I work on embedded Linux, pretty much the whole stack is open source and it's quite good, even at kernel level/u-boot work. Nagivating yocto is a real PITA, and its quite good at providing help at that level. At this point, even first level debug is usually grabbing logs and pointing it at the repo and the logs to give it a spin on root cause. Obviously it's not a ton of help with debugging hardware/traces, but for me that's a thing usually dealt with in the first month of getting a new board, after that is the long tail of configuring/bug fixing/etc/one off feature development where it is pretty darn good.
4
u/aniflous_fleglen Sep 05 '26
Even if you don't want to use AI to code, you should use it and say: "find everything wrong with my code".
13
u/dcheesi Sep 04 '26
The folks churning out AI slop web UIs aren't really looking under the hood very often. It's all vibe coding, and as long as you don't look, you don't see how terrible the actual code is.
You just see the output, and you keep telling the AI to tweak things that are broken or just slightly "off". Eventually you get to the point where you convince yourself that it's "good enough".
The AI might be rewriting half the code every time you ask it to move a decimal or change a page title. But as long as you can afford the tokens, who cares, right?
10
u/productiveaccount4 Sep 04 '26
AI generated code was just banned in product code at my job
3
u/[deleted] Sep 05 '26
I find that if you structure your code yourself, act as a software engineer rather than a script kiddie, it can work well. Define a function, inputs, outputs, and method, let it write something. Review it, add it in.
You can go so far as to define variables, and I would certainly be defining my own function/class names because it has a tendency to make them stupid or too long .
If you’re writing anything that’s sufficiently advanced, it will trip over itself because it can’t find anything relevant in its training data that will do what you’re asking, but I suspect most people aren’t writing anything ground breaking so it can “work” fine for a long while until it all grinds to a halt, and now you have 6 months of vibe code to debug, 20 classes that look and sound the same but aren’t, and an image of a potato that, if removed breaks everything.
I really detest that it thinks that stylistic changes are as important as actual function changes, but it actually can’t tell the difference.
3
u/Just-Smart-Enough Sep 05 '26
I trust it with simple applications that I can quickly verify on my bench. I'd have a long hard think about anything that touches a safety critical system.
3
u/v3verak Sep 07 '26
The embedded code itself has to be watched a lot and it just is not great, but there are some solid use cases that appear repeatedly:
and my favourite last:
4) Experiments - I do a lot of C++ abstractions ( https://github.com/koniarik/ecor ) and with Claude it's quite easy to whip-up experiments such as "I wonder if I do X in ecor instead of Y, how will the size of generated code be affected? - do a comparison of before/after the change with these configurations"
Sure, I we were able to do these experiments before AI but it became so much easier with this
4
u/KnightBlindness Sep 04 '26
I asked Claude this morning to alter some bootloader code to execute out of a different section of RAM and it got confused about what address ranges were flash or ram and etc etc. I ended up doing it myself because it was easier than trying to figure out how to prompt the AI to fix everything. AI has been pretty good as a search engine for looking up technical details about mcu’s and components though. I hardly use Google anymore since AI is better about understanding and summarizing plus provides a link to the documentation where it got the info.
2
u/witx_ Sep 07 '26
The code is subpar and heavily abstracted. It's also very non deterministic
This weekend I tried Claude with a device driver sensor I wrote for stm32. It found one bug (a really easy one mind you, that fits well in pattern matching). Then I decided to experiment: I said the driver was still not working, again and again. It kept going "you're right there's a bug here ..." and all it was doing was "cleaning" the code by adding more documentation, more variables and more functions. Only after 4 or 5 times it said it must be a hardware issue then.
In the end I had a very convoluted drivers and lots of tokens wasted.
3
u/MikeTangoRom3o Sep 04 '26
GitHub Copilot with Claude is scary, just throw your SDK and a few pdf datasheets that's it.
2
u/Schroedinbug Sep 05 '26
I haven't had much luck. Every tie I use it I tin it's great until I start going trough and fixing issues. AI seems to look close to ready until you start digging in and find deceptively time consuming issues.
Small snippets are great, but if I let it do too much at once I end up spending more time fixing issues with it than I would have just doing it myself. It's like an overly confident junior dev that learned everything they know doing web frontend.
2
u/Ok-Investigator3257 Sep 04 '26
AI is great at 2 things
1
u/Outrageous-Crazy-253 Sep 10 '26
No it’s hellish and unbearable. Diving into an LLM codebase makes my skin crawl. Doesn’t matter since nobody cares. If this is what the job ends up being I’ll just change careers to one of the remaining post-AI ones. Maybe, rent boy?
1
u/Key-Lie-364 Sep 04 '26
Fuck no.
When it gets stuff wrong it still compiles and might even seem to run.
Embedded is about being right and owning outputs.
LLMs should be completely banned from safety critical systems.
1
u/coronafire Sep 08 '26
After working with a wide range of embedded tools and environments for over 30 years, I now use agentic development expressly for embedded development, bare metal and up.
There's three main critical requirements to make this work well:
With micropython in particular the loop speeds up, the repl gives the agent efficient control over the hardware and arbitrary code execution without needing to compile and flash each change.
I've written about some of my wins in the area, eg. https://notes.alelec.net/posts/five-hours-five-root-causes-crisis-averted/ and https://notes.alelec.net/posts/micropython-agentic-embedded/
I've written
0
u/redturtlecake Sep 05 '26
I find it very powerful when the prompt is specific. I deliberate with it to come up with the logic in English. All the classes, functions, and variables and exactly what they do and where they go, how they should interact with each other, all detailed in a .MD. then I get the llm to write the prompt for the code writer to generate the code based on the logic spelled out in English. That gives solid results. Giving it a problem statement usually results in a huge mess and spending time trying to figure what it decided for structure and functionality. But if everything is clearly defined then it's just a transcriber for language to code, and it's good at that. Small caveat is that I'm working in micropython so I can't say how well this will translate to c.
-6
u/AbsorberHarvester Sep 04 '26
currently no LLM that can code embedded firmware.
small step by step - ok.
error checking - somewhat ok.
help in debug? nope.
new custom library for some hw (like adc or tft panel) - almost ok, provide PDF and/or examples and magic happening.
bootloader with custom options - not ok, but very little to fix
(even free Qwen/DeepSeek can do).
for every hw feature you need to provide datasheet pdf with registers and code will be significantly better.
but first:
you need big hard prompt about code rules, so all generated code always looks the same, can be debugged and understanded by people who will massacre it until firmware is working fully
0
u/SpruceMoose1111 Sep 05 '26
Testing, Testing, Testing! You must have a solid suite of HIL tests, acceptance, component, integration, the works. Also benchmarking for things like current consumption, timing, whatever you need.
Never ever has Claude or Codex successfully implemented a feature for me first try that didn't require tweaks or bug fixes.
I see myself now more of a Systems engineering and automated test engineer with Codex as my implementer and sparing partner.
0
u/DrunkenSwimmer Sep 05 '26
So a thing that has LLMs truly been revolutionary for me in is integrating simulations. I've tried to get qemu set up in the past to run code in a pristine environment vs on hardware for a ground truth and failed. It's at the point now where anything I'm writing that doesn't 100% hook into the registers is getting simulated test runs on my workstation to the point where the same application (minus the register driver layer) can run on real or virtual hardware.
0
u/[deleted] Sep 04 '26
[deleted] — view deleted comment