Skip to content

Internal experiment: Generate SVDs from internal CSVs in esp-pacs, avoiding internal tools - #475

Merged
playfulFence merged 4 commits into
esp-rs:mainfrom
playfulFence:exprmnt
Aug 7, 2026
Merged

Internal experiment: Generate SVDs from internal CSVs in esp-pacs, avoiding internal tools#475
playfulFence merged 4 commits into
esp-rs:mainfrom
playfulFence:exprmnt

Conversation

@playfulFence

@playfulFence playfulFence commented Jul 24, 2026

Copy link
Copy Markdown
Member

For now, I have no intention to merge this, it's more like "look, this is possible", feel free to experiment with it (I think @bugadani will be happy to do so 😄 )
With a change like this, I'm aiming to
A) centralize the entire process of creating a PAC for new chips in esp-pacs
B) make the toolset for this to be completely written in Rust, previous internal tools were written in Python, required a lot of dancing around venv and "ew" was the most frequent reaction on working with it 😅

The CSV-parsing part entirely is a product of AI development, code might need to get cleaned up, but again, this is a "blueprint" of a potential future change.

Trying it

cargo xtask generate-base-svd \
  --chip esp32h21 \
  --csv-dir /path/to/csv \
  --interrupts /path/to/esp-idf/components/soc/esp32h21/include/soc/interrupts.h \
  --reg-base /path/to/esp-idf/components/soc/esp32h21/register/soc/reg_base.h

--interrupts and --reg-base are required. This allows to reduce the noise without huge ymls that are written based on these idf headers anyway. Register layouts still come from the GDVS CSV pack. That combination already produces a very close "clone" of what we currently get from internal tools for the base SVD.

@playfulFence playfulFence changed the title Internal change: Generate SVDs from internal CSVs in esp-pacs, avoiding internal tools Internal experiment: Generate SVDs from internal CSVs in esp-pacs, avoiding internal tools Jul 24, 2026
Comment thread xtask/src/regdesc/svd.rs
write_cpu(&mut out, chip);
write_peripherals(&mut out, fragment);

writeln!(out, "</device>").unwrap();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What reason of manual text writing instead of svd-encode?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello!

As I said in the PR description, the parsing section is almost completely written by AI and might need a bit of a cleanup in the near future. But also, to be completely fair and I might be wrong here, feel free to disagree with me, but I’m fine with a bit messy/AI-looking generator code, which will also be used exclusively by the team members (as internal CSVs are confidential), as long as the SVD output is correct, we're unlikely to change that code very often.

@playfulFence
playfulFence marked this pull request as ready for review August 5, 2026 12:28
@playfulFence
playfulFence added this pull request to the merge queue Aug 7, 2026
Merged via the queue into esp-rs:main with commit 2a19e3e Aug 7, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants