pyocd / cmsis-pack-manager

A Rust and Python module for handling CMSIS Pack files
Apache License 2.0
27 stars 34 forks source link

Merge parent processor attributes #186

Closed david-sawatzke closed 2 years ago

david-sawatzke commented 2 years ago

According to https://www.keil.com/pack/doc/CMSIS/Pack/html/pdsc_family_pg.html#element_processor, the attributes of the processor in e.g. the family are used for processors in e.g. the device, if they're not set there.

In pack files like the ones for the XMC1000 series this is used (abbreviated):

    <family Dfamily="XMC1000" Dvendor="Infineon:7">
      <processor Dcore="Cortex-M0" DcoreVersion="r0p0" Dfpu="NO_FPU" Dmpu="NO_MPU" 
      <subFamily DsubFamily="XMC1100 Series">
      <device Dname="XMC1100-Q024x0008">
        <processor Dclock="32000000"/>

and for other pack files like: Keil.STM32F1xx_DFP.2.3.0.pack.

With this PR attributes of the parent processor element are merged into the device processor element if one already exists, previously two processors would have been created, which is somewhat nonsensical.

If there are two processor instances in the family or subFamily as well as in the device, they probably need to be matched using Pname & Punits but I'm not sure. Thus this gives an error.