This article describes known errors that occur in the Altera® ( Intel® ) SoC FPGA development environment and how to counter them.
Introduction.
bsp-create-settings is the tool used in the bootloader generation flow of the SoC FPGA Embedded Development Suite (SoC EDS) v19.1d / v19.3pro and later, but in some cases this tool does not work as expected and causes errors This article is intended to help you understand how to use the bsp-creation tool.
This article introduces errors that occur with bsp-create-settings and their countermeasures.
Error Conditions
This error has been observed only in the Windows version of SoC EDS v20.1std. The Linux version has limited impact as it works correctly.
The SoC EDS v19.1std / v19.3pro and later require the bootloader to be built under a Linux OS environment, so this does not affect users who do all bootloader generation work under a Linux OS environment. bsp-create-settings in a Windows 10 SoC EDS environment and only the bootloader build work is done under Windows Subsystem for Linux (hereafter referred to as WSL), you will face an error.
Point:
It can be avoided by using the Linux version of SoC EDS v20.1std, but when using WSL, the SoC EDS installer cannot be executed because it is a CUI environment instead of a desktop GUI environment. Therefore, a workaround to install the Linux version of SoC EDS is not possible in a WSL environment.
Error Description
Figure 1 shows the result of running bsp-create-settings on Embedded Command Shell.
The message image for normal operation is shown first.
Figure 1. bsp-create-settings Success
In case of normal operation, various header files are generated in the generated folder under the bsp project with the message shown in the blue frame.
Figure 2 below shows the message image when an error occurs.
Figure 2. bsp-create-settings Failure (Error occurred)
The red frame indicates the error message. ImportError: cannot import name 'expatbuilder' from 'xml.dom' ..." and information similar to the Call Trace of a Python script is displayed. Various header files are not generated.
The full error message is also attached below in text format.
INFO: Tcl message: "Traceback (most recent call last):"
INFO: Tcl message: " File "scripts/iswgen.py", line 62, in <module>"
INFO: Tcl message: " emif = emif.EMIFGrokker(inputDir, outputDir, 'emif.xml')"
INFO: Tcl message: " File "C:\intelFPGA\20.1\embedded\ip\altera\preloader\scripts\emif.py", line 33, in __init__"
INFO: Tcl message: " self.emifDom = xml.dom.minidom.parse(self.emifFileName)"
INFO: Tcl message: " File "C:\intelfpga\20.1\embedded\host_tools\python\lib\xml\dom\minidom.py", line 1958, in parse"
INFO: Tcl message: " from xml.dom import expatbuilder"
INFO: Tcl message: "ImportError: cannot import name 'expatbuilder' from 'xml.dom' (C:\intelfpga\20.1\embedded\host_tools\python\lib\xml\dom\__init__.py)"
WARNING: Tcl script "C:\intelfpga\20.1\embedded\ip\altera\preloader\spl_callbacks.tcl spl C:/lab/soc_lab/cv_soc_lab/software/spl_bsp" error: couldn't open "reset_config.h.template": no such file or directory
Error Cause and Countermeasures
The cause of the error seems to be that the Python environment included with SoC EDS lacks the necessary libraries. You can fix it by storing expatbuilder.py and expat.py attached to this article in the following location.
- C:\intelFPGA\20.1\embedded\host_tools\python\Lib\xml\dom\expatbuilder.py
- C:\intelFPGA\20.1\embedded\host_tools\python\Lib\xml\parsers\expat.py
Figure 3 compares the Python libraries of the Windows and Linux versions of SoC EDS v20.1std for reference.
Figure 3. Comparison of Python libraries included with SoC EDS (Windows version x Linux version)
We can see that expatbuilder.py and expat.py, which exist in the Linux version and work properly, do not exist in the Windows version. After porting the two files to the Windows version, we confirmed that the error was resolved.
Conclusion
We have confirmed that the error can be avoided by the method introduced here, but please consider this as a temporary solution. In the future, we recommend that you use the method applied to the new tool version.
Attached file
Please download the file for the countermeasure from the link below.
(*The attached file is equivalent to the file available at https://github.com/python/cpython/tree/3.8/Lib/xml. For license information, please refer to Copyright and License Information )