Nios II Flash Programmer User Guide 101 Innovation Drive San Jose, CA 95134 www.altera.com UG-NIOSIIFLSHPROG-2.2 Document Version: Document Date: 2.
Copyright © 2010 Altera Corporation. All rights reserved. Altera, The Programmable Solutions Company, the stylized Altera logo, specific device designations, and all other words and logos that are identified as trademarks and/or service marks are, unless noted otherwise, the trademarks and service marks of Altera Corporation in the U.S. and other countries. All other product or service names are the property of their respective holders. Altera products are protected under numerous U.S.
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 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
iv Contents "No CFI table found" Error . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Probable Cause . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Suggested Actions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . "No EPCS registers found" Error . . . .
1. Overview of the Nios II Flash Programmer Introduction 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.
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.
Chapter 1: Overview of the Nios II Flash Programmer How the Flash Programmer Works 1–3 Figure 1–1. How the Nios II Flash Programmer Works Host Computer Flash Content Target Board Altera FPGA Flash Content Download Cable (e.g. USB Blaster) Flash Memory Device 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.
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.
2. Using the Flash Programmer GUI Introduction 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.
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.
Chapter 2: Using the Flash Programmer GUI Starting the Flash Programmer GUI 2–3 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.
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.
Chapter 2: Using the Flash Programmer GUI Starting the Flash Programmer GUI 1 2–5 Altera recommends that your FPGA target design include a System ID component, and that you enable both system ID and system timestamp checking. By default, both system ID and system timestamp checking are enabled. To disable checking for system ID or system timestamp, perform the following steps: 1. Click Hardware Connections. The Hardware Connections dialog box appears. 2.
2–6 Chapter 2: Using the Flash Programmer GUI Starting the Flash Programmer GUI To generate flash files or to write to flash memory using your flash programmer settings, perform the following steps: 1. On the Options menu, turn on the actions you wish to perform. The following actions are available: ■ Generate Files—Generates flash files. ■ Program Files—Programs flash memory with the generated flash files.
3. Using the Flash Programmer from the Command Line The Nios II development tools provide command-line utilities which give you complete control of the Nios II Flash Programmer features. You can create a custom script file to automate a flash programming task. Alternatively, you can use the flash programmer GUI. Chapter 2, Using the Flash Programmer GUI describes the flash programmer GUI. 1 The Nios II Flash Programmer GUI programs flash memory by creating a script based on the command-line utilities.
3–2 Chapter 3: Using the Flash Programmer from the Command Line nios2-flash-programmer nios2-flash-programmer The nios2-flash-programmer utility programs a preformatted file into a specified flash memory. The input is an industry-standard S-record file, normally created by one of the conversion utilities, sof2flash, elf2flash, or bin2flash.
Chapter 3: Using the Flash Programmer from the Command Line nios2-flash-programmer 3–3 Table 3–2. nios2-flash-programmer Parameters (Part 2 of 3) Name Required Description --id= Optional; required for system ID validation. Contains the ID value programmed into the System ID component in your system. This value is randomly selected each time you regenerate your Qsys system.
3–4 Chapter 3: Using the Flash Programmer from the Command Line nios2-flash-programmer Table 3–2. nios2-flash-programmer Parameters (Part 3 of 3) Name --base=
Required Required Description Specifies the base address of the CFI flash memory. This parameter is the absolute address in the target design's address space. nios2-flash-programmer treats addresses in the S-record files as offsets to the base address.Chapter 3: Using the Flash Programmer from the Command Line sof2flash 3–5 Queries CFI flash memory based at address 0x200000 and reports the result. This command dumps the flash memory's query table. sof2flash The sof2flash utility takes an SRAM Object File and translates it to an S-record file, suitable for programming into flash memory. Table 3–3 lists the typical parameters used with sof2flash. Table 3–3.
3–6 Chapter 3: Using the Flash Programmer from the Command Line elf2flash sof2flash Command-Line Examples sof2flash --offset=0x0 --input=standard.sof \ --output=standard_cfi.flash Converts standard.sof to an S-record file named standard_cfi.flash intended for a CFI flash memory. The S-record offset begins at 0x0. sof2flash --epcs --input=standard.sof --output=standard_epcs.flash Converts standard.sof to an S-record file named standard_epcs.flash intended for an EPCS device.
Chapter 3: Using the Flash Programmer from the Command Line elf2flash 3–7 Table 3–4. elf2flash Parameters (Part 2 of 2) Name Required Description CFI Parameters --base= Required. The base address of the flash memory component. elf2flash uses this parameter with --end and --reset to determine whether the system requires a boot copier. --end= Required. The end address of the flash memory component.
3–8 Chapter 3: Using the Flash Programmer from the Command Line bin2flash Convert the FPGA configuration file first using sof2flash. When converting the Nios II software executable, use the --after parameter, and specify the FPGA configuration S-record file. The S-record output for the software executable starts at the first address unused by the FPGA configuration. Refer to the second example under “elf2flash Command-Line Examples”.
Chapter 3: Using the Flash Programmer from the Command Line bin2flash 3–9 Table 3–5. bin2flash Parameters (Part 2 of 2) Name Required? Default Description --input= Required — Name of the input binary file being converted --output= Required — Name of the output file f For additional parameters, type elf2flash --help at a command line. bin2flash Command-Line Example bin2flash --location=0x40000 --input=data.bin --output=data.flash Converts data.bin to an S-record file named data.
3–10 Nios II Flash Programmer User Guide Chapter 3: Using the Flash Programmer from the Command Line bin2flash © March 2014 Altera Corporation
A. Non-Standard Flash Memories This section covers advanced topics to support non-standard CFI flash memory. To use the procedures in this section, you need the data sheet for the flash memory device you are using. Make sure you fully understand the CFI aspects of the device. Some CFI flash memory devices contain missing or incorrect CFI table information. In such cases, the Nios II Flash Programmer might fail based on the erroneous information in the CFI table.
A–2 Appendix A: Non-Standard Flash Memories Width Mode Override Parameter For example, the SST 39VF800 flash memory contains three incorrect entries in its CFI table at location 0x13, 0x14, and 0x2C. The following example demonstrates how to override the values at those addresses.
B. Supported Flash Memory Devices The Nios II Flash Programmer works with all CFI-compatible parallel flash memories that support programming algorithm 1, 2, or 3, and with all Altera EPCS/EPCQ serial configuration devices. Not all flash memory devices have been tested with the Nios II Flash Programmer. 1 If you find a CFI-compliant device that does not work with the Nios II Flash Programmer, please report it to Altera Technical Support.
B–2 Nios II Flash Programmer User Guide Appendix B: Supported Flash Memory Devices © March 2014 Altera Corporation
C. Stand-Alone Mode While developing hardware or software, you use the Nios II Flash Programmer on a computer with the Quartus II software and the Nios II EDS installed. However, in a production or service environment you might want to set up a computer to program flash memory without installing the full set of Altera development tools. A stand-alone version of the Nios II Flash Programmer is available for this purpose. In stand-alone mode, the flash programmer has limited functionality.
C–2 Nios II Flash Programmer User Guide Appendix C: Stand-Alone Mode Running the Nios II Stand-Alone Flash Programmer © March 2014 Altera Corporation
D. Troubleshooting Overview This chapter lists troubleshooting tips for the Nios II Flash Programmer. Each section in this chapter describes a common issue you might run into when using the Nios II Flash Programmer. Start Button Grayed Out in the Flash Programmer GUI In the Nios II Flash Programmer GUI, even after a flash programmer configuration is opened, the Start button appears grayed out. Probable Cause You have not fully specified the required parameters for programming flash memory.
D–2 Appendix D: Troubleshooting "No CFI table found" Error "No CFI table found" Error When you run the flash programmer to program CFI flash memory, you get the error: "No CFI table found at address " Probable Cause The flash programmer can connect with a Nios II JTAG debug module in the FPGA, but it can not successfully execute a query to a flash memory at the base address specified.
Appendix D: Troubleshooting "System does not have any flash memory" Error ■ D–3 Ensure that the EPCS device is correctly connected to the FPGA on the board. Verify the EPCS connection by running the "Test EPCS" routine in the "Memory Test" software template provided by the Nios II EDS. If the test fails, there is a problem with your memory connection.
D–4 Appendix D: Troubleshooting "Base address not aligned on size of device" Error Probable Cause The flash device base address being passed to the Flash Programmer is not a multiple of the flash device's size. Suggested Actions ■ Ensure that the flash device is mapped to a base address in Qsys that is a multiple of the flash size listed in its CFI table.
Additional Information Revision History The following table shows the revision history for this user guide. Date March 2014 Version 2.2 Changes Made ■ In chapter 1, added cross-reference to the Quad-Serial Configuration (EPCQ) Devices Datasheet ■ In chapter 1, updated Table 1–1 and updated the table notes. ■ In chapter 1, updated Figure 1–2. ■ In chapter 3, updated Table 3–3. ■ In chapter 3, added the EPCQ command line example. ■ In chapter 3, updated Table 3–4.
Info–2 Additional Information How to Contact Altera How to Contact Altera For the most up-to-date information about Altera® products, see the following table. Contact (Note 1) Contact Method Address Technical support Website www.altera.com/support Technical training Website www.altera.com/training Email custrain@altera.com Website www.altera.com/literature Non-technical support (General) Email nacomp@altera.com (Software Licensing) Email authorization@altera.
Additional Information Typographic Conventions Visual Cue Info–3 Meaning c A caution calls attention to a condition or possible situation that can damage or destroy the product or the user’s work. w A warning calls attention to a condition or possible situation that can cause injury to the user. r The angled arrow indicates you should press the Enter key. f The feet direct you to more information about a particular topic.