EmbSys Registers View with CMSIS-SVD dimElementGroup

As outlined in “How to Add Register Details View in Eclipse“, I have a nice register detail level viewer for Eclipse and GDB. But one problem showed up: there were entries showing with %s:

PCR Register with %s

PCR Register with %s

The reason is that the parser is not handling the dimElementGroup of CMSIS-SVD.

The details of the dimElementGroup are described in http://www.keil.com/pack/doc/cmsis/SVD/html/group__dim_element_group__gr.html. This allows to repeat similar registers in the SVD XML file without increasing its size.

For example the SVD file has something like this:

      <registers>
        <register>
          <dim>32</dim>
          <dimIncrement>0x4</dimIncrement>
          <dimIndex>0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31</dimIndex>
          <name>PCR%s</name>
          <description>Pin Control Register n</description>
          <addressOffset>0</addressOffset>
          <size>32</size>
          <access>read-write</access>
          <resetValue>0</resetValue>
          <resetMask>0xFFFFF8A8</resetMask>

The important thing is this:

          <dim>32</dim>
          <dimIncrement>0x4</dimIncrement>
          <dimIndex>0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31</dimIndex>
          <name>PCR%s</name>

It says that there are 32 registers (), each address incremented by 0x4 (), and the register names () are PCR0, PRC1, … etc (%s replaced with the items in ).

Unfortunately, that SVD syntax is not supported by EmbSys Registers View (http://sourceforge.net/projects/embsysregview/) in Eclipse. First I thought that this is not a big deal. But the Freescale SVD files are heavily using the dimElementGroup feature, and with this the EmbSys Register viewer was not that useful. My hope was that maybe someone could volunteer and extend the plugin.

At the end, I needed that extension myself so badly to debug Freescale microcontroller. As a side effect, it was a good excercise to practice some Java coding again. And after a few sleepless night hours spending with understanding the existing plugin and code, I was able to get it working after some iterations.

With this, the dimElementGroups are working :-):

dimElementGroup working

dimElementGroup working

Actually I have not (yet?) implemented the full specification. For now I’m only handling comma separated lists like

<dimIndex>0,1,2,3,4,5</dimIndex>

but not the range notation as in

<dimIndex>3-10</dimIndex>

But I have not seen this yet in all the files I have used. So I’m good with this :-).

Updated Plugin

The updated patched plugin (patch v0.2) is available on GitHub here:

https://sourceforge.net/projects/mcuoneclipse/files/Eclipse%20Plugins/EmbSysReg/

❗ make sure you download the .zip in ‘raw’ mode!

Happy Viewing 🙂

Advertisements

3 thoughts on “EmbSys Registers View with CMSIS-SVD dimElementGroup

  1. Pingback: Updated Eclipse EmbSysReg Viewer with extra Freescale SVD Files | MCU on Eclipse

What do you think?

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.