mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] scripts: socfpga_import_preloader: Use SDK-supplied Python
@ 2023-06-15 12:30 Ian Abbott
  2023-06-21  8:31 ` Sascha Hauer
  0 siblings, 1 reply; 2+ messages in thread
From: Ian Abbott @ 2023-06-15 12:30 UTC (permalink / raw)
  To: barebox; +Cc: Ian Abbott

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@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




^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] scripts: socfpga_import_preloader: Use SDK-supplied Python
  2023-06-15 12:30 [PATCH] scripts: socfpga_import_preloader: Use SDK-supplied Python Ian Abbott
@ 2023-06-21  8:31 ` Sascha Hauer
  0 siblings, 0 replies; 2+ messages in thread
From: Sascha Hauer @ 2023-06-21  8:31 UTC (permalink / raw)
  To: Ian Abbott; +Cc: barebox

On Thu, Jun 15, 2023 at 01:30:20PM +0100, Ian Abbott wrote:
> 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@mev.co.uk>
> ---
>  scripts/socfpga_import_preloader | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)

Applied, thanks

Sascha

> 
> 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
> 
> 
> 

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-06-21  8:32 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-15 12:30 [PATCH] scripts: socfpga_import_preloader: Use SDK-supplied Python Ian Abbott
2023-06-21  8:31 ` Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox