I’d say that depends on the device. One crate per SVD file is a good rule of thumb in my opinion, but I’ve seen SVD files that were basically identical (e.g. LPC822 and LPC824, which I manually merged to LPC82x).
We’re talking about peripheral access crates here, but I think it’s worth mentioning that HAL crates can cover a wider range of devices. See nrf52-hal, for example (and in that specific case, it could cover even more devices, I believe).
I think that always depends on the people involved. If there’s willingness to cooperate, then it makes total sense. (And as I mentioned on GitHub, I’m all for an lpc-rs organization; details to be determined, of course.)
I’m undecided, but I think it makes sense to group the peripheral access crates of one family into a single repository. At this point, svd2rust isn’t a really comprehensive tool, so additional tooling is required to patch the SVD file, integrate form, and do whatever else is required. I usually write a Bash script for that, and it makes sense to share that among crates.
Over at nrf-rs, we’ve started establishing
devicename-pac (PAC for Peripheral Access Crate) as the convention for those crates. I’d love to see this gain traction in the wider community. In my mind, it has the following advantages:
- It’s a more descriptive name.
- The HAL is what users should generally use, but
mydevice is a more attractive name than
mydevice-hal, which might cause users to not accidentally miss the HAL and use the PAC instead.
There’s one open question though: If there’s
mydevice-hal on crates.io, what happens with the
mydevice name? It’s what will show up first when searching for
mydevice. Some ideas:
- Reserve the crate, but make compilation fail with a descriptive message ("this is the situation, you’re probably looking for
mydevice some kind of alias for