RFC: Revisit ESP SVD sourcing for device generation #5768
zombieleet
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Summary
I would like to propose revisiting how TinyGo sources SVD files for Espressif devices
The current
gen-device-esptarget in make/gen-device.mk still uses SVDs from thecmis-svddata tree.This source appears increasingly unsutiable for adding newer Espressif targets.
The
cmis-svd-datarepository has seen very little mainteance recently, and there are old PRs and issues that have remained untouched for long periods.Espressif also maintains an official SVD repository, but that repository does not currenlty contain some newer chips such as ESP32-C5
I would like to disucss whether TinyGo should mvoe ESP device generation to a more actively maintained source.
Current Problem
When adding a new MCU target, TinyGo's SVD generator needs a sufficiently complete SVD describing the chip peripherals and registers.
The older Espressif device, the current
cmsis-svdsource works.For newer devices, this becomes a problem.
For example
This means adding support for newer Espressif MCUs can currently depend on finding or maintaining an SVD outside TinyGo's existing generation workflow.
Why esp-pacs is interesting
esp-rs/esp-pacsalready maintanes peripherial access crates for Espressif SoCs.
It's workflow is based on SVDs:
TinyGo already has it's own SVD generator, so in principle it only needs the SVD before the Rust-specific generation step:
esp-pacs is also actively maintained. It receives regular register corrections, new chip support, and genreated PAC updates.
It already contains ESP32-C5 support, which is especially relevant because neither the currenty TinyGo source nor Espressif's standalone SVD repository provides a C5 SVD today.
An important detail
I do not think TinyGo should necessiarly make
make gen-device-espdepend directly on the Rust build ecosystem.eps-pacs uses
svdtoolsxtaskAdding that toolchain directly to TinyGo's device generation may be undesirable.
A cleaner option may be to use esp-pacs as the upstream SVD source while keeping a small TinyGo-managed repository containing the final patched SVDs used by TinyGo.
For example
The repository could look like
Then
gen-device-espcould follow the same general model TinyGo already uses for htings such as STM32 and PY32.Another possible option
TinyGo could consume esp-pacs directly as a submodule and generate the patched SVDs during
make gen-device-espsomething like:
This would avoid maintaining another mirror, but it would introduce Rust tooling into TinyGo's ESP generation workflow.
I am not sure that tradeoff is worth it though.
Longer-term possibility
There may also be a more direct path in the future.
esp-pacs now contains tooling for generating base SVDs from Espressif register CSV data and ESP-IDF headers.
That suggests the actual source of truth is moving closer to:
If that tooling proves stable, TinyGo could eventually consume the same upstream register metadata instead of depending on a separately maintained global SVD repository.
I think that is a larger change and probably not necessary for the first step.
Proposal
My preferred direction would be:
cmsis-svdEspressif tree as the main source of ESP device generation.This would making adding newer Espressif targets easer and would give TinyGo control over the exact SVD versions used during generation.
Benefits
Questions
I would like feedback on a few things: 😀
cmsis-svd?I came across this while looking into support for newer Espressif MCUs, especially ESP32-S2 and ESP32-C5.
I would be happy to work on a proof of concept for updating
gen-device-espif this direction makes sense.All reactions