Nios® V/II Embedded Design Suite (EDS)
Support for Embedded Development Tools, Processors (SoCs and Nios® V/II processor), Embedded Development Suites (EDSs), Boot and Configuration, Operating Systems, C and C++
12603 Discussions

help for flash programming error!

Altera_Forum
Honored Contributor II
1,289 Views

I'm using QuartusII4.2+sp1,NiosII1.1,ByteBlasterII cable, and an EP1C12Q240 on my custom board. 

 

I built a flash programmer design as the "NiosII Flash Programmer user guide" instructs,I use a flash SST39VF040 and an EPCS4, then I build my system with this board. 

 

After every thing is done, I launch the flash programmer and want to program the software to the flash,but there's always an error shows below. 

 

The following is the message from the Flash programmer: 

<div class='quotetop'>QUOTE </div> 

--- Quote Start ---  

#! /bin/sh# # This file was automatically generated by the Nios II IDE Flash Programmer.# # It will be overwritten when the flash programmer options change.#  

 

cd F:/FPGA/NIOSII_DEV/software/hello_led_0/Debug 

# Creating .flash file for the project 

$QUARTUS_ROOTDIR/bin/jre/bin/java.exe -jar $SOPC_KIT_NIOS2/bin/elf2flash.jar --f 

lash=U5 --epcs --base=0x0 --end=0x7fffffff --input=hello_led_0.elf --output=.fla 

sh --boot=$SOPC_KIT_NIOS2/components/altera_nios2/boot_loader_epcs.srec 

WARNING: Default charset GBK not supported, using ISO-8859-1 instead 

# Programming flash with the project 

$QUARTUS_ROOTDIR/bin/jre/bin/java.exe -jar $SOPC_KIT_NIOS2/bin/nios2-flash-progr 

ammer.jar --input=.flash --sof=f:/fpga/NIOSII_DEV/NIOSII_DEV_BOARD/system/NIOSII 

_DEV_BOARD.sof --epcs 

Jun 24, 2005 3:53:02 PM - (??) nios2-flash-programmer: Launching Quartus Program 

mer to download: 

  f:/fpga/NIOSII_DEV/NIOSII_DEV_BOARD/system/NIOSII_DEV_BOARD.sof 

Pre-Reading 1KBytes of data from U5: 

    |----.----+----.----| 

    ********************* (4.217 sec). 

Writing 64KBytes : 

    |----.----+----.----| 

    ********************* (3.836 sec). 

Verifying 64KBytes of data: 

    |----.----+----.----| 

    ********************* (4.015 sec). 

Jun 24, 2005 3:53:29 PM - (??) nios2-flash-programmer: Success. Verified 64Kbyte 

s written to U5. 

Jun 24, 2005 3:53:29 PM - (??) nios2-flash-programmer: Flash programming complet 

WARNING: Default charset GBK not supported, using ISO-8859-1 instead 

# Creating .flash file for the project 

$QUARTUS_ROOTDIR/bin/jre/bin/java.exe -jar $SOPC_KIT_NIOS2/bin/elf2flash.jar --f 

lash=U3 --base=0x00000000 --end=0x80000 --reset=0x0 --input=hello_led_0.elf --ou 

tput=SST39VF040_70_4I_NH.flash --boot=$SOPC_KIT_NIOS2/components/altera_nios2/bo 

ot_loader_cfi.srec 

WARNING: Default charset GBK not supported, using ISO-8859-1 instead 

# Programming flash with the project 

$QUARTUS_ROOTDIR/bin/jre/bin/java.exe -jar $SOPC_KIT_NIOS2/bin/nios2-flash-progr 

ammer.jar --input=SST39VF040_70_4I_NH.flash --sof=__NO_SOF_PLEASE__ --base=0x000 

80000 

Jun 24, 2005 3:53:30 PM - (??) nios2-flash-programmer: SOF-download skipped. 

Jun 24, 2005 3:53:33 PM - (??) nios2-flash-programmer: Error opening target hard 

ware 

Jun 24, 2005 3:53:33 PM - (??) nios2-flash-programmer:    Unable to open flash-d 

evice after successfully communicating  

with target. 

It is likely that you are using a flash-programming FPGA design which 

was not created for your target board. 

 

  In order to program flash, you must first create a purpose-built 

  flash-programming design (i.e. FPGA configuration) and associate it with 

  your particular board.  The Nios development kit is delivered with purpose-bui 

lt 

  flash-programming designs pre-built for several development boards.  If you wi 

sh 

  to program flash on your own board, you must first create a flash-programming 

  design. 

 

  The process of creating a flash-programming design for your board is mostly 

  automated.  From a bash-shell, execute this script: 

 

        mk_target_board --help 

 

  The help-message includes references to other documentation on programming 

  flash and targeting Nios systems to custom board designs. 

- exiting. 

WARNING: Default charset GBK not supported, using ISO-8859-1 instead[/b] 

--- Quote End ---  

 

 

What&#39;s the problem?
0 Kudos
6 Replies
Altera_Forum
Honored Contributor II
370 Views

Hi armen, 

 

Did you create a flash programmer sof for your custom board? 

It looks like you&#39;re using the development board sof: 

 

<div class='quotetop'>QUOTE </div> 

--- Quote Start ---  

$QUARTUS_ROOTDIR/bin/jre/bin/java.exe -jar $SOPC_KIT_NIOS2/bin/nios2-flash-progr 

ammer.jar --input=.flash --sof=f:/fpga/NIOSII_DEV/NIOSII_DEV_BOARD/system/NIOSII 

_DEV_BOARD.sof --epcs[/b] 

--- Quote End ---  

 

 

--Scott
0 Kudos
Altera_Forum
Honored Contributor II
370 Views

Hi Scott, thanks to you 

 

It&#39;s my own project named NIOSII_DEV, and the custom board named NIOSII_DEV_BOARD. 

I can programme a data file to epcs4 but can not programme it to flash(SST39VF040). 

 

<div class='quotetop'>QUOTE </div> 

--- Quote Start ---  

# Programming flash with the project 

$QUARTUS_ROOTDIR/bin/jre/bin/java.exe -jar $SOPC_KIT_NIOS2/bin/nios2-flash-programmer.jar --input=SST39VF040_70_4I_NH.flash --sof=__NO_SOF_PLEASE__ --base=0x00080000 

Jun 24, 2005 3:53:30 PM - (??) nios2-flash-programmer: SOF-download skipped. 

Jun 24, 2005 3:53:33 PM - (??) nios2-flash-programmer: Error opening target hardware 

Jun 24, 2005 3:53:33 PM - (??) nios2-flash-programmer:    Unable to open flash-device after successfully communicating with target.[/b] 

--- Quote End ---  

 

 

--armen
0 Kudos
Altera_Forum
Honored Contributor II
370 Views

Hi armen, 

 

The reset address is 0 and elf2flash is grabbing the range: 

0000_0000 - 0008_0000 

 

Is your U3 device actually mapped to address 0008_0000? Or is this 

where your sram/sdram starts? 

 

<div class='quotetop'>QUOTE </div> 

--- Quote Start ---  

$QUARTUS_ROOTDIR/bin/jre/bin/java.exe -jar $SOPC_KIT_NIOS2/bin/nios2-flash-progr 

ammer.jar --input=SST39VF040_70_4I_NH.flash --sof=__NO_SOF_PLEASE__ --base=0x000 

80000[/b] 

--- Quote End ---  

 

 

--Scott
0 Kudos
Altera_Forum
Honored Contributor II
370 Views

Hi Scott,  

 

U3(flash: SST39VF040) is actually mapped to address 0008_0000 by the SOPC BUILDER automatically. 

 

In my own project U3 is mapped to address 0000_0000, and in the programmer project U3 is is actually mapped to address 0008_0000, is there any problem? 

Thanks. 

 

 

 

--armen
0 Kudos
Altera_Forum
Honored Contributor II
370 Views

Hi armen, 

 

> In my own project U3 is mapped to address 0000_0000, 

> and in the programmer project U3 is is actually mapped to address 0008_0000, 

> is there any problem? 

 

Yes, I believe this is your problem: 

<div class='quotetop'>QUOTE </div> 

--- Quote Start ---  

$QUARTUS_ROOTDIR/bin/jre/bin/java.exe -jar $SOPC_KIT_NIOS2/bin/elf2flash.jar --f 

lash=U3 --base=0x00000000 --end=0x80000 --reset=0x0 --input=hello_led_0.elf --ou 

tput=SST39VF040_70_4I_NH.flash --boot=$SOPC_KIT_NIOS2/components/altera_nios2/bo 

ot_loader_cfi.srec[/b] 

--- Quote End ---  

 

This will generate an S0 record in your flash file that specifies something like: 

S01A000055333A30313A30303030303030303A3030303830303030A8 

 

Which contains the string " U3:01:00000000:00080000" 

 

So, the programmer wants to program a flash device named U3 that starts 

at 0080_0000, but the flash file is for a device named U3 that starts at 0. 

 

You can use the command line to convert your elf to binary, then convert 

the binary to flash. When you create the flash file you can lie about the base 

address ;-) ... or you can just update your programmer design. 

 

Regards, 

--Scott
0 Kudos
Altera_Forum
Honored Contributor II
370 Views

Hi Scott,  

 

http://forum.niosforum.com/work2/style_emoticons/<#EMO_DIR#>/biggrin.gif Thanks for your help! I&#39;ll try it. 

 

--armen
0 Kudos
Reply