From 30093eb8d33c0ab59cd423dd106c5f647a04d9aa Mon Sep 17 00:00:00 2001 From: Angus Gratton Date: Mon, 2 Oct 2023 17:59:55 +1100 Subject: [PATCH] Add device width and peripheral addressBlock to output (#2) * Adds width tag to device node (hard-coded to 32-bit). * Adds addressBlock region to each peripheral. These SVD elements are not needed for svd2rust, but documented in CMSIS-SVD as required. Adding them allows edc2svd output to be used with Ghidra via the SVD-Loader-Ghidra plugin. --- ci/regtest/PIC32MX170F256B.svd | 231 +++++++++++++++++++++++ ci/regtest/PIC32MX274F256B.svd | 241 +++++++++++++++++++++++ ci/regtest/PIC32MX470F512H.svd | 261 +++++++++++++++++++++++++ ci/regtest/PIC32MX695F512L.svd | 336 +++++++++++++++++++++++++++++++++ src/main.rs | 32 +++- 5 files changed, 1094 insertions(+), 7 deletions(-) diff --git a/ci/regtest/PIC32MX170F256B.svd b/ci/regtest/PIC32MX170F256B.svd index c419844..72730df 100644 --- a/ci/regtest/PIC32MX170F256B.svd +++ b/ci/regtest/PIC32MX170F256B.svd @@ -1,11 +1,17 @@ PIC32MX170F256B + 32 WDT WDT peripheral 0xbf800000 + + 0x0 + 0x10 + registers + WDTCON @@ -113,6 +119,11 @@ RTCC RTCC peripheral 0xbf800200 + + 0x0 + 0x60 + registers + RTCCON @@ -976,6 +987,11 @@ TMR1 TMR1 peripheral 0xbf800600 + + 0x0 + 0x30 + registers + T1CON @@ -1267,6 +1283,11 @@ TMR2 TMR2 peripheral 0xbf800800 + + 0x0 + 0x30 + registers + T2CON @@ -1526,6 +1547,11 @@ TMR3 TMR3 peripheral 0xbf800a00 + + 0x0 + 0x30 + registers + T3CON @@ -1769,6 +1795,11 @@ TMR4 TMR4 peripheral 0xbf800c00 + + 0x0 + 0x30 + registers + T4CON @@ -2028,6 +2059,11 @@ TMR5 TMR5 peripheral 0xbf800e00 + + 0x0 + 0x30 + registers + T5CON @@ -2271,6 +2307,11 @@ ICAP1 ICAP1 peripheral 0xbf802000 + + 0x0 + 0x20 + registers + IC1CON @@ -2487,6 +2528,11 @@ ICAP2 ICAP2 peripheral 0xbf802200 + + 0x0 + 0x20 + registers + IC2CON @@ -2703,6 +2749,11 @@ ICAP3 ICAP3 peripheral 0xbf802400 + + 0x0 + 0x20 + registers + IC3CON @@ -2919,6 +2970,11 @@ ICAP4 ICAP4 peripheral 0xbf802600 + + 0x0 + 0x20 + registers + IC4CON @@ -3135,6 +3191,11 @@ ICAP5 ICAP5 peripheral 0xbf802800 + + 0x0 + 0x20 + registers + IC5CON @@ -3351,6 +3412,11 @@ OCMP1 OCMP1 peripheral 0xbf803000 + + 0x0 + 0x30 + registers + OC1CON @@ -3610,6 +3676,11 @@ OCMP2 OCMP2 peripheral 0xbf803200 + + 0x0 + 0x30 + registers + OC2CON @@ -3869,6 +3940,11 @@ OCMP3 OCMP3 peripheral 0xbf803400 + + 0x0 + 0x30 + registers + OC3CON @@ -4128,6 +4204,11 @@ OCMP4 OCMP4 peripheral 0xbf803600 + + 0x0 + 0x30 + registers + OC4CON @@ -4387,6 +4468,11 @@ OCMP5 OCMP5 peripheral 0xbf803800 + + 0x0 + 0x30 + registers + OC5CON @@ -4646,6 +4732,11 @@ I2C1 I2C1 peripheral 0xbf805000 + + 0x0 + 0x70 + registers + I2C1CON @@ -5410,6 +5501,11 @@ I2C2 I2C2 peripheral 0xbf805100 + + 0x0 + 0x70 + registers + I2C2CON @@ -6174,6 +6270,11 @@ SPI1 SPI1 peripheral 0xbf805800 + + 0x0 + 0x50 + registers + SPI1CON @@ -7042,6 +7143,11 @@ SPI2 SPI2 peripheral 0xbf805a00 + + 0x0 + 0x50 + registers + SPI2CON @@ -7910,6 +8016,11 @@ UART1 UART1 peripheral 0xbf806000 + + 0x0 + 0x50 + registers + U1MODE @@ -8531,6 +8642,11 @@ UART2 UART2 peripheral 0xbf806200 + + 0x0 + 0x50 + registers + U2MODE @@ -9152,6 +9268,11 @@ PMP PMP peripheral 0xbf807000 + + 0x0 + 0x70 + registers + PMCON @@ -9987,6 +10108,11 @@ ADC10 ADC10 peripheral 0xbf809000 + + 0x0 + 0x170 + registers + AD1CON1 @@ -10766,6 +10892,11 @@ CVR CVR peripheral 0xbf809800 + + 0x0 + 0x10 + registers + CVRCON @@ -10889,6 +11020,11 @@ CMP1 CMP1 peripheral 0xbf80a000 + + 0x0 + 0x10 + registers + CM1CON @@ -11044,6 +11180,11 @@ CMP2 CMP2 peripheral 0xbf80a010 + + 0x0 + 0x10 + registers + CM2CON @@ -11199,6 +11340,11 @@ CMP3 CMP3 peripheral 0xbf80a020 + + 0x0 + 0x10 + registers + CM3CON @@ -11354,6 +11500,11 @@ CMP CMP peripheral 0xbf80a060 + + 0x0 + 0x10 + registers + CMSTAT @@ -11477,6 +11628,11 @@ CTMU CTMU peripheral 0xbf80a200 + + 0x0 + 0x10 + registers + CTMUCON @@ -11808,6 +11964,11 @@ OSC OSC peripheral 0xbf80f000 + + 0x0 + 0x40 + registers + OSCCON @@ -12391,6 +12552,11 @@ CFG CFG peripheral 0xbf80f200 + + 0x0 + 0xa0 + registers + CFGCON @@ -13188,6 +13354,11 @@ NVM NVM peripheral 0xbf80f400 + + 0x0 + 0x50 + registers + NVMCON @@ -13418,6 +13589,11 @@ RCON RCON peripheral 0xbf80f600 + + 0x0 + 0x20 + registers + RCON @@ -13657,6 +13833,11 @@ PPS PPS peripheral 0xbf80fa04 + + 0x0 + 0x19c + registers + INT1R @@ -14405,6 +14586,11 @@ INT INT peripheral 0xbf881000 + + 0x0 + 0x140 + registers + INTCON @@ -18765,6 +18951,11 @@ BMX BMX peripheral 0xbf882000 + + 0x0 + 0x80 + registers + BMXCON @@ -19183,6 +19374,11 @@ DMAC DMAC peripheral 0xbf883000 + + 0x0 + 0x60 + registers + DMACON @@ -19678,6 +19874,11 @@ DMAC0 DMAC0 peripheral 0xbf883060 + + 0x0 + 0xc0 + registers + DCH0CON @@ -20757,6 +20958,11 @@ DMAC1 DMAC1 peripheral 0xbf883120 + + 0x0 + 0xc0 + registers + DCH1CON @@ -21836,6 +22042,11 @@ DMAC2 DMAC2 peripheral 0xbf8831e0 + + 0x0 + 0xc0 + registers + DCH2CON @@ -22915,6 +23126,11 @@ DMAC3 DMAC3 peripheral 0xbf8832a0 + + 0x0 + 0xc0 + registers + DCH3CON @@ -23994,6 +24210,11 @@ USB USB peripheral 0xbf885040 + + 0x0 + 0x3c0 + registers + U1OTGIR @@ -27583,6 +27804,11 @@ PORTA PORTA peripheral 0xbf886000 + + 0x0 + 0xa0 + registers + ANSELA @@ -28670,6 +28896,11 @@ PORTB PORTB peripheral 0xbf886100 + + 0x0 + 0xa0 + registers + ANSELB diff --git a/ci/regtest/PIC32MX274F256B.svd b/ci/regtest/PIC32MX274F256B.svd index f4b818b..d8585ad 100644 --- a/ci/regtest/PIC32MX274F256B.svd +++ b/ci/regtest/PIC32MX274F256B.svd @@ -1,11 +1,17 @@ PIC32MX274F256B + 32 DSCTRL DSCTRL peripheral 0xbf800000 + + 0x0 + 0xcc + registers + DSCON @@ -508,6 +514,11 @@ RTCC RTCC peripheral 0xbf800200 + + 0x0 + 0x60 + registers + RTCCON @@ -1387,6 +1398,11 @@ TMR1 TMR1 peripheral 0xbf800600 + + 0x0 + 0x30 + registers + T1CON @@ -1694,6 +1710,11 @@ TMR2 TMR2 peripheral 0xbf800800 + + 0x0 + 0x30 + registers + T2CON @@ -1953,6 +1974,11 @@ TMR3 TMR3 peripheral 0xbf800a00 + + 0x0 + 0x30 + registers + T3CON @@ -2196,6 +2222,11 @@ TMR4 TMR4 peripheral 0xbf800c00 + + 0x0 + 0x30 + registers + T4CON @@ -2455,6 +2486,11 @@ TMR5 TMR5 peripheral 0xbf800e00 + + 0x0 + 0x30 + registers + T5CON @@ -2698,6 +2734,11 @@ ICAP1 ICAP1 peripheral 0xbf802000 + + 0x0 + 0x20 + registers + IC1CON @@ -2914,6 +2955,11 @@ ICAP2 ICAP2 peripheral 0xbf802200 + + 0x0 + 0x20 + registers + IC2CON @@ -3130,6 +3176,11 @@ ICAP3 ICAP3 peripheral 0xbf802400 + + 0x0 + 0x20 + registers + IC3CON @@ -3346,6 +3397,11 @@ ICAP4 ICAP4 peripheral 0xbf802600 + + 0x0 + 0x20 + registers + IC4CON @@ -3562,6 +3618,11 @@ ICAP5 ICAP5 peripheral 0xbf802800 + + 0x0 + 0x20 + registers + IC5CON @@ -3778,6 +3839,11 @@ OCMP1 OCMP1 peripheral 0xbf803000 + + 0x0 + 0x30 + registers + OC1CON @@ -4037,6 +4103,11 @@ OCMP2 OCMP2 peripheral 0xbf803200 + + 0x0 + 0x30 + registers + OC2CON @@ -4296,6 +4367,11 @@ OCMP3 OCMP3 peripheral 0xbf803400 + + 0x0 + 0x30 + registers + OC3CON @@ -4555,6 +4631,11 @@ OCMP4 OCMP4 peripheral 0xbf803600 + + 0x0 + 0x30 + registers + OC4CON @@ -4814,6 +4895,11 @@ OCMP5 OCMP5 peripheral 0xbf803800 + + 0x0 + 0x30 + registers + OC5CON @@ -5073,6 +5159,11 @@ I2C1 I2C1 peripheral 0xbf805000 + + 0x0 + 0x70 + registers + I2C1CON @@ -5837,6 +5928,11 @@ I2C2 I2C2 peripheral 0xbf805100 + + 0x0 + 0x70 + registers + I2C2CON @@ -6601,6 +6697,11 @@ SPI1 SPI1 peripheral 0xbf805800 + + 0x0 + 0x50 + registers + SPI1CON @@ -7469,6 +7570,11 @@ SPI2 SPI2 peripheral 0xbf805a00 + + 0x0 + 0x50 + registers + SPI2CON @@ -8337,6 +8443,11 @@ UART1 UART1 peripheral 0xbf806000 + + 0x0 + 0x50 + registers + U1MODE @@ -9022,6 +9133,11 @@ UART2 UART2 peripheral 0xbf806200 + + 0x0 + 0x50 + registers + U2MODE @@ -9707,6 +9823,11 @@ PMP PMP peripheral 0xbf807000 + + 0x0 + 0xa0 + registers + PMCON @@ -10746,6 +10867,11 @@ ADC10 ADC10 peripheral 0xbf809000 + + 0x0 + 0x170 + registers + AD1CON1 @@ -11724,6 +11850,11 @@ CVR CVR peripheral 0xbf809800 + + 0x0 + 0x10 + registers + CVRCON @@ -11847,6 +11978,11 @@ CMP1 CMP1 peripheral 0xbf80a000 + + 0x0 + 0x10 + registers + CM1CON @@ -12002,6 +12138,11 @@ CMP2 CMP2 peripheral 0xbf80a010 + + 0x0 + 0x10 + registers + CM2CON @@ -12157,6 +12298,11 @@ CMP3 CMP3 peripheral 0xbf80a020 + + 0x0 + 0x10 + registers + CM3CON @@ -12312,6 +12458,11 @@ CMP CMP peripheral 0xbf80a060 + + 0x0 + 0x10 + registers + CMSTAT @@ -12435,6 +12586,11 @@ CTMU CTMU peripheral 0xbf80a200 + + 0x0 + 0x10 + registers + CTMUCON @@ -12766,6 +12922,11 @@ CRU CRU peripheral 0xbf80f000 + + 0x0 + 0x1e0 + registers + OSCCON @@ -14165,6 +14326,11 @@ CFG CFG peripheral 0xbf80f200 + + 0x0 + 0xa0 + registers + CFGCON @@ -15002,6 +15168,11 @@ NVM NVM peripheral 0xbf80f400 + + 0x0 + 0x50 + registers + NVMCON @@ -15232,6 +15403,11 @@ WDT WDT peripheral 0xbf80f600 + + 0x0 + 0x10 + registers + WDTCON @@ -15339,6 +15515,11 @@ PPS PPS peripheral 0xbf80fa04 + + 0x0 + 0x19c + registers + INT1R @@ -16074,6 +16255,11 @@ HLVD HLVD peripheral 0xbf80fc00 + + 0x0 + 0x10 + registers + HLVDCON @@ -16213,6 +16399,11 @@ INT INT peripheral 0xbf881000 + + 0x0 + 0x140 + registers + INTCON @@ -20641,6 +20832,11 @@ BMX BMX peripheral 0xbf882000 + + 0x0 + 0x80 + registers + BMXCON @@ -21059,6 +21255,11 @@ DMAC DMAC peripheral 0xbf883000 + + 0x0 + 0x60 + registers + DMACON @@ -21554,6 +21755,11 @@ DMAC0 DMAC0 peripheral 0xbf883060 + + 0x0 + 0xc0 + registers + DCH0CON @@ -22633,6 +22839,11 @@ DMAC1 DMAC1 peripheral 0xbf883120 + + 0x0 + 0xc0 + registers + DCH1CON @@ -23712,6 +23923,11 @@ DMAC2 DMAC2 peripheral 0xbf8831e0 + + 0x0 + 0xc0 + registers + DCH2CON @@ -24791,6 +25007,11 @@ DMAC3 DMAC3 peripheral 0xbf8832a0 + + 0x0 + 0xc0 + registers + DCH3CON @@ -25870,6 +26091,11 @@ PCACHE PCACHE peripheral 0xbf884000 + + 0x0 + 0xd0 + registers + CHECON @@ -26324,6 +26550,11 @@ USB USB peripheral 0xbf885040 + + 0x0 + 0x3c0 + registers + U1OTGIR @@ -29913,6 +30144,11 @@ PORTA PORTA peripheral 0xbf886000 + + 0x0 + 0xa0 + registers + ANSELA @@ -31000,6 +31236,11 @@ PORTB PORTB peripheral 0xbf886100 + + 0x0 + 0xa0 + registers + ANSELB diff --git a/ci/regtest/PIC32MX470F512H.svd b/ci/regtest/PIC32MX470F512H.svd index dc9e69a..feb0368 100644 --- a/ci/regtest/PIC32MX470F512H.svd +++ b/ci/regtest/PIC32MX470F512H.svd @@ -1,11 +1,17 @@ PIC32MX470F512H + 32 INT INT peripheral 0xbf881000 + + 0x0 + 0x150 + registers + INTCON @@ -4866,6 +4872,11 @@ BMX BMX peripheral 0xbf882000 + + 0x0 + 0x80 + registers + BMXCON @@ -5284,6 +5295,11 @@ DMAC DMAC peripheral 0xbf883000 + + 0x0 + 0x60 + registers + DMACON @@ -5779,6 +5795,11 @@ DMAC0 DMAC0 peripheral 0xbf883060 + + 0x0 + 0xc0 + registers + DCH0CON @@ -6858,6 +6879,11 @@ DMAC1 DMAC1 peripheral 0xbf883120 + + 0x0 + 0xc0 + registers + DCH1CON @@ -7937,6 +7963,11 @@ DMAC2 DMAC2 peripheral 0xbf8831e0 + + 0x0 + 0xc0 + registers + DCH2CON @@ -9016,6 +9047,11 @@ DMAC3 DMAC3 peripheral 0xbf8832a0 + + 0x0 + 0xc0 + registers + DCH3CON @@ -10095,6 +10131,11 @@ PCACHE PCACHE peripheral 0xbf884000 + + 0x0 + 0xd0 + registers + CHECON @@ -10549,6 +10590,11 @@ USB USB peripheral 0xbf885040 + + 0x0 + 0x3c0 + registers + U1OTGIR @@ -14138,6 +14184,11 @@ PORTB PORTB peripheral 0xbf886100 + + 0x0 + 0xa0 + registers + ANSELB @@ -16857,6 +16908,11 @@ PORTC PORTC peripheral 0xbf886200 + + 0x0 + 0xa0 + registers + ANSELC @@ -17848,6 +17904,11 @@ PORTD PORTD peripheral 0xbf886300 + + 0x0 + 0xa0 + registers + ANSELD @@ -19847,6 +19908,11 @@ PORTE PORTE peripheral 0xbf886400 + + 0x0 + 0xa0 + registers + ANSELE @@ -21366,6 +21432,11 @@ PORTF PORTF peripheral 0xbf886500 + + 0x0 + 0xa0 + registers + ANSELF @@ -22417,6 +22488,11 @@ PORTG PORTG peripheral 0xbf886600 + + 0x0 + 0xa0 + registers + ANSELG @@ -23408,6 +23484,11 @@ WDT WDT peripheral 0xbf800000 + + 0x0 + 0x10 + registers + WDTCON @@ -23515,6 +23596,11 @@ RTCC RTCC peripheral 0xbf800200 + + 0x0 + 0x60 + registers + RTCCON @@ -24378,6 +24464,11 @@ TMR1 TMR1 peripheral 0xbf800600 + + 0x0 + 0x30 + registers + T1CON @@ -24669,6 +24760,11 @@ TMR2 TMR2 peripheral 0xbf800800 + + 0x0 + 0x30 + registers + T2CON @@ -24928,6 +25024,11 @@ TMR3 TMR3 peripheral 0xbf800a00 + + 0x0 + 0x30 + registers + T3CON @@ -25171,6 +25272,11 @@ TMR4 TMR4 peripheral 0xbf800c00 + + 0x0 + 0x30 + registers + T4CON @@ -25430,6 +25536,11 @@ TMR5 TMR5 peripheral 0xbf800e00 + + 0x0 + 0x30 + registers + T5CON @@ -25673,6 +25784,11 @@ ICAP1 ICAP1 peripheral 0xbf802000 + + 0x0 + 0x20 + registers + IC1CON @@ -25889,6 +26005,11 @@ ICAP2 ICAP2 peripheral 0xbf802200 + + 0x0 + 0x20 + registers + IC2CON @@ -26105,6 +26226,11 @@ ICAP3 ICAP3 peripheral 0xbf802400 + + 0x0 + 0x20 + registers + IC3CON @@ -26321,6 +26447,11 @@ ICAP4 ICAP4 peripheral 0xbf802600 + + 0x0 + 0x20 + registers + IC4CON @@ -26537,6 +26668,11 @@ ICAP5 ICAP5 peripheral 0xbf802800 + + 0x0 + 0x20 + registers + IC5CON @@ -26753,6 +26889,11 @@ OCMP1 OCMP1 peripheral 0xbf803000 + + 0x0 + 0x30 + registers + OC1CON @@ -27012,6 +27153,11 @@ OCMP2 OCMP2 peripheral 0xbf803200 + + 0x0 + 0x30 + registers + OC2CON @@ -27271,6 +27417,11 @@ OCMP3 OCMP3 peripheral 0xbf803400 + + 0x0 + 0x30 + registers + OC3CON @@ -27530,6 +27681,11 @@ OCMP4 OCMP4 peripheral 0xbf803600 + + 0x0 + 0x30 + registers + OC4CON @@ -27789,6 +27945,11 @@ OCMP5 OCMP5 peripheral 0xbf803800 + + 0x0 + 0x30 + registers + OC5CON @@ -28048,6 +28209,11 @@ I2C1 I2C1 peripheral 0xbf805000 + + 0x0 + 0x70 + registers + I2C1CON @@ -28812,6 +28978,11 @@ I2C2 I2C2 peripheral 0xbf805100 + + 0x0 + 0x70 + registers + I2C2CON @@ -29576,6 +29747,11 @@ SPI1 SPI1 peripheral 0xbf805800 + + 0x0 + 0x50 + registers + SPI1CON @@ -30444,6 +30620,11 @@ SPI2 SPI2 peripheral 0xbf805a00 + + 0x0 + 0x50 + registers + SPI2CON @@ -31312,6 +31493,11 @@ UART1 UART1 peripheral 0xbf806000 + + 0x0 + 0x50 + registers + U1MODE @@ -31933,6 +32119,11 @@ UART2 UART2 peripheral 0xbf806200 + + 0x0 + 0x50 + registers + U2MODE @@ -32554,6 +32745,11 @@ UART3 UART3 peripheral 0xbf806400 + + 0x0 + 0x50 + registers + U3MODE @@ -33175,6 +33371,11 @@ UART4 UART4 peripheral 0xbf806600 + + 0x0 + 0x50 + registers + U4MODE @@ -33796,6 +33997,11 @@ PMP PMP peripheral 0xbf807000 + + 0x0 + 0x70 + registers + PMCON @@ -34663,6 +34869,11 @@ ADC10 ADC10 peripheral 0xbf809000 + + 0x0 + 0x170 + registers + AD1CON1 @@ -35442,6 +35653,11 @@ CVR CVR peripheral 0xbf809800 + + 0x0 + 0x10 + registers + CVRCON @@ -35565,6 +35781,11 @@ CMP1 CMP1 peripheral 0xbf80a000 + + 0x0 + 0x10 + registers + CM1CON @@ -35720,6 +35941,11 @@ CMP2 CMP2 peripheral 0xbf80a010 + + 0x0 + 0x10 + registers + CM2CON @@ -35875,6 +36101,11 @@ CMP CMP peripheral 0xbf80a060 + + 0x0 + 0x10 + registers + CMSTAT @@ -35982,6 +36213,11 @@ CTMU CTMU peripheral 0xbf80a200 + + 0x0 + 0x10 + registers + CTMUCON @@ -36313,6 +36549,11 @@ OSC OSC peripheral 0xbf80f000 + + 0x0 + 0x40 + registers + OSCCON @@ -36896,6 +37137,11 @@ CFG CFG peripheral 0xbf80f200 + + 0x0 + 0xa0 + registers + CFGCON @@ -37729,6 +37975,11 @@ NVM NVM peripheral 0xbf80f400 + + 0x0 + 0x50 + registers + NVMCON @@ -37959,6 +38210,11 @@ RCON RCON peripheral 0xbf80f600 + + 0x0 + 0x20 + registers + RCON @@ -38214,6 +38470,11 @@ PPS PPS peripheral 0xbf80fa04 + + 0x0 + 0x2b0 + registers + INT1R diff --git a/ci/regtest/PIC32MX695F512L.svd b/ci/regtest/PIC32MX695F512L.svd index 4363e69..fb960f0 100644 --- a/ci/regtest/PIC32MX695F512L.svd +++ b/ci/regtest/PIC32MX695F512L.svd @@ -1,11 +1,17 @@ PIC32MX695F512L + 32 WDT WDT peripheral 0xbf800000 + + 0x0 + 0x10 + registers + WDTCON @@ -97,6 +103,11 @@ RTCC RTCC peripheral 0xbf800200 + + 0x0 + 0x60 + registers + RTCCON @@ -960,6 +971,11 @@ TMR1 TMR1 peripheral 0xbf800600 + + 0x0 + 0x30 + registers + T1CON @@ -1251,6 +1267,11 @@ TMR2 TMR2 peripheral 0xbf800800 + + 0x0 + 0x30 + registers + T2CON @@ -1510,6 +1531,11 @@ TMR3 TMR3 peripheral 0xbf800a00 + + 0x0 + 0x30 + registers + T3CON @@ -1753,6 +1779,11 @@ TMR4 TMR4 peripheral 0xbf800c00 + + 0x0 + 0x30 + registers + T4CON @@ -2012,6 +2043,11 @@ TMR5 TMR5 peripheral 0xbf800e00 + + 0x0 + 0x30 + registers + T5CON @@ -2255,6 +2291,11 @@ ICAP1 ICAP1 peripheral 0xbf802000 + + 0x0 + 0x20 + registers + IC1CON @@ -2471,6 +2512,11 @@ ICAP2 ICAP2 peripheral 0xbf802200 + + 0x0 + 0x20 + registers + IC2CON @@ -2687,6 +2733,11 @@ ICAP3 ICAP3 peripheral 0xbf802400 + + 0x0 + 0x20 + registers + IC3CON @@ -2903,6 +2954,11 @@ ICAP4 ICAP4 peripheral 0xbf802600 + + 0x0 + 0x20 + registers + IC4CON @@ -3119,6 +3175,11 @@ ICAP5 ICAP5 peripheral 0xbf802800 + + 0x0 + 0x20 + registers + IC5CON @@ -3335,6 +3396,11 @@ OCMP1 OCMP1 peripheral 0xbf803000 + + 0x0 + 0x30 + registers + OC1CON @@ -3594,6 +3660,11 @@ OCMP2 OCMP2 peripheral 0xbf803200 + + 0x0 + 0x30 + registers + OC2CON @@ -3853,6 +3924,11 @@ OCMP3 OCMP3 peripheral 0xbf803400 + + 0x0 + 0x30 + registers + OC3CON @@ -4112,6 +4188,11 @@ OCMP4 OCMP4 peripheral 0xbf803600 + + 0x0 + 0x30 + registers + OC4CON @@ -4371,6 +4452,11 @@ OCMP5 OCMP5 peripheral 0xbf803800 + + 0x0 + 0x30 + registers + OC5CON @@ -4630,6 +4716,11 @@ I2C3 I2C3 peripheral 0xbf805000 + + 0x0 + 0x70 + registers + I2C3CON @@ -5394,6 +5485,11 @@ I2C4 I2C4 peripheral 0xbf805100 + + 0x0 + 0x70 + registers + I2C4CON @@ -6158,6 +6254,11 @@ I2C5 I2C5 peripheral 0xbf805200 + + 0x0 + 0x70 + registers + I2C5CON @@ -6922,6 +7023,11 @@ I2C1 I2C1 peripheral 0xbf805300 + + 0x0 + 0x70 + registers + I2C1CON @@ -7686,6 +7792,11 @@ I2C2 I2C2 peripheral 0xbf805400 + + 0x0 + 0x70 + registers + I2C2CON @@ -8450,6 +8561,11 @@ SPI3 SPI3 peripheral 0xbf805800 + + 0x0 + 0x40 + registers + SPI3CON @@ -9090,6 +9206,11 @@ SPI2 SPI2 peripheral 0xbf805a00 + + 0x0 + 0x40 + registers + SPI2CON @@ -9730,6 +9851,11 @@ SPI4 SPI4 peripheral 0xbf805c00 + + 0x0 + 0x40 + registers + SPI4CON @@ -10370,6 +10496,11 @@ SPI1 SPI1 peripheral 0xbf805e00 + + 0x0 + 0x40 + registers + SPI1CON @@ -11010,6 +11141,11 @@ UART1 UART1 peripheral 0xbf806000 + + 0x0 + 0x50 + registers + U1MODE @@ -11631,6 +11767,11 @@ UART4 UART4 peripheral 0xbf806200 + + 0x0 + 0x50 + registers + U4MODE @@ -12220,6 +12361,11 @@ UART3 UART3 peripheral 0xbf806400 + + 0x0 + 0x50 + registers + U3MODE @@ -12841,6 +12987,11 @@ UART6 UART6 peripheral 0xbf806600 + + 0x0 + 0x50 + registers + U6MODE @@ -13430,6 +13581,11 @@ UART2 UART2 peripheral 0xbf806800 + + 0x0 + 0x50 + registers + U2MODE @@ -14051,6 +14207,11 @@ UART5 UART5 peripheral 0xbf806a00 + + 0x0 + 0x50 + registers + U5MODE @@ -14640,6 +14801,11 @@ PMP PMP peripheral 0xbf807000 + + 0x0 + 0x70 + registers + PMCON @@ -15507,6 +15673,11 @@ ADC10 ADC10 peripheral 0xbf809000 + + 0x0 + 0x170 + registers + AD1CON1 @@ -16338,6 +16509,11 @@ CVR CVR peripheral 0xbf809800 + + 0x0 + 0x10 + registers + CVRCON @@ -16461,6 +16637,11 @@ CMP1 CMP1 peripheral 0xbf80a000 + + 0x0 + 0x10 + registers + CM1CON @@ -16616,6 +16797,11 @@ CMP2 CMP2 peripheral 0xbf80a010 + + 0x0 + 0x10 + registers + CM2CON @@ -16771,6 +16957,11 @@ CMP CMP peripheral 0xbf80a060 + + 0x0 + 0x10 + registers + CMSTAT @@ -16878,6 +17069,11 @@ OSC OSC peripheral 0xbf80f000 + + 0x0 + 0x20 + registers + OSCCON @@ -17213,6 +17409,11 @@ CFG CFG peripheral 0xbf80f200 + + 0x0 + 0x40 + registers + DDPCON @@ -17310,6 +17511,11 @@ NVM NVM peripheral 0xbf80f400 + + 0x0 + 0x50 + registers + NVMCON @@ -17540,6 +17746,11 @@ RCON RCON peripheral 0xbf80f600 + + 0x0 + 0x20 + registers + RCON @@ -17779,6 +17990,11 @@ _DDPSTAT _DDPSTAT peripheral 0xbf880140 + + 0x0 + 0x10 + registers + _DDPSTAT @@ -17819,6 +18035,11 @@ _STRO _STRO peripheral 0xbf880170 + + 0x0 + 0x10 + registers + _STRO @@ -17878,6 +18099,11 @@ _APPO _APPO peripheral 0xbf880180 + + 0x0 + 0x10 + registers + _APPO @@ -17937,6 +18163,11 @@ _APPI _APPI peripheral 0xbf880190 + + 0x0 + 0x10 + registers + _APPI @@ -17957,6 +18188,11 @@ INT INT peripheral 0xbf881000 + + 0x0 + 0x160 + registers + INTCON @@ -23137,6 +23373,11 @@ BMX BMX peripheral 0xbf882000 + + 0x0 + 0x80 + registers + BMXCON @@ -23555,6 +23796,11 @@ DMAC DMAC peripheral 0xbf883000 + + 0x0 + 0x60 + registers + DMACON @@ -24050,6 +24296,11 @@ DMAC0 DMAC0 peripheral 0xbf883060 + + 0x0 + 0xc0 + registers + DCH0CON @@ -25129,6 +25380,11 @@ DMAC1 DMAC1 peripheral 0xbf883120 + + 0x0 + 0xc0 + registers + DCH1CON @@ -26208,6 +26464,11 @@ DMAC2 DMAC2 peripheral 0xbf8831e0 + + 0x0 + 0xc0 + registers + DCH2CON @@ -27287,6 +27548,11 @@ DMAC3 DMAC3 peripheral 0xbf8832a0 + + 0x0 + 0xc0 + registers + DCH3CON @@ -28366,6 +28632,11 @@ DMAC4 DMAC4 peripheral 0xbf883360 + + 0x0 + 0xc0 + registers + DCH4CON @@ -29445,6 +29716,11 @@ DMAC5 DMAC5 peripheral 0xbf883420 + + 0x0 + 0xc0 + registers + DCH5CON @@ -30524,6 +30800,11 @@ DMAC6 DMAC6 peripheral 0xbf8834e0 + + 0x0 + 0xc0 + registers + DCH6CON @@ -31603,6 +31884,11 @@ DMAC7 DMAC7 peripheral 0xbf8835a0 + + 0x0 + 0xc0 + registers + DCH7CON @@ -32682,6 +32968,11 @@ PCACHE PCACHE peripheral 0xbf884000 + + 0x0 + 0xd0 + registers + CHECON @@ -33129,6 +33420,11 @@ USB USB peripheral 0xbf885040 + + 0x0 + 0x3c0 + registers + U1OTGIR @@ -36718,6 +37014,11 @@ PORTA PORTA peripheral 0xbf886000 + + 0x0 + 0x40 + registers + TRISA @@ -37637,6 +37938,11 @@ PORTB PORTB peripheral 0xbf886040 + + 0x0 + 0x40 + registers + TRISB @@ -38812,6 +39118,11 @@ PORTC PORTC peripheral 0xbf886080 + + 0x0 + 0x40 + registers + TRISC @@ -39475,6 +39786,11 @@ PORTD PORTD peripheral 0xbf8860c0 + + 0x0 + 0x40 + registers + TRISD @@ -40650,6 +40966,11 @@ PORTE PORTE peripheral 0xbf886100 + + 0x0 + 0x40 + registers + TRISE @@ -41441,6 +41762,11 @@ PORTF PORTF peripheral 0xbf886140 + + 0x0 + 0x40 + registers + TRISF @@ -42168,6 +42494,11 @@ PORTG PORTG peripheral 0xbf886180 + + 0x0 + 0x70 + registers + TRISG @@ -43947,6 +44278,11 @@ ETH ETH peripheral 0xbf889000 + + 0x0 + 0x330 + registers + ETHCON1 diff --git a/src/main.rs b/src/main.rs index 033a201..473f817 100644 --- a/src/main.rs +++ b/src/main.rs @@ -235,11 +235,15 @@ fn analyze_periph(periph: &Element, periph_out_e: &mut Element) { desc_e.children.push(XMLNode::Text(format!("{} peripheral", peri))); let mut base_addr_e = Element::new("baseAddress"); base_addr_e.children.push(XMLNode::Text(format!("0x{:0x}", base_addr))); + let mut address_block_e = Element::new("addressBlock"); + add_elem_with_text(&mut address_block_e, "offset", "0x0"); + // Address block size is re-written after iterating each register + add_elem_with_text(&mut address_block_e, "size", "0x0"); + add_elem_with_text(&mut address_block_e, "usage", "registers"); let registers_e = Element::new("registers"); - peri_e.children.push(XMLNode::Element(name_e)); - peri_e.children.push(XMLNode::Element(desc_e)); - peri_e.children.push(XMLNode::Element(base_addr_e)); - peri_e.children.push(XMLNode::Element(registers_e)); + for e in [name_e, desc_e, base_addr_e, address_block_e, registers_e] { + peri_e.children.push(XMLNode::Element(e)); + } periph_out_e.children.push(XMLNode::Element(peri_e)); info!("{} base_addr = {:0x}", peri, base_addr); } @@ -300,6 +304,20 @@ fn analyze_periph(periph: &Element, periph_out_e: &mut Element) { ); } info!(""); + + // Update the address block size + periph_out_e + .children + .last_mut() + .unwrap() + .as_mut_element() + .unwrap() + .get_mut_child("addressBlock") + .unwrap() + .get_mut_child("size") + .unwrap() + // Allow space for 4 registers, even if not all are defined + .children[0] = XMLNode::Text(format!("{:#x}", offset + 0x10)); } } } @@ -347,9 +365,9 @@ fn main() { .expect("PhysicalSpace element missing"); let mut develem = Element::new("device"); - let mut name_e = Element::new("name"); - name_e.children.push(XMLNode::Text(name.to_string())); - develem.children.push(XMLNode::Element(name_e)); + add_elem_with_text(&mut develem, "name", name); + add_elem_with_text(&mut develem, "width", "32"); + let mut periph_out = Element::new("peripherals"); for node in phys.children.iter() {