leveldown-security / SVD-Loader-Ghidra

GNU General Public License v3.0
480 stars 98 forks source link

Fix peripheral address_block on multiple derived_from #17

Closed ciotto closed 1 year ago

ciotto commented 1 year ago

I found an SVD file that has a peripheral with derivedFrom chain (derivedFrom->...->derivedFrom).

In this file is also required that addressBlock use derivedFrom chain.

Artem-B commented 1 year ago

I've just encountered another case where derivedFrom is not working. ATSAMD20E18.svd in https://packs.download.microchip.com/Microchip.SAMD20_DFP.3.6.112.atpack (it's actually a zip file). has a lot of peripherals deriving their registers from the first instance of the peripheral. SVD-loader does not see the registers in that case:

   <peripheral>                                                            
     <name>SERCOM0</name>                                                  
     <registers>
...
     </registers>                                                           
    </peripheral>    
    <peripheral derivedFrom="SERCOM0">                                 
      <name>SERCOM1</name>                                             

    </peripheral>                                                      

SVD-loader reports:

     SERCOM0
        0x42000800:0x4200081a
            I2CM_CTRLA(0x0:0x4)
            I2CM_CTRLB(0x4:0x8)
                        ..... <lots of registers skipped.>
            USART_STATUS(0x10:0x12)
            USART_DATA(0x18:0x1a)
    SERCOM1
        No registers.
    SERCOM2
        No registers.
    SERCOM3
        No registers.