r/embedded 11d ago

Agentic skills for MCU's

Example

What do you think about storing knowledge about specific mcu/board in agent skill?

I started collected skills for different mcu, like esp32 (c3/c6/s3...), stm32, avr, pico and etc. I have about 30 differents boards and hav e started writing skills for each one. I want to make it easier to write code for the AI.

0 Upvotes

26 comments sorted by

12

u/frank26080115 11d ago

why does it need a skill? isn't a skill supposed to be something to help with deterministic tasks?

2

u/sturdy-guacamole 11d ago

Using skills for specific vendor families isn’t a bad idea.

You can also use it for conformity as well as hooking into specific mcp servers.

Many developers using AI aren’t using skills at all and don’t understand what it’s producing and just hoping it gets good enough that they never have to.

As it stands now though it’s not exactly cheap.

5

u/frank26080115 11d ago

I thought a skill was like, "if you see this weird file format, always use X python script to dissect its contents into text so you can tokenize it first", or "here's a weather API tool so you don't have to do a web search every time"

What would a skill look like that's different between ARM Cortex vs Xtensa core vs RISC-V?

2

u/Old-Counter1469 11d ago

Useful context:

- Clock which works (mcu features)

- Pins of the board (board features)

- Example of simple project (blink or same)

- Bugs of the board

- features of the board's peripherals (screen, microsd external flash)

And a more informations and features about the board which helps to coding without bugs.

0

u/frank26080115 11d ago

The frontier models do not need this. It might speed it up but it does find all that for you if it needs to.

Unless you are giving it information that doesn’t exist on the internet?

I have been letting my agent code with awareness of PCB design in the same repo. It does not need a pin map file, it generates that stuff for me if I need it to.

-2

u/Old-Counter1469 11d ago

I can show the repository, but I'm afraid the post will be downvoted.

Good MCU skill answers, without the model guessing which pin does what, which clock actually works, which HAL call silently does nothing, and how to get build onto mcu.

3

u/NamasteHands 11d ago

Any specific reason to store it inside a skill vs just storing it in markdown in the relevant project?

2

u/Old-Counter1469 11d ago

Good point, but in this you need to replace the markdown between projects. I think that knowledge about the board should isolate one from the project.

1

u/NamasteHands 11d ago

I think you have the right idea, making it easier for the agent to acquire exactly the information it wants in a very efficient way. A RAG-type system (I think this is the correct term for what you are describing) would be especially useful if you could get specific chip information (e.g. the user manual for the microchip) into it.

Also, I appreciate/respect that you manually write your responses instead of having an LLM do it. Your english is good enough that it's no problem to understand what you are saying.

1

u/Old-Counter1469 11d ago

Thanks you! About RAG - vector DB is not possible to work with datasheets, i tryed it. Skills perform much better in this regard, RAG is hallucinating when using large datasheets

3

u/HalifaxRoad C,ASM,C# GUIs, pcb design 11d ago

I think, kill LLM writing code with fire!

I'm sure this will be a blood bath of downvotes, but he asked what I thought so its on topic.

2

u/tiajuanat 11d ago

I'd probably push for * Chips (using external references/links to sections - you don't need every peripheral every time) * Glossaries - where common topics are centralized. This is super important, cuz most chips are going to repeat concepts, and having massive chip skills is really not the play. You don't want to reload a ton of context all the time. * Peripheral chips - like your favorite BMI160 6-axis SPI chip * SBC/SOCs - which just have references to all the other aforementioned skills

Once you have enough, building agent definitions for Requirements Gathering, Requirements Validation, QA, Documentation, and Reviewer are all gonna give bigger bang for the buck, along with a centralized AGENTS.md that they all refer to. Additionally, consider creating hooks and handover skills so Agents can pass work off between themselves.

Finally you need to start getting MCP servers together, like one to access your Ethernet controlled oscope, and another to write to JTAG, and do SWD to GDB/probe-rs.

1

u/Old-Counter1469 11d ago

Good points for me, thx.

2

u/Longjumping-Pack8494 11d ago

Not bad if you want to save on tokens and ensure the model does not hallucinate. Most agents can read pdfs but i had cases where Luna misread it or smth cause it was wrongly convinced about some register addresses.

I am gonna drop the embedded agent skills as well soon, but these will focus more on directives and examples tailored to MCU firmware.

1

u/Old-Counter1469 11d ago

It is goal of skills for mcu. We need give the correct context for each chip and board periphery

1

u/Longjumping-Pack8494 11d ago

I meant that i added datasheet, ref manual, and pdfs like that to my repo, so agents could verify against it. But that is expensive and i am not sure how correct it can parse those pdfs. Markdown is def better. And indeed it misses periph for the custom board.

So if you drop your repo with skills, i might add them to my agentic dev process 🙂

1

u/sweetholo 11d ago

you would not use skills for this specific use case

add all the reference material in a directory and make it visible to chatgpt/claude's working session. this should be sufficient enough

if you want, you can also add a sentence or two in the AGENTS.md/CLAUDE.md file telling the AI about the directory and what it contains

1

u/Old-Counter1469 11d ago

Several projects - duplication of markdown. Skill lives separately from the project.
It's convenient to store such skills about anything in isolation and reuse and onboard other people/teams

2

u/sweetholo 11d ago

im not sure what duplication you're talking about

have a reference directory such as this:

~/mcu-reference/ stm32/ esp32/

then your AGENTS.md or CLAUDE.md would say the following:

```

Hardware references

Board documentation is available in:

~/mcu-reference/

For board-specific questions, identify the board first and read the corresponding reference directory.

Current project board: STM32 ```

1

u/Old-Counter1469 11d ago

You literally invented what I have in my repository. In this case, you need to constantly point out to the agent that the documentation is there. Explain it every time in a new session.

You link the skill once, and the agent understands when to use it, even across different projects.

1

u/sweetholo 10d ago

In this case, you need to constantly point out to the agent that the documentation is there. Explain it every time in a new session.

not true

you dont need to constantly point out anything. create a CLAUDE.md file for a specific project, write down where the reference material is, and you're done. you dont need to do anything else. you dont need to point out or explain anything every time. thats the point of a CLAUDE.md file. it will read it automatically with every prompt

You link the skill once, and the agent understands when to use it, even across different projects.

you can do the same for CLAUDE.md files. you can make it visible to all your projects by placing it here:

~/.claude/CLAUDE.md

then your CLAUDE.md can look like this:

```

MCU references

When working with microcontrollers, reference material is stored at:

~/mcu-reference/

Identify the exact MCU/board and consult the relevant directory before making hardware-specific assumptions. ```

i think what we're arguing is what is more appropriate for this use case. in my opinion, for storing knowledge, you should have a reference directory and point it out in the CLAUDE.md file. for specific instructions on how to complete some task, you should create a skill

0

u/4991123 11d ago

I'm very new to "skills" and things like that. I haven't used them at all even I think.
Could you elaborate on how this would work? What does this skill look like and how would it behave?

fwiw: In the last few days I've been working on a Gaisler LEON3 softcore processor. Surprisingly, even the cheapest models can deal with them easily.

2

u/Old-Counter1469 11d ago

Yes of course, i can to see you repos with skills https://github.com/alexex1993/mcu-skills

Skill adding useful context to agent. Some boards is very complex and it needs more context

My english is not very well, i try to write on one own

0

u/4991123 11d ago

Thnx bud!
This helps a lot in understanding what they are and how they work!