~ruther/avr-device

e0d031a3913eb292b21d270f6a9351d34074f590 — Rahix 5 years ago d5a733e
svdpatch: Fix field modifications

Signed-off-by: Rahix <rahix@rahix.de>
1 files changed, 5 insertions(+), 1 deletions(-)

M patch/svdpatch.py
M patch/svdpatch.py => patch/svdpatch.py +5 -1
@@ 9,6 9,7 @@ To be integrated into the build system, support for an input / output svd argume

Additional changes:
    - Support for _replace_enum to overwrite existing <enumeratedValues>
    - Fix field modifications not being able to add new elements
"""

import copy


@@ 221,7 222,10 @@ def process_register_modify(rtag, fspec, fmod):
    for ftag in iter_fields(rtag, fspec):
        for (key, value) in fmod.items():
            try:
                ftag.find(key).text = str(value)
                tag = ftag.find(key)
                if tag is None:
                    tag = ET.SubElement(ftag, key)
                tag.text = str(value)
            except AttributeError:
                raise SvdPatchError('invalid attribute {!r} for '
                                    'register {}, field {}'

Do not follow this link