rust-embedded / svdtools

Python package to handle vendor-supplied, often buggy SVD files.
Apache License 2.0
63 stars 29 forks source link

Skip checking the derivedFrom destination if it is an absolute name #227

Closed simpkins closed 6 months ago

simpkins commented 6 months ago

The _derive processing code attempts to check that the derived-from register name exists. However, this check currently only handles relative names within the current peripheral or cluster.

If the name contains a . it is an absolute name, and should be looked up from device root. However, we cannot currently do this as we don't have a reference to the Device. Since we are mutating a member of the device in-place, we will not be able to pass in a device reference without significant refactoring of the code.

For now this diff simply skips the register name validation if the name contains a .. This allows users to refer to absolute names for now, when previously this would always fail.

I included a new unit test that makes use of absolute references. This also includes some new test utilities for easily checking patch output against an expected SVD file.

This addresses issue #226.

burrbull commented 6 months ago

Could you prepare release PR after this one?

simpkins commented 6 months ago

Sure, it's evening for me now but I can prepare a release PR tomorrow morning. Thanks for merging this!