Altera Nios II User Manual

Nios II Flash Programmer
User Guide
101 Innovation Drive San Jose, CA 95134
www.altera.com
UG-NIOSIIFLSHPROG-2.2
Document Version: 2.2 Document Date: March 2014

Contents

Chapter 1. Overview of the Nios II Flash Programmer
Introduction ............................................................................1–1
Prerequisites .........................................................................1–2
Nios II Flash Programmer GUI and Command-Line Utilities ................................1–2
How the Flash Programmer Works ........................................................1–2
Flash Programmer Target Design .......................................................1–3
Chapter 2. Using the Flash Programmer GUI
Introduction ............................................................................2–1
Starting the Flash Programmer GUI ........................................................2–1
Specifying your Flash Programmer Settings ..............................................2–2
Working with Flash Programmer Settings Files ...........................................2–3
Setting the Hardware Connection .......................................................2–4
Checking System ID and System Timestamp ..............................................2–4
Generating Flash Files and Programming Flash Memory ...................................2–5
Chapter 3. Using the Flash Programmer from the Command Line
nios2-flash-programmer ..................................................................3–2
nios2-flash-programmer Command-Line Examples ........................................3–4
sof2flash ...............................................................................3–5
sof2flash Command-Line Examples .....................................................3–6
elf2flash ................................................................................3–6
Programming Both Hardware and Software into an EPCS/EPCQ Device .....................3–7
elf2flash Command-Line Examples ......................................................3–8
bin2flash ...............................................................................3–8
bin2flash Command-Line Example ......................................................3–9
Appendix A. Non-Standard Flash Memories
Built-in Recognition and Override ........................................................ A–1
Flash Override Files .................................................................... A–1
Flash Override File Format ............................................................ A–1
How to Use the Flash Override File ..................................................... A–2
Width Mode Override Parameter ......................................................... A–2
Appendix B. Supported Flash Memory Devices
Appendix C. Stand-Alone Mode
Installing the Nios II Stand-Alone Flash Programmer ....................................... C–1
Running the Nios II Stand-Alone Flash Programmer ........................................ C–1
Appendix D. Troubleshooting
Overview ............................................................................. D–1
Start Button Grayed Out in the Flash Programmer GUI ...................................... D–1
Probable Cause ...................................................................... D–1
Suggested Actions ................................................................... D–1
"No Nios II processors available" Error .................................................... D–1
Probable Cause ...................................................................... D–1
Suggested Actions ................................................................... D–1
© March 2014 Altera Corporation Nios II Flash Programmer User Guide
iv Contents
"No CFI table found" Error .............................................................. D–2
Probable Cause ...................................................................... D–2
Suggested Actions ................................................................... D–2
"No EPCS registers found" Error ......................................................... D–2
Probable Cause ...................................................................... D–2
Suggested Actions ................................................................... D–2
"System does not have any flash memory" Error ............................................ D–3
Probable Cause ...................................................................... D–3
Suggested Actions ................................................................... D–3
"Reading System ID at address 0x<address>: FAIL" Error .................................... D–3
Probable Cause ...................................................................... D–3
Suggested Actions ................................................................... D–3
"Base address not aligned on size of device" Error .......................................... D–3
Probable Cause ...................................................................... D–4
Suggested Actions ................................................................... D–4
Additional Information
Revision History ..................................................................... Info–1
How to Contact Altera ................................................................ Info–2
Typographic Conventions ............................................................. Info–2
Nios II Flash Programmer User Guide © March 2014 Altera Corporation

Introduction

1. Overview of the Nios II Flash Programmer

Many hardware designs that include the Nios®II processor also incorporate flash memory on the board to store FPGA configuration data or Nios II program data. The Nios II Flash Programmer is part of the Nios II Embedded Design Suite (EDS). Its purpose is to program data into a flash memory device connected to an Altera®FPGA. The Nios II Flash Programmer sends file contents over an Altera download cable, such as the USB Blaster®, to a Nios II system running on the FPGA, and instructs the Nios II system to write the data to flash memory.
The Nios II Flash Programmer can program three types of content to flash memory:
Nios II software executable files—Many systems use flash memory to store
nonvolatile program code, or firmware. Nios II systems can boot from flash memory.
FPGA configuration data—At system power-up, the FPGA configuration
controller on the board can read FPGA configuration data from the flash memory. Depending on the design of the configuration controller, it might be able to choose between multiple FPGA configuration files stored in flash memory.
Other arbitrary data files—The Nios II Flash Programmer can program a binary
file to an arbitrary offset in a flash memory for any purpose. For example, a Nios II program might use this data as a coefficient table or a sine lookup table.
You can use the Nios II Flash Programmer to program the following types of memory:
Common flash interface (CFI)-compliant flash memory – CFI is an industry
standard that provides a common, vendor-independent interface to flash memory devices.
Altera erasable programmable configurable serial (EPCS) or quad-serial
configuration (EPCQ) device - Altera EPCS serial configuration devices store FPGA configuration data and Nios II executable software.
f For more information about the CFI specification, refer to the JEDEC Common Flash
Interface standard JESD68.01 and JEDEC publications JEP137x, available on the JEDEC Solid State Technology Association standards organization website (www.jedec.org). For more information about EPCS devices, refer to the Serial
Configuration Devices (EPCS1, EPCS4, EPCS16, EPCS64, and EPCS128) Data Sheet
chapter in volume 2 of the Altera Configuration Handbook, the Quad-Serial Configuration
(EPCQ) Devices Datasheet, and the EPCS Device Controller Core chapter in Volume 5:
Embedded Peripherals of the Quartus II Handbook.
In this document, the term flash memory refers to both CFI and EPCS memory devices, unless otherwise noted.
© March 2014 Altera Corporation Nios II Flash Programmer User Guide
1–2 Chapter 1: Overview of the Nios II Flash Programmer

How the Flash Programmer Works

Prerequisites

This user guide assumes that you are familiar with the Nios II hardware and software development flow. You need to be familiar with the contents of the following documents:
Nios II Hardware Development Tutorial
Getting Started with the Graphical User Interface chapter of the Nios II Software
Developer’s Handbook
If you use the Nios II Flash Programmer to program FPGA configuration data to flash memory, you also must understand the configuration method used on the board.
f Refer to AN346: Using the Nios II Configuration Controller Reference Designs, or to the
reference manual for your specific Altera development board.

Nios II Flash Programmer GUI and Command-Line Utilities

You can run the Nios II Flash Programmer from a GUI or from the command line. The GUI displays the command-line equivalents of the actions you direct it to perform. For information about the flash programmer GUI, refer to Chapter 2, Using the Flash
Programmer GUI, and for information about using the flash programmer
command-line utilities, refer to Chapter 3, Using the Flash Programmer from the
Command Line.
The following tools allow you to run the Nios II Flash Programmer:
Nios II Software Build Tools for Eclipse™ – The Nios II Software Build Tools (SBT)
for Eclipse provides easy access to the Nios II Flash Programmer GUI. The flash programmer GUI is an easy-to-use interface that allows you to control the flash programmer features using settings you can store and reuse. This access method is suitable for most flash programming needs.
Nios II Command Shell – The Nios II Command Shell provides commands that
control the flash programmer features. You might have to calculate some parameters manually. You can also start the Nios II Flash Programmer GUI from the command line.
How the Flash Programmer Works
The Nios II Flash Programmer has two parts, the host and the target, as shown in
Figure 1–1. The host portion runs on your computer. It sends flash programming files
and programming instructions over a download cable to the target. The target portion is a hardware design, running in the FPGA. It accepts the programming data—flash content and required information about the target flash memory device—sent by the host, and follows the instructions to write data to the flash memory device.
Nios II Flash Programmer User Guide © March 2014 Altera Corporation
Chapter 1: Overview of the Nios II Flash Programmer 1–3
How the Flash Programmer Works
Figure 1–1. How the Nios II Flash Programmer Works
Host Computer
Flash
Content
Download Cable (e.g. USB Blaster)
Target Board
Altera FPGA
Target Design

Flash Programmer Target Design

To use the Nios II Flash Programmer, you must have a valid flash programmer target design downloaded to your board. A valid target design contains a Qsys system with at least the Qsys components shown in Table 1–1.
The minimum component set provides facilities for the target design to communicate with the host and to write to flash memory. The minimum component set depends on the type of flash memory you intend to program. Table 1–1 lists the minimum component set for programming each kind of flash memory.
Table 1–1. Minimum Component Set for the Flash Programmer Target Design
Flash Memory to Program
Flash
Content
Flash Memory Device
Component
Nios II processor, with JTAG debug module
CFI Only EPCS Only CFI and EPCS
Required Required Required
level 1 or greater
System ID peripheral Recommended (1) Recommended (1) Recommended (1)
Flash Memory (Common Flash Interface) Required (2) Required (2)
Tristate Conduit Bridge Required (3) Required (3)
EPCS Serial Flash Controller Required (3) Required (3)
Notes to Table 1–1:
(1) If present, a System ID Peripheral component allows the Nios II Flash Programmer to validate the target design before programming the flash
memory.
(2) A Nios II system can interface with more than one CFI flash memory device. The system must contain one Flash Memory (Common Flash
Interface) component for each flash memory device on the board.
(3) Tri-state Conduit Bridge is needed to drive the CFI flash memory signals.
Figure 1–2 shows an example of a Qsys system containing the minimum component
set for a system with one CFI flash memory and an EPCS serial configuration device. The system also includes other components which relate to the purpose of the system, not to the flash programmer.
© March 2014 Altera Corporation Nios II Flash Programmer User Guide
1–4 Chapter 1: Overview of the Nios II Flash Programmer
How the Flash Programmer Works
Figure 1–2. Example Target Design Containing the Minimum Component Set
1 Hardware example designs capable of programming the flash memory are provided
with Altera development boards. If you are developing for a custom board, consider using one of these example designs as a starting point for your flash programmer target design.
Nios II Flash Programmer User Guide © March 2014 Altera Corporation

Introduction

2. Using the Flash Programmer GUI

The Nios II Flash Programmer GUI is an easy-to-use graphical interface that automates the process of programming flash memory and enables you to control the programming parameters easily. The Nios II Flash Programmer GUI lets you program any combination of software, hardware, and binary data in flash memory in one operation. The flash programmer GUI can also generate flash files for your future use, and store them without programming the flash memory. Generating flash files or programming flash memory from the flash programmer GUI generates a script for future use from the command line.
You start the Nios II Flash Programmer GUI from the Nios II SBT for Eclipse or from the command line.
Alternatively, you can use the flash programmer from the command line. Chapter 3,
Using the Flash Programmer from the Command Line describes the flash
programmer command-line utilities.
1 Altera recommends that you use the Nios II Flash Programmer GUI to generate
automated scripts, and use the scripts to automate the Nios II flash programming process.

Starting the Flash Programmer GUI

To start the Nios II Flash Programmer GUI from the Nios II Command Shell, type the following command:
nios2-flash-programmer-gui r
To start the Nios II Flash Programmer GUI from the Nios II SBT for Eclipse, on the Nios II menu, click Flash Programmer.
The Flash Programmer dialog box appears, as shown in Figure 2–1.
© March 2014 Altera Corporation Nios II Flash Programmer User Guide
2–2 Chapter 2: Using the Flash Programmer GUI
Starting the Flash Programmer GUI
Figure 2–1. Flash Programmer Dialog Box

Specifying your Flash Programmer Settings

Before writing data to flash memory, you must determine the flash programmer settings.
To create a new set of flash programmer settings, complete the following steps:
1. On the File menu, click New. The New Flash Programmer Settings File dialog box appears.
2. Select Get flash programmer system details from BSP Settings File or Get flash programmer system details from SOPC Information File.
3. Browse to locate your BSP Settings File (.bsp) or SOPC Information File (.sopcinfo).
4. For a multiprocessor system, select the processor. If you specify a .bsp file, the processor is already specified.
5. Click OK. The New Flash Programmer Settings File dialog box closes and the Nios II Flash Programmer GUI populates with your processor selection, if relevant, and the information from the .bsp or .sopcinfo file.
Nios II Flash Programmer User Guide © March 2014 Altera Corporation
Chapter 2: Using the Flash Programmer GUI 2–3
Starting the Flash Programmer GUI
Depending on your selection in step 2, your flash programmer settings may not include information about a BSP settings file. A new set of flash programmer settings based on a BSP settings file includes the .sopcinfo file name, but a new set of flash programmer settings based on a .sopcinfo file does not have information about a BSP settings file to which it corresponds. In that case you must identify the .bsp file explicitly. The .bsp file contains the information about your processor selection, for example, whereas the .sopcinfo file knows about the available processors, but not which one you selected.
Figure 2–2 shows the flash programmer with a new set of flash programmer settings
based on the .sopcinfo file for a design with multiple processors and two flash memory components.
Figure 2–2. Flash Programmer Dialog Box with Flash Programmer Settings

Working with Flash Programmer Settings Files

The Nios II Flash Programmer GUI is a powerful tool with many options. Altera recommends saving your flash programmer settings in a Nios II Flash Programmer Settings File (.flash-settings) for future use.
The .flash-settings file includes the settings described in the following sections, such as the script and flash files directory paths, whether to perform system ID and system timestamp checking, and whether to generate flash files or program flash memory.
© March 2014 Altera Corporation Nios II Flash Programmer User Guide
2–4 Chapter 2: Using the Flash Programmer GUI
Starting the Flash Programmer GUI
To save your current flash programmer settings, on the File menu, click Save or Save As to update or create a .flash-settings file. After you save the file, you can continue
to edit it in the Nios II Flash Programmer GUI.
To open a pre-existing flash programmer settings file, on the File menu, click Open, and navigate to the location of the existing .flash-settings file.

Setting the Hardware Connection

This section describes how to select the correct download cable, device, and processor to program flash memory. If your system has only a single download cable and a single processor, the process is simple. This section describes all the steps for a system with multiple download cables, processors, and devices.
Before you can program flash memory on your board, you must configure your FPGA with a flash programmer target design that contains at least the minimum component set specified in Table 1–1 on page 1–3.
f For instructions to configure the FPGA, refer to the Quartus II Programmer chapter in
volume 3 of the Quartus II Handbook.
After you load the target design on your FPGA, you can set the hardware connection for programming flash memory.
To set the Hardware connection, perform the following steps:
1. Click Hardware Connections. The Hardware Connections dialog box appears.
2. In the Hardware Connections dialog box, click Refresh Connections.
3. If you are reusing an .flash-settings file, and the Quartus recompiled since the .flash-settings file was created or the Name column entries in the Processors list are blank, perform the following steps:
a. Under JTAG Debugging Information File name, browse to locate your project
JTAG Debugging Information File (.jdi).
b. Click Resolve Names. The flash programmer uses the .jdi file to ensure the
available connection information is accurate.
4. If your design has multiple download cables, select the appropriate cable.
5. If your design has multiple processors, select the Nios II processor that corresponds to the CPU to program flash value under Target hardware information in the Nios II Flash Programmer dialog box.
6. Click Close.

Checking System ID and System Timestamp

®
II project has been
If your flash programmer target design includes a System ID component, the Nios II Flash Programmer can perform system ID and system timestamp checking before programming flash memory. If the flash programmer performs system ID checking, system timestamp checking, or both, and the expected system is not configured in the FPGA, the flash programmer does not program the flash memory.
Nios II Flash Programmer User Guide © March 2014 Altera Corporation
Loading...
+ 25 hidden pages