ARM-software / CMSIS_5

CMSIS Version 5 Development Repository
http://arm-software.github.io/CMSIS_5/index.html
Apache License 2.0
1.33k stars 1.08k forks source link

SVD Validator: two lines description elements #121

Closed ilg-ul closed 7 years ago

ilg-ul commented 7 years ago

While using the SVD files, I noticed that sometimes the <description> text is arbitrarily split on two lines.

For example the following lines from the STM32F40x.svd:

            <field>
              <name>SEIS</name>
              <description>Seed error interrupt
              status</description>
              <bitOffset>6</bitOffset>
              <bitWidth>1</bitWidth>
              <access>read-write</access>
            </field>
            <field>
              <name>CEIS</name>
              <description>Clock error interrupt
              status</description>
              <bitOffset>5</bitOffset>
              <bitWidth>1</bitWidth>
              <access>read-write</access>
            </field>

According to normal XML rules, when parsing such a syntax, the result includes explicit line terminations and spaces:

    {
        "name": "SEIS",
        "description": "Seed error interrupt\r\n              status",
        "bitOffset": "6",
        "bitWidth": "1",
        "access": "read-write"
    },
    {
        "name": "CEIS",
        "description": "Clock error interrupt\r\n              status",
        "bitOffset": "5",
        "bitWidth": "1",
        "access": "read-write"
    },

This syntax leads to unusual displays in a debugger window.

Identifying and fixing these strings at application level is possible, but requires some efforts.

Questions:

JonatanAntoni commented 7 years ago

The SVD files and description strings are handwritten or generated using vendor tool exports. Unfortunately we have a lot of SVD files around without a common usage of the description field.

Instead of adding a bunch of messages (many SVDs are leading to thousands of them already) we decided to overrule the formatting within our generators. Thus SVDConv for instance simply removes multiple white-spaces. Forcing a line-break can be achieved using a escaped linefeed (\n).

I have appended a description of the current usage to the CMSIS-SVD documentation, see commit 5a5e78e08dc55d0c9497a0e0fca352472d692655.

JonatanAntoni commented 7 years ago

Closed due to inactivity.