Git Product home page Git Product logo

Comments (8)

Rahix avatar Rahix commented on May 28, 2024

I've pushed commit 59bf4b3 ("peripheral: Make sure child nodes have the correct name") to at least make files affected by this generate SVD output for all the other stuff.

from atdf2svd.

trembel avatar trembel commented on May 28, 2024

I wanted to tackle that one. However, it does not seem to be that simple (not the implementation, but the way how to handle it).

On the attiny412 the TCA0 peripheral can be in one of two modes: Normal mode and Split mode. Similar to # , depending on the ... register all other register can have different "meanings". E.g.:

<module caption="16-bit Timer/Counter Type A" id="I2117" name="TCA">
      <register-group caption="16-bit Timer/Counter Type A - Single Mode" name="TCA_SINGLE" size="0x40">
        ...
        <register caption="Control A" initval="0x00" name="CTRLA" offset="0x00" rw="RW" size="1">
          <bitfield caption="Clock Selection" mask="0xe" name="CLKSEL" rw="RW" values="TCA_SINGLE_CLKSEL"/>
          <bitfield caption="Module Enable" mask="0x1" name="ENABLE" rw="RW"/>
        </register>
        ...
      </register-group>
      <register-group caption="16-bit Timer/Counter Type A - Split Mode" name="TCA_SPLIT" size="0x40">
        <register caption="Control A" initval="0x00" name="CTRLA" offset="0x00" rw="RW" size="1">
          <bitfield caption="Clock Selection" mask="0xe" name="CLKSEL" rw="RW" values="TCA_SPLIT_CLKSEL"/>
          <bitfield caption="Module Enable" mask="0x1" name="ENABLE" rw="RW"/>
        </register>
        ...
      </register-group

How should those two groups - the register in the above case have per coincidence the same meaning (others don't) - involving the same register addresses (but with different meaning) be combined? Or shouldn't they be combined (which in my opinion would violate the ownership/soundness of the generated code)?

from atdf2svd.

trembel avatar trembel commented on May 28, 2024

If the register have the same name in both cases, we could just add redundant bitfields with different meanings. But I'm not 100% sure if the register always have the same name.

from atdf2svd.

trembel avatar trembel commented on May 28, 2024

In the attached files are all occurrences of the nested register-groups. For all MCUs of the newer generation (except ATxmega), its only the TCA making problems. For the ATxmega also other peripherals have nested groups.

errors.txt

from atdf2svd.

chris-ricketts avatar chris-ricketts commented on May 28, 2024

@trembel is there anything I can do to assist in this? I'm trying to add support for the ATtiny1607.

from atdf2svd.

trembel avatar trembel commented on May 28, 2024

@trembel is there anything I can do to assist in this? I'm trying to add support for the ATtiny1607.

First it must be decided how to handle it.
Afterwards feel free to tackle this issue, I'll probably can't find any time this year..

from atdf2svd.

Rahix avatar Rahix commented on May 28, 2024

Just to make sure we're all on the same page: This "feature" is not a blocker for supporting the devices; any peripheral that is not using nested register-groups will work fine with the current atdf2svd. So for basic support for an MCU, this is most likely not necessary. It will only become an issue later, when trying to write HAL drivers for peripherals that use those nested register-groups ...

from atdf2svd.

xoriath avatar xoriath commented on May 28, 2024

In the c header files, modes are modelled as a union of structs:

/* 16-bit Timer/Counter Type A - Single Mode */
typedef struct TCA_SINGLE_struct
{
    register8_t CTRLA;  /* Control A */
    ...
} TCA_SINGLE_t;

/* 16-bit Timer/Counter Type A - Split Mode */
typedef struct TCA_SPLIT_struct
{
    register8_t CTRLA;  /* Control A */
   ...
} TCA_SPLIT_t;

/* 16-bit Timer/Counter Type A */
typedef union TCA_union
{
    TCA_SINGLE_t SINGLE;  /* 16-bit Timer/Counter Type A - Single Mode */
    TCA_SPLIT_t SPLIT;  /* 16-bit Timer/Counter Type A - Split Mode */
} TCA_t;

Nested register-groups are modelled as structs of structs:

/* DMA Channel */
typedef struct DMA_CH_struct
{
    register8_t CTRLA;  /* Channel Control */
    register8_t CTRLB;  /* Channel Control */
    register8_t ADDRCTRL;  /* Address Control */
    ...
} DMA_CH_t;

/*
--------------------------------------------------------------------------
DMA - DMA Controller
--------------------------------------------------------------------------
*/

/* DMA Controller */
typedef struct DMA_struct
{
    register8_t CTRL;  /* Control */
    ...
    DMA_CH_t CH0;  /* DMA Channel 0 */
    DMA_CH_t CH1;  /* DMA Channel 1 */
    DMA_CH_t CH2;  /* DMA Channel 2 */
    DMA_CH_t CH3;  /* DMA Channel 3 */
} DMA_t;

from atdf2svd.

Related Issues (15)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.