Search code examples
linuxtclxilinxxsdk

XSCT executes command in interactive shell but not within script


First, take note that I am using the Xilinx SDK 2018.2 on Kubuntu 22.04 because of my companies policy. I know from research, that the command I'm using is deprecated in newer versions, but in the version I am using, it works flawlessly - kind of... But read for yourself:

My task is to automate all steps in the FPGA build to create a pipeline which automatically builds and tests the FPGAs. To achieve this, I need to build the code - this works flawlessly in XSDK. For automation, this also has to work in the command line, so what I did is following the manual to find out how this is achieved. Everything works as expected if I write it in the interactive prompt like shown here:

user@ubuntuvm:~$ xsct
****** Xilinx Software Commandline Tool (XSCT) v2018.2
  **** Build date : Jun 14 2018-20:18:43
    ** Copyright 1986-2018 Xilinx, Inc. All Rights Reserved.


xsct% 

Then I can enter the commands I need to import all needed files and projects (hw, bsp, main project). With this toolset, everything works as expected.

Because I want to automate it via a pipeline, I decided to pack this into a script for easier access. The script contains exactly the commands I entered in the interactive shell and therefore looks like this:

user@ubuntuvm:~/gitrepos/repository$ cat ../autoBuildScript.tcl
setws /home/user/gitrepos/repository
openhw ./hps_packages/system.hdf
openbsp ./bsp_packages/system.mss
importprojects ./sources/mainApp
importprojects ./bsp_packages
importprojects ./hps_packages
regenbsp -bsp ./bsp_packages/system.mss
projects –clean
projects -build

The commands are identical to the ones entered via the interactive CLI tool, the only difference is that this is now packed into a script. The difference is, that this now does not build completely anymore. I get the following error:

user@ubuntuvm:~/gitrepos/repository$ xsct ../autoBuildScript.tcl
INFO: [Hsi 55-1698] elapsed time for repository loading 1 seconds                                    
Starting xsdk. This could take few seconds... done                                                   
'mainApp' will not be imported... [ALREADY EXIST]                                                
'bsp_packages' will not be imported... [ALREADY EXIST]
'hps_packages' will not be imported... [ALREADY EXIST]
/opt/Xilinx/SDK/2018.2/gnu/microblaze/lin                                                            
unexpected arguments: –clean                                                                         
    while executing
"error "unexpected arguments: $arglist""
    (procedure "::xsdb::get_options" line 69)
    invoked from within
"::xsdb::get_options args $options"
    (procedure "projects" line 12)
    invoked from within
"projects –clean"
    (file "../autoBuildScript.tcl" line 8)

I've inserted projects -clean only, because I got the error before with projects -build and wanted to check, if this also happens with another argument.

In the internet I didn't really find anything according to my specific problem. Also I strictly held on to the official manual, in which the command is also used just as I use it - but with the result of it being working.

Also, I've checked the line endings (set to UNIX) because I suspected xsct to read maybe a newline character or something similar, with no result. This error also occurs, when I create the bsp and hardware from sketch. Also, to me the error looks like an internal one from Xilinx, but let me know what you think.


Solution

  • So, it appears that I just fixed the problem on my own. Thanks on everyone reading for being my rubber ducky.

    Apparently, the version 2018.2 of XSDK has a few bugs, including inconsistency with their command interpretation. For some reason the command works in the interactive shell, but not in the script - because the command is in its short form. I just learned from a Xilinx tutorial, that projects -build is - even though it works - apparently not the full command. You usually need to clarify, that this command should come from the SDK like this: sdk projects -build. The interactive shell seems to ignore this fact for a reason - and so does the script for any command except projects. Therefore, I added the "sdk" prefix to all commands which I used from the SDK, just to be safe.

    I cannot believe, that I just debugged 2 days for an error whose fix only contains 3 (+1 whitespace) letters.

    Thanks everybody for reading and have a nice day