svd2zig
svd2zig copied to clipboard
some InvalidXML and StreamTooLong errors
I'd like to add a mission to my microbit repo that uses svd2zig on nrf51.svd. There was a sentinel error on a previous svd2zig and zig/master combo but that has since been eliminated. However, before I discovered that the problem was eliminated I wrote this script and discovered a lot of the posborne svd files had either InvalidXML or StreamTooLong errors.
-
I ran xmllint on all of the invalid ones and it did not report any issues.
-
Do you have any immediate insight into the StreamTooLong errors?
Regards, Mark
#!/bin/bash
for f in $(find cmsis-svd -iname '*.svd' | sort)
do
zig-cache/bin/svd2zig $f 2> errors > /dev/null
if [[ $? != 0 ]]
then
error=$(grep -i error: errors)
if [[ $? != 0 ]]
then
echo $f
cat errors
else
echo $f $error
fi
fi
done
Hey Mark, as stated in the readme, I wrote only enough to translate the specific svd file I needed so I know there are plenty of valid svd fields that are not parsed currently.
Can you link me to one that generates the StreamTooLong error? That comes from within the std lib so I'm not sure.
I found that the StreamTooLong is fixed by increasing the line buffer from 1024 to 1024 * 1024. I’ll send a pr for that next week. Cheers, Mark.
https://github.com/vegecode/svd2zig/pull/5
Moved from stack to global because of size. Of 658 .svd files, 159 report invalid xml and the stream too long errors are eliminated. Next week will see if the invalid xml errors can be replaced with a more specific message of which tag is not recognized.
FYI https://github.com/ziglang/zig/issues/4593 is what happens if 10MB is used.