Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[svdconv] disableCondition Inheritance leads to a segment violation #1796

Open
ckudera opened this issue Oct 7, 2024 · 0 comments
Open

[svdconv] disableCondition Inheritance leads to a segment violation #1796

ckudera opened this issue Oct 7, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@ckudera
Copy link

ckudera commented Oct 7, 2024

Describe the bug
The inheritance (deriveFrom) of element disableCondition leads to a segment violation.

To Reproduce
To reproduce, run the following svd with svdconv:

<?xml version='1.0' encoding='utf-8'?>
<device xmlns:xs="http://www.w3.org/2001/XMLSchema-instance" xs:noNamespaceSchemaLocation="CMSIS-SVD.xsd" schemaVersion="1.3">
  <name>test</name>
  <version>1.0</version>
  <description>Test_Example device</description>
  <addressUnitBits>8</addressUnitBits>
  <width>32</width>
  <peripherals>
    <peripheral>
      <name>PeripheralA</name>
      <disableCondition>0 == 0</disableCondition>
      <baseAddress>0x40004000</baseAddress>
      <addressBlock>
        <offset>0x0</offset>
        <size>0x1000</size>
        <usage>registers</usage>
      </addressBlock>
      <registers>
        <register>
          <name>RegisterA</name>
          <addressOffset>0x0</addressOffset>
        </register>
      </registers>
    </peripheral>
    <peripheral derivedFrom="PeripheralA">
      <name>PeripheralB</name>
      <baseAddress>0x40002000</baseAddress>
    </peripheral>
  </peripherals>
</device>

Results in:

$ ./svdconv --generate header --fields enum /mnt/data/Temp/ARMify/svd-test-files/value_inheritance.svd
Exception or Segmentation fault occurred!
  11 : segment violation

CMSIS SVD Check / Converter 3.3.47+p98-g07416995 (Sep 30 2024 14:55:46)
Copyright (C) 2010-2024 ARM Ltd and ARM Germany GmbH. All rights reserved.

Arguments: ./svdconv --generate header --fields enum /mnt/data/Temp/ARMify/svd-test-files/value_inheritance.svd


*** INFO M317: /mnt/data/Temp/ARMify/svd-test-files/value_inheritance.svd (Line 19) 
  Register <description> not set.

*** INFO M332: /mnt/data/Temp/ARMify/svd-test-files/value_inheritance.svd (Line 9) 
  Peripheral 'PeripheralA' has only one Register.

*** INFO M317: /mnt/data/Temp/ARMify/svd-test-files/value_inheritance.svd (Line 9) 
  Peripheral <description> not set.

*** INFO M332: /mnt/data/Temp/ARMify/svd-test-files/value_inheritance.svd (Line 25) 
  Peripheral 'PeripheralB' has only one Register.

*** INFO M317: /mnt/data/Temp/ARMify/svd-test-files/value_inheritance.svd (Line 25) 
  Peripheral <description> not set.

*** WARNING M223: /mnt/data/Temp/ARMify/svd-test-files/value_inheritance.svd (Line 2) 
  Input File Name 'value_inheritance' does not match the tag <name> in the <device> section: 'test'

*** INFO M356: /mnt/data/Temp/ARMify/svd-test-files/value_inheritance.svd
  No Interrupt definitions found.

*** WARNING M209: /mnt/data/Temp/ARMify/svd-test-files/value_inheritance.svd
  CPU section not set. This is required for CMSIS Headerfile generation and debug support.

*** WARNING M209: /mnt/data/Temp/ARMify/svd-test-files/value_inheritance.svd
  CPU section not set. This is required for CMSIS Headerfile generation and debug support.

*** CRITICAL ERROR M104: /mnt/data/Temp/ARMify/svd-test-files/value_inheritance.svd
  Exception or Segmentation fault occurred!
  11 : segment violation

Expected behavior
The value of disableCondition should be inherited.

Environment (please complete the following information):

  • Version: CMSIS SVD Check / Converter 3.3.47+p98-g07416995 (Sep 30 2024 14:55:46)
  • OS: Linux

Additional context
Workaround: Specify same disableCondition in derived peripheral.

E.g.:

<?xml version='1.0' encoding='utf-8'?>
<device xmlns:xs="http://www.w3.org/2001/XMLSchema-instance" xs:noNamespaceSchemaLocation="CMSIS-SVD.xsd" schemaVersion="1.3">
  <name>test</name>
  <version>1.0</version>
  <description>Test_Example device</description>
  <addressUnitBits>8</addressUnitBits>
  <width>32</width>
  <peripherals>
    <peripheral>
      <name>PeripheralA</name>
      <disableCondition>0 == 0</disableCondition>
      <baseAddress>0x40004000</baseAddress>
      <addressBlock>
        <offset>0x0</offset>
        <size>0x1000</size>
        <usage>registers</usage>
      </addressBlock>
      <registers>
        <register>
          <name>RegisterA</name>
          <addressOffset>0x0</addressOffset>
        </register>
      </registers>
    </peripheral>
    <peripheral derivedFrom="PeripheralA">
      <name>PeripheralB</name>
      <disableCondition>0 == 0</disableCondition>
      <baseAddress>0x40002000</baseAddress>
    </peripheral>
  </peripherals>
</device>
@ckudera ckudera added the bug Something isn't working label Oct 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant