Showing results for 
Search instead for 
Did you mean: 
Honored Contributor I

automating "master_read_to_file"

Hi guys 


I need to automate the "master_read_to_file" function. Normally, i just open system console and execute the command. Now, id like to automate calling it from a python script. First thought was to try modifying the jtag_server_cmds code here to create a command that will call the master_read_to_file and then try to replicate opening the TCPIP socket in python. 




But i read somewhere that i might be able to just execute a wrapper script containing the master_read_to_file call directly from a command line interface instance of system console. 

So i implemented a subprocess call in python using the following code: 


python_subprocessCallWrapper('C:/altera/15.0/quartus/sopc_builder/bin/system-console.exe -cli -script=C:/test/wrapperScript.tcl')  


where wrapperScript will eventually contain the master_read_to_file (right now, it just creates a text file). 


This works fine. except it takes about 10 seconds to complete because system console takes some time to start up. 

If i could just start system console once and then run the wrapperScript when needed, that would speed things up quite a bit. 


I dont believe that '-script=C:/test/wrapperScript.tcl' will work on its own. that it has to be part of the initial call, so i can issue a 'source C:/test/wrapperScript.tcl' instead. 

The problem is that if i try issuing 'source C:/test/wrapperScript.tcl' to my process.stdin, the command is taken, but no new test file is generated. 


This seems like the simpler approach, but its turning into a science fair project. 


Is there a better way to do this?  

Is system console designed to take in multiple "interactive" lines like this? 

Can i speed up system console? 

Can i somehow run the master_read_to_file straight from nios cmd shell or similar tool? 

Is the TCPIP client server better?  


Any help is appreciated! 


0 Kudos
2 Replies
Honored Contributor I

found exactly what i needed.... 


turns out i needed the disable_readline flag set and all works well with my sub process 


i owe FredrikWG a beer!!!
Honored Contributor I

Thanks for posting your solution, I did not know the answer, and appreciate your pointer to the solution :) 


(I must have missed the conclusion of the other thread)