Allow running with just Python Standard Library#55
Allow running with just Python Standard Library#55Flameeyes wants to merge 3 commits intobnahill:masterfrom
Conversation
While ElementTree has some slightly more verbose APIs to find the text within sub-elements, it allows simplifying quite a bit the iteration logic, but most importantly it is part of the Python Standard Library. In particular, there is a limitation in the Zephyr SDK where only Python 3.8 can be used, but many distributions (including OpenSuSE Tumbleweed and CentOS 9 Stream) no longer support installing lxml on this version. By using the standard library module, the code becomes a lot more portable.
|
Outstanding upgrade! Can you perhaps test out another option? There's a branch incorporating cmsis-svd (which also uses elementtree) as a parser replacement here. It's worked fine in my testing but it's been a while. I'm not entirely sure which way to go forward from here, but would like to avoid having two functionally similar codebases. |
|
I'll give it a try, but I'm afraid it might have the same problem as the lxml dependency at least in the specific case I'm looking at: it requires a pip dependency ( I originally considered splitting the parsing and loading, so that you can use your "usual" host Python to translate from SVD to a significantly simplified format that gdb can load, but then realized just hanging lxml→elementtree fixed it — but I totally see the point of not maintaining an equivalent parser. |
This import is only used to find installed SVD files as part of cmsis-svd. But when using this project as part of a minimal Python installation (such as if you try to use the Zephyr SDK on openSUSE Tumbleweed) there is no pip, nor setuptools, nor ability to install cmsis-svd. So don't fail to load, just ignore the cmsis_svd loading if the import fails.
There is a similar check in `_print_registers()` when given a peripheral with no registers, but there are also registers with no fields.
|
After I prepared this, openSUSE pulled one more package for Python 3.8 so I hit a different failure today 😅 I've added one more commit for it, and another commit for a small snag I hit while debugging the devkit I have at hand. |
|
Perhaps this might be helpful, my setup: SAMC21, Zephyr RTOS, Atmel debugger. https://forum.zubax.com/t/using-pycortexmdebug-with-zephyr-rtos/2174 |
|
This wouldn't work as the It can be very annoying install packages into the python that gdb uses, I generally try to avoid it. |
I've struggled getting these utilities to work with the Zephyr SDK due to the Python version.
So here's a pull request that removes the lxml dependency in favour of Python Standard Library's ElementTree instead.