Community
cancel
Showing results for 
Search instead for 
Did you mean: 

System Console File IO Example

System Console File IO Example

Description

This wiki page is dedicated towards users that want to use system console to read files and write to files. Many users leverage System console to write manufacturing test programs or other programs that require some sort of stimulus. Rather than manually enter via System console GUI or command line, an input file can be used as stimulus. Similarly, some users may want to dump large amounts of data to a file and do some post-processing work. This article demonstrates file IO using system console. It contains a read file example and a write file example.

The input and output tcl file examples can be downloaded below and adjusted to fit your specific application. To run the demonstration, you will need a BeMicro SDK development kit.

BeMicro SDK

As of 1/25/19, it looks like the Cyclone III based BeMicro SDK is no longer for sale. The project should be easily adaptable via IP conversion to many other development kits or even your custom board.

Example Project

The tcl files included in this article go with the following design:

System Console Demo 16.1.2.tar.gz

This same design and related description can be found here:

BeMicro SDK System Console Demo

Example Tcl Script for file input and associated input txt file

File input example.tcl

Inputtest.txt

Example Tcl Script for file output

File output example.tcl

Steps to run the example input and output tcl files

If you have access to the BeMicro SDK, the following steps will run the input and output tcl file demos. Quartus 16.1.2 was used for the example.

* Download the System_Console_Demo_16.1.2.tar.gz file

*Download the file input and file output example files

*Open a NIOSII command shell

mik_Intel_0-1595863113757.png

6/63/System_Console_IO_NIOSII_Command_Shell.JPG

*Do a tar -xzvf on the file, System_Console_Demo_16.1.2.tar.gz, to expand it

*Plug in the BeMicro SDK board into a USB port on your computer

*cd to the tcl_src directory from the project directory

*run the file start_everything.sh

mik_Intel_1-1595863170264.png

7/70/System_Console_IO_start_everything.JPG

*The BeMicro SDK board should load, a system console window should come up and show that the system is up and running.

mik_Intel_2-1595863254332.png

6/6c/System_Console_IO_good_initialization.JPG

*Go to the OCRAM tab

mik_Intel_3-1595863311797.png

b/b0/System_Console_IO_ocRAM_0s.JPG

*Source the File_input_example.tcl file

mik_Intel_4-1595863355262.png

5/57/System_Console_IO_File_input.JPG

*Source the File_output_example.tcl file

mik_Intel_5-1595863423810.png

a/a3/System_Console_IO_File_output.JPG

*Inspect the output file, testoutput.txt file.

mik_Intel_6-1595863468409.png

1/11/System_Console_IO_File_output_txt.JPG

Attachments
Version history
Revision #:
2 of 2
Last update:
‎07-27-2020 08:25 AM
Updated by: