Jegeva / ads2svd

turns cores form arm develloper studio to cmsis svds
3 stars 4 forks source link

Include folder name is case sensitive on Linux #3

Closed jwinarske closed 4 years ago

jwinarske commented 4 years ago

Found an issue with case sensitivity on the include folder. I suspect this will address https://github.com/Jegeva/ads2svd/issues/1

Without this change I see:

joel@hammer:~/git/ads2svd$ ./ads2svd.py -c /opt/arm/developmentstudio-2020.0/sw/debugger/configdb -a
/opt/arm/developmentstudio-2020.0/sw/debugger/configdb/Cores/88FR101.xml
/opt/arm/developmentstudio-2020.0/sw/debugger/configdb/Cores/88FR111.xml
/opt/arm/developmentstudio-2020.0/sw/debugger/configdb/Cores/A12_A7_bigLITTLE.xml
/opt/arm/developmentstudio-2020.0/sw/debugger/configdb/Cores/A15_A7_bigLITTLE.xml
/opt/arm/developmentstudio-2020.0/sw/debugger/configdb/Cores/A17_A7_bigLITTLE.xml
/opt/arm/developmentstudio-2020.0/sw/debugger/configdb/Cores/A53_A35_bigLITTLE.xml
Traceback (most recent call last):
  File "./ads2svd.py", line 64, in loadxml
    tree.xinclude()
  File "src/lxml/etree.pyx", line 2366, in lxml.etree._ElementTree.xinclude
  File "src/lxml/xinclude.pxi", line 62, in lxml.etree.XInclude.__call__
lxml.etree.XIncludeError: XPointer evaluation failed: #xmlns(namespace=http://com.arm.targetconfigurationeditor)xpointer(//namespace:enumeration), line 17

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "./ads2svd.py", line 115, in <module>
    get_all()
  File "./ads2svd.py", line 94, in get_all
    loadxml(x)     
  File "./ads2svd.py", line 68, in loadxml
    error_log.write( 'ERR;num=%d;file="%s";errhref="%s";errreason="%s";merrmsg="%s"\n' % (nfail,p[len(config["base_path"]):],el.get("href"),el.get("xpointer"),err))
KeyError: 'base_path'

Thanks for the tool :)

Jegeva commented 4 years ago

Hello, jwinarke and thanks for the pull request but :

1) Linux paths are indeed case sensitive

2) This is not a folder path but an xpath filter, and the standard defines include as lowercase : https://www.w3.org/TR/xinclude/

3) The bugs come from ARM's xml files, in my caveat emptor : "As long as the ARM Develloper Studio files are not correct in the source i cannot guarantee the completeness or accuracy of the generated SVDs" : the explanation is that they include files that don't exist.

What your fix does is actually make it so that the tools doesn't find the xincludes at all, of course dodging the "file does not exist" completely ;)

you will find in the 'in' folder all the input files from arm dev studio with a manual fix. This issue have been raised towards arm by one of their employees but it will take time is it is fixed at all.

i will try to work on this to check the file existence actually...

Jegeva commented 4 years ago

joel,

i fixed the (rather stupid) bug in master, can you try please ? you will be able to find all the xinclude errors in arm's xml corpus listed in out/xinclude_error.log

jwinarske commented 4 years ago

Ah! I just checked with master, and it works :)

Installing sudo apt-get install libsaxonhe-java on Ubuntu 18.04 it defaults to Saxon-HE-9.8.0.8.jar, but it does install a symlink Saxon-HE.jar. For make to work I have to point SAXONHE_PATH to the symlink.

Jegeva commented 4 years ago

saxon-HE : yeah it does the same on debian, i will change the makefile so it points to the symlink and will add it as a comment to the readme

i will close the pull request

jg