Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
8 years ago

qsys-script: no output on stdout when called from TCL script

Since the TCL interpreter in qsys-script is very limited and outdated I want to reduced the amount of work done via qsys-script to the absolute minimum. However when I call qsys-script from another TCL script I get no output, presumably because of some Java magic in the background. My snipped is as follows:


set qsys_path 
set qsys_system toplevel.qsys
set qsys_script qsys-test.tcl
if { == 0} {
    puts $result
} else { 
    post_message -type error "Error executing qsys-script: $result"
}

while the following works as expected:


if { == 0} {
    puts $result
} else { 
    post_message -type error "Error executing ls: $result"
}

Any ideas how to overcome this other than the output to an intermediate file?

4 Replies

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    The output of teh qsys-script call goes into STDERR.

    Try to append "2>&1" after your command. This combines STDOUT and STDERR to STDOUT.

    If you are just interested in your own output from your script and not from qsys-script try to append just: "2>err" or "2>/dev/null".

    I tested both successfully.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    I'm sorry but this does not seem to work in my environment (Windows 7). My command line is

    
    exec $qsys_path --script=qsys-test.tcl 2>&1
    
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Hi Arne,

    i attached the Files from my test. I run them also on Win7, but within a soc cygwin shell (In this all pathes are set correctly).

    
      quartus_sh -t test.tcl
    

    Hope this helps ...

    Dirk
  • Remi's avatar
    Remi
    Icon for New Contributor rankNew Contributor

    I realize I'm necroing a fairly old thread but it's the closest thing I've found to a non-solution to a similar problem and I'm hoping that there might be an answer here. I've got a couple of python programs that I want to run pre and post building. The pre and post processor runs on TCL so I created a couple TCL scripts to run the python programs. I would like the output of the programs to be put into the output transcript but adding "2>&1" does not seem to do the trick. Here's my TCL invocation for one of them:

    # Runs the Python update_build_time.py script to update the
    # system build package.
    proc call_python {} {
    	set output [exec python ../bin/update_build_time.py -o ../src/system_build_info_pkg.vhd 2>&1]
    	puts $output
    }
    post_message "Executing run_update_build_time.tcl script..."
    post_message "=================================================================="
    post_message "Running system build update Python program"
    call_python
    post_message "=================================================================="

    The output in Quartus while running is only the post_message text:

    Info: Executing run_update_build_time.tcl script...
    Info: ==================================================================
    Info: Running system build update Python program
    Info: ==================================================================
    Info (23030): Evaluation of Tcl script ../bin/run_update_build_time.tcl was successful
    Info: Quartus Prime Shell was successful. 0 errors, 0 warnings

    Any ideas on how I might be able to get the output to display?