Forum Discussion
system console master_read_to_file
Hi guys
I am very new to altera, fpgas, qsys and system console, but i have managed to get a basic spi interface working with my DUT. Works very well. The code was done with qsys and nios ii and software on a modified hello world in eclipse. My next task is to transfer the data that the alt_avalon_spi receives from my DUT back to my host pc. One thing that looked promising was using system console with some tcl scripts. i watched a few tutorials on it, but cant quite get it. i think that master_read_to_file might be what i need: % help master_read_to_file Uploads data from memory accessible from the specified master channel to a binary file on disk Arguments: <service-path> <filename> The file to write to <address> Start address in memory <count> Number of bytes to write to file I am able to connect to the master nios but i cant get my command to work... im assuming that system console has access to my pc c: drive... I believe that i should be using my onchip mem address for address and i just wanted to test it with something small (1000 bytes) so im using this command master_read_to_file $mypath 'c:\mydir\file11.bin' 0x00040000 1000 no errors come back but no file gets created either. Can you guys tell me what im doing wrong? and where/what is a valid file path for the file? Ill worry about linking my c code variables to onchip memory later (any pointers on that would be appreciated too) thanks!6 Replies
- Altera_Forum
Honored Contributor
--- Quote Start --- master_read_to_file $mypath 'c:\mydir\file11.bin' 0x00040000 1000 --- Quote End --- I haven't used that function, but I think your problem is likely Windows "\" vs. UNIX "/" and you want to be using double quote " around the entire filename string (like what you would do in C). Try using "/". If that doesn't work, just use "foo.bin" and it ought to show up in the directory from which System Console is currently executing. - Altera_Forum
Honored Contributor
Tcl has a procedure for creating valid file names ... try this
The 'join' part of file join comes from the fact that you can use it to build up longer filenames. There is also a file normalize command, but it doesn't work in all tools, eg., the latest Qsys Java Tcl interpreter chokes on it. Cheers, Daveset filename master_read_to_file $mypath $filename 0x00040000 1000 - Altera_Forum
Honored Contributor
Thanks guys! you were both correct! file showed up. now i just have to link the spi data to the onboard mem
- Altera_Forum
Honored Contributor
Hey jksfiftyfive55, similar question, are you the author of this Stack overflow thread? http://stackoverflow.com/questions/30133357/python-subprocess-popen-stdin-write/34776311#34776311
I'm looking for some help to do the exact same thing. I tired to piece together the code based on the dialog by haven't quite got there. - Altera_Forum
Honored Contributor
yes, that was me. when you say "exact same thing," what are you trying to do? download a file? do it with a python interface?
thanks - Altera_Forum
Honored Contributor
I was just looking to get a pipe between Python and System Console as you were working on. I ended up finding a solution and updated the stack overflow (http://stackoverflow.com/a/34800683) with a new answer as well as this discussion thread: http://www.alteraforum.com/forum/showthread.php?t=51149
I'm tempted to write a even more tidy python class and post it on github.