Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
703: Fix dangling implicit derives r=Emilgardis a=n8tlarsen While working on R7FA6M5BH.svd I found that the generated code does not compile because P0%sPFS_BY got thrown away while implicitly deriving registers. Looking through the debug log I found this: ``` [DEBUG svd2rust::generate::device] Rendering peripheral PFS [DEBUG svd2rust::generate::peripheral] Checking derivation information [DEBUG svd2rust::generate::peripheral] register P009PFS_BY implicitly derives from P00%sPFS_BY [DEBUG svd2rust::generate::peripheral] register P010PFS implicitly derives from P0%sPFS [DEBUG svd2rust::generate::peripheral] register P010PFS_HA implicitly derives from P0%sPFS_HA [DEBUG svd2rust::generate::peripheral] register P010PFS_BY implicitly derives from P0%sPFS_BY [DEBUG svd2rust::generate::peripheral] register P0%sPFS_BY implicitly derives from P00%sPFS_BY [DEBUG svd2rust::generate::peripheral] register P200PFS implicitly derives from P20%sPFS [DEBUG svd2rust::generate::peripheral] register P200PFS_HA implicitly derives from P20%sPFS_HA [DEBUG svd2rust::generate::peripheral] register P200PFS_BY implicitly derives from P20%sPFS_BY [DEBUG svd2rust::generate::peripheral] register P2%sPFS implicitly derives from P20%sPFS [DEBUG svd2rust::generate::peripheral] register P2%sPFS_HA implicitly derives from P20%sPFS_HA [DEBUG svd2rust::generate::peripheral] register P2%sPFS_BY implicitly derives from P20%sPFS_BY [DEBUG svd2rust::generate::peripheral] register P70%sPFS implicitly derives from P70%sPFS [DEBUG svd2rust::generate::peripheral] register P70%sPFS_HA implicitly derives from P70%sPFS_HA [DEBUG svd2rust::generate::peripheral] register P70%sPFS_BY implicitly derives from P70%sPFS_BY [DEBUG svd2rust::generate::peripheral] register P90%sPFS implicitly derives from P90%sPFS [DEBUG svd2rust::generate::peripheral] register P90%sPFS_HA implicitly derives from P90%sPFS_HA [DEBUG svd2rust::generate::peripheral] register P90%sPFS_BY implicitly derives from P90%sPFS_BY [DEBUG svd2rust::generate::peripheral] register PA0%sPFS implicitly derives from PA0%sPFS [DEBUG svd2rust::generate::peripheral] register PA0%sPFS_HA implicitly derives from PA0%sPFS_HA [DEBUG svd2rust::generate::peripheral] register PA0%sPFS_BY implicitly derives from PA0%sPFS_BY [DEBUG svd2rust::generate::peripheral] register P%sSAR implicitly derives from P%sSAR [DEBUG svd2rust::generate::peripheral] Pushing cluster & register information into output [DEBUG svd2rust::generate::peripheral] Pushing 95 register or cluster blocks into output ``` P010PFS_BY implicitly derives from P0%sPFS_BY and P0%sPFS_BY implicitly derives from P00%sPFS_BY, which leaves P0%sPFS_BY dangling (P0%sPFS_BY regex matched to P009PFS_BY and implicitly derived from the root P00%sPFS_BY). The fix checks for would-be dangling derives while checking previous names against the "P0%sPFS_BY" regex, and replaces the derive with the new root. Co-authored-by: Nathan <[email protected]>
- Loading branch information