Intel® Quartus® Prime Software
Intel® Quartus® Prime Design Software, Design Entry, Synthesis, Simulation, Verification, Timing Analysis, System Design (Platform Designer, formerly Qsys)
16558 Discussions

Running a console executable from a tcl script

Altera_Forum
Honored Contributor II
2,534 Views

Hi there 

 

I am attempting to call a console executable file from a tcl script that should run before every compile. Here are a few iterations that I have tried, but nothing seems to make the tcl script run the executable: 

 

exec ConsoleApp.exe 

qexec ConsoleApp.exe 

 

exec BatchToRunConsoleApp.bat 

qexec BatchToRunConsoleApp.bat 

 

I am pretty desperate. I made the mistake of assuming that it would not be difficult to run an application from a tcl script and now I cannot seem to do it. Please help. 

 

Regards, 

Stu84
0 Kudos
5 Replies
Altera_Forum
Honored Contributor II
1,219 Views

Hi, 

this works here: 

qexec ipconfig qexec quartus  

 

also: 

set cmd "qmegawiz -silent OPTIONAL_FILES=NONE ${file_name}" post_message "cmd: ${cmd}" if { } { post_message -type error "couldn't run $cmd" } else { post_message -type info }
0 Kudos
Altera_Forum
Honored Contributor II
1,219 Views

https://www.altera.com/content/dam/altera-www/global/en_us/pdfs/literature/manual/tclscriptrefmnl.pdf 

 

"qexec" is the command you should be using, and it works fine. You will need to supply more information about what doesn't work. 

Do you need to specify the path to the executable, or make sure your PATH includes a .dll it depends on?
0 Kudos
Altera_Forum
Honored Contributor II
1,219 Views

 

--- Quote Start ---  

Hi, 

this works here: 

qexec ipconfig qexec quartus  

 

also: 

set cmd "qmegawiz -silent OPTIONAL_FILES=NONE ${file_name}" post_message "cmd: ${cmd}" if { } { post_message -type error "couldn't run $cmd" } else { post_message -type info }  

--- Quote End ---  

 

 

Hi there DUESTERBERG 

 

I tried your code snippets, and much like mine, they appear to do absolutely nothing. It says in themessage window that the tcl script executed successfully, but no windows consoles execute or appear. Is it poosible that there is something else that I am missing? Thank you for your help.
0 Kudos
Altera_Forum
Honored Contributor II
1,219 Views

You'll get the results you describe if your executable doesn't produce any output to STDOUT. 

 

Your script snippet works fine here. 

 

Changing your cmd variable to instead use Windows cmd.exe to run the "set" command, you get your environment dumped into Quartus messages. 

set cmd "cmd /c set" post_message "cmd: ${cmd}" if { } { post_message -type error "couldn't run $cmd" } else { post_message -type info "Command \"$cmd\" successful." post_message -type info }  

 

If something basic as this doesn't work for you, not sure what next? Reinstall? 

If this works, then there's a problem with your .exe, or there is a problem executing your .exe from a script like this.
0 Kudos
Altera_Forum
Honored Contributor II
1,219 Views

 

--- Quote Start ---  

You'll get the results you describe if your executable doesn't produce any output to STDOUT. 

 

Your script snippet works fine here. 

 

Changing your cmd variable to instead use Windows cmd.exe to run the "set" command, you get your environment dumped into Quartus messages. 

set cmd "cmd /c set" post_message "cmd: ${cmd}" if { } { post_message -type error "couldn't run $cmd" } else { post_message -type info "Command \"$cmd\" successful." post_message -type info }  

 

If something basic as this doesn't work for you, not sure what next? Reinstall? 

If this works, then there's a problem with your .exe, or there is a problem executing your .exe from a script like this. 

--- Quote End ---  

 

 

Thanks ted. 

 

I appreciate all the help everyone. After playing around some more, I found my problem: 

 

The tcl file runs in the project root directory and therefore saves the files there. When I run my app independently, the files are saved in the same directory as the app, hence the reason for my confusion. The code that uses "open" as described above does work, I still seem to be having some issues with qexec and exec, but this does not hinder my progress. Thanks again.
0 Kudos
Reply