[PATCH] scripts: socfpga_import_preloader: Use SDK-supplied Python

Ian Abbott abbotti at mev.co.uk
Thu Jun 15 05:30:20 PDT 2023


Change `generate_spl()` to use the `python` bundled with the SDK (SoC
EDS) instead of using `python2.7`.  In version 20.1 of SoC EDS, the
`iswgen.py` script was updated to work with Python 3.8 and no longer
works with Python 2.7, leading to an error similar to this when
generating the SPL:

```
Generating file: /tmp/tmp.0xSiyYqAU2//sdram//sdram_config.h...
Traceback (most recent call last):
  File "/opt/intelFPGA/20.1/embedded/ip/altera/preloader/scripts/iswgen.py", line 63, in <module>
    hps = hps.HPSGrokker(inputDir, outputDir)
  File "/opt/intelFPGA/20.1/embedded/ip/altera/preloader/scripts/hps.py", line 54, in __init__
    self.createFilesFromHPS()
  File "/opt/intelFPGA/20.1/embedded/ip/altera/preloader/scripts/hps.py", line 546, in createFilesFromHPS
    self.handleHPSPeripheralsNode(childNode)
  File "/opt/intelFPGA/20.1/embedded/ip/altera/preloader/scripts/hps.py", line 413, in handleHPSPeripheralsNode
    self.pinmuxHeaderBuffer.write("#define " + name + ' ' + '(' + str(used) + ')' + '\n')
TypeError: unicode argument expected, got 'str'
```

Signed-off-by: Ian Abbott <abbotti at mev.co.uk>
---
 scripts/socfpga_import_preloader | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/scripts/socfpga_import_preloader b/scripts/socfpga_import_preloader
index bd54e1b913..a555c9174b 100755
--- a/scripts/socfpga_import_preloader
+++ b/scripts/socfpga_import_preloader
@@ -112,7 +112,10 @@ copy_source() {
 }
 
 generate_spl() {
-	python2.7 ${embeddedsw}/embedded/ip/altera/preloader/scripts/iswgen.py -i ${handoff} -o ${splroot}/
+	USE_SOCEDS_PYTHON=1 SOCEDS_DESTROY_PATH=1 \
+		${embeddedsw}/embedded/embedded_command_shell.sh python \
+		${embeddedsw}/embedded/ip/altera/preloader/scripts/iswgen.py \
+		-i ${handoff} -o ${splroot}/
 }
 
 if [ -z $splroot ] || [ -z $boardroot ] || [ -z $handoff ]; then
-- 
2.39.2




More information about the barebox mailing list