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

Programming Flash using System Console

Programming Flash using System Console



This example shows programming flash on the 3C120 development board using System Console.  It is about x10 slower than nios2-flash-programmer, but can be easily modified for special flash configurations. It is currently written to work with 16-bit flash with AMD commands.

The example contains the following:

erase_flash.tcl : Erase the entire flash device. User will need to read flash, flash erase will be complete when a read from flash produces 0xFFFF

download_flash.tcl : This will program flash with an srec/flash file. The base address and srec file are hardcoded in the tcl file.  The tcl file does not verify the contents being written to the flash, instead we delay the next write to ensure the previous writes completes. When done the bytestream receive buffer is still being written too, so you should clear it by repeating "bytestream_receive $jtag_master 2048" until buffer no longer returns data.

sys_console_flash.zip : Quartus/SOPC Builder project with JTAG to Alavon Master Bridge connected to Flash and LED's. Targeted for the 3c120 development board. Contains pre-compiled .sof for programming device.

To run the example,

1. Program 3c120 development board with sys_console_flash_3c120.sof

2. Start nios2 command shell. 

3. Start system console in command line mode

[NiosII EDS]$ system-console -cli

4. Erase flash by sourcing erase_flash.tcl

% source erase_flash.tcl

5. Read back flash address 0x0, until returns 0xffff (this can take a couple of minutes)

% master_read_16 $jtag_master 0x0 1

6. Program flash by sourcing download_flash.tcl

% source download_flash.tcl

7. When complete, clear bytestream receive buffer (may need to do this multiple times)

% bytestream_receive $jtag_master 2048


Download

§ download_flash.tcl

§ erase_flash.tcl

§ sys_console_flash.zip

Version history
Revision #:
1 of 1
Last update:
‎06-27-2019 12:36 AM
Updated by:
 
Contributors