Menu

#28 xml include

Unstable_(example)
open
None
5
2017-11-07
2017-10-26
No

The following patch change the XML DTD to allow include tags. By using includes, shared definitions can be placed in a single for easier maintenance and reduced amount of data.
The code adds definitions for the SCB and SYSTICK on STM32F1XX. The definitions can be included in other processors as well.

1 Attachments

Discussion

  • Morten Kristiansen

    I'm considering if it would be a good idea to add templates as well. A template could represent a peripheral, which is then instantiated at an offset.

    Example:

    <template name="UART">
        <register name="CTRL"  address="0x0" ... />
        <register name="ISTAT"  address="0x4" ... />
            ...
    </template>
    
    <group name="UARTS" description="">
       <instantiate name="UART1" template="UART" offset="0x20000000" />
       <instantiate name="UART2" template="UART" offset="0x20000100" />
       <instantiate name="UART2" template="UART" offset="0x20000100">
           <register name="EXTRA_REG"  address="0x10" ... />
       </instantiate>
    </group>
    

    It would make maintenance a lot easier. E.g. you could add interpretations of registers in one place for all instances of peripherals on all variants in a processor family. You can archive this by placing all the templates in an XML shared by all members of a processor family.

    Interested?

     

    Last edit: Morten Kristiansen 2017-10-27
  • Morten Kristiansen

    Got inspired and seriously modified the code. Introduced the concept of controllers. I'll describe it in details before I'm done, but here are the headlines:

    A controller is typically an interrupt controller or a clock controller. Peripherals are connected to controllers using connections. At the moment I have implemented the NVIC of Cortex-M.

    To include an NVIC, all you need to include in the XML is this:

    <controller name="nvic" implementation="cortexm.NVIC">
      <parameter name="lines" value="60"/>
      <parameter name="prioritybits" value="3"/>
      <parameter name="address" value="0xE000E100"/>
    </controller>
    

    To define peripherals, you would typically do this:

    <group name="SPI" description="">
      <instantiate name="SPI1" template="SPI" offset="0x40013000">
        <control name="Interrupt" controller="nvic" connections="35" />
      </instantiate>
      <instantiate name="SPI2" template="SPI" offset="0x40003800">
        <control name="Interrupt" controller="nvic" connections="36" />
      </instantiate>
    </group>
    

    All peripherals are now defined in terms of templates defined in common file. I've attached an example.

    In the UI I now have a register group named "Interrupt" for peripherals that displays interrupt enable, pending and priority. I can also change these just like normal field.

    When I've tested and debugged the NVIC I'll start on the RCC for some of the STM processors. This will add another register group named something like "Clock" that displays whether the clock is enabled and what clock frequency the peripheral is fed.

    When something becomes sufficiently ready to test, I'll put up a binary build on my webserver. If anybody is interested in testing and giving suggestions, please chip in.

     

Log in to post a comment.