Rahix / atdf2svd

Converter from Atmel's atdf format to CMSIS SVD
GNU General Public License v3.0
17 stars 10 forks source link

Clarifying naming of interrupt vectors on new AVR MCUs #16

Closed trembel closed 3 years ago

trembel commented 3 years ago

New AVR MCUs contain a list containing all interrupts, similar to the following (attiny412.atdf):

      <interrupts>
        <interrupt index="1" module-instance="CRCSCAN" name="NMI"/>
        <interrupt index="2" module-instance="BOD" name="VLM"/>
        <interrupt index="3" module-instance="PORTA" name="PORT"/>
        <interrupt index="6" module-instance="RTC" name="CNT"/>
        <interrupt index="7" module-instance="RTC" name="PIT"/>
        <interrupt index="8" module-instance="TCA0" name="LUNF"/>
        <interrupt index="8" module-instance="TCA0" name="OVF"/>
        <interrupt index="9" module-instance="TCA0" name="HUNF"/>
        <interrupt index="10" module-instance="TCA0" name="CMP0"/>
        <interrupt index="10" module-instance="TCA0" name="LCMP0"/>
        <interrupt index="11" module-instance="TCA0" name="CMP1"/>
        <interrupt index="11" module-instance="TCA0" name="LCMP1"/>
        <interrupt index="12" module-instance="TCA0" name="CMP2"/>
        <interrupt index="12" module-instance="TCA0" name="LCMP2"/>
        <interrupt index="13" module-instance="TCB0" name="INT"/>
        <interrupt index="14" module-instance="TCD0" name="OVF"/>
        <interrupt index="15" module-instance="TCD0" name="TRIG"/>
        <interrupt index="16" module-instance="AC0" name="AC"/>
        <interrupt index="17" module-instance="ADC0" name="RESRDY"/>
        <interrupt index="18" module-instance="ADC0" name="WCOMP"/>
        <interrupt index="19" module-instance="TWI0" name="TWIS"/>
        <interrupt index="20" module-instance="TWI0" name="TWIM"/>
        <interrupt index="21" module-instance="SPI0" name="INT"/>
        <interrupt index="22" module-instance="USART0" name="RXC"/>
        <interrupt index="23" module-instance="USART0" name="DRE"/>
        <interrupt index="24" module-instance="USART0" name="TXC"/>
        <interrupt index="25" module-instance="NVMCTRL" name="EE"/>
      </interrupts>

The module-instance is neglected at the moment, leading to a bad naming of the addresses, e.g. CMP0 - without informations on the peripheral:

      <interrupt>
        <name>NMI</name>
        <value>1</value>
        <description>&lt;TBD></description>
      </interrupt>
      <interrupt>
        <name>VLM</name>
        <value>2</value>
        <description>&lt;TBD></description>
      </interrupt>
      <interrupt>
        <name>PORT</name>
        <value>3</value>
        <description>&lt;TBD></description>
      </interrupt>
      ...
trembel commented 3 years ago

Additional informations in #15

trembel commented 3 years ago

What about naming the fields "module-instance_name", iff module-instance is available? As far as I've seen now (attiny412.atdf and AVR128DA28.atdf), the module-instance only shows up in the interrupt map.

Rahix commented 3 years ago

Yeah, this is what I was thinking as well. Though we need to check whether this regresses any of the "old" ATDF files. It might also be worth it to look at the C headers, how they name interrupts on the newer MCUs.

trembel commented 3 years ago

iotn412.h - Header of attiny412:

/* ========== Interrupt Vector Definitions ========== */
/* Vector 0 is the reset vector */

/* CRCSCAN interrupt vectors */
#define CRCSCAN_NMI_vect_num  1
#define CRCSCAN_NMI_vect      _VECTOR(1)  /*  */

/* BOD interrupt vectors */
#define BOD_VLM_vect_num  2
#define BOD_VLM_vect      _VECTOR(2)  /*  */

/* PORTA interrupt vectors */
#define PORTA_PORT_vect_num  3
#define PORTA_PORT_vect      _VECTOR(3)  /*  */

/* RTC interrupt vectors */
#define RTC_CNT_vect_num  6
#define RTC_CNT_vect      _VECTOR(6)  /*  */
#define RTC_PIT_vect_num  7
#define RTC_PIT_vect      _VECTOR(7)  /*  */
...

This are all AVR targets containing the module-instance keyword:

(From the atdf's in Microchip ATautomotive Series Device Support (2.1.39), Microchip ATmega Series Device Support (2.2.108), Microchip ATtiny Series Device Support (2.5.116), Microchip AVR-Dx Series Device Support (1.6.88))

Rahix commented 3 years ago

Okay, that does not seem to include any of the "old" chips which I was worried about ... And the C header does look like it is doing the same thing you proposed so I think this is the way to go!