Forum Discussion

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

Return Codes

How to use return codes when programming the device by using the following command (included in the tcl-script):

quartus_pgm --mode=as --cable=USB-Blaster --operation=pv\;file_name.pof

Quartus II command-line executables exit with the one of the following return codes.

Return Code Description

0 Execution was successful

2 Execution failed due to an internal error

3 Execution failed due to user error(s)

4 Execution was stopped by the user

So, what kind of script (.tcl) should I write, so that some return code is returned after programming?

1 Reply

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

    Answer swiped from http://www.linuxquestions.org/questions/programming-9/just-wonder-how-to-get-exit-status-of-pragram-in-tcl-code-645406/

    --- Quote Start ---

    quote from activetcl 8.5.2.0 help pages

    Code:

    To execute a program that can return a non-zero result, you should wrap the call to exec in catch and check the contents of the -errorcode return option if you have an error:

    set status 0
    if {} {
       set details 
       if { eq "CHILDSTATUS"} {
          set status 
       } else {
         #  Some kind of unexpected failure
       }
    }
    

    quote from man n exec

    Code:

    To execute a program that can return a non-zero result, you should wrap the call to exec in catch and check |

    what the contents of the global errorCode variable is if you have an error:

    
                  set status 0                                                                                             
                  if {} {                                                           
                     if { eq "CHILDSTATUS"} {                                                       
                        set status                                                                  
                     } else {                                                                                              
                       #  Some kind of unexpected failure                                                                  
                     }                                                                                                     
                  }
    

    --- Quote End ---