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++
12612 Discussions

Help with Flash Programmer on custom board

Altera_Forum
Honored Contributor II
1,812 Views

Hi! 

 

I've made a board with cpld and flash as in Cyclone Development Kit, but different is 

cpld EPM3128A only. I ran it on Quartus 4.0 (SP1) and NIOS 1.0 (SP1) and 

it is configuring and working OK. I try to configure it in new version of Quartus 4.2 with SP1 single 

and NIOS 2 1.1, but when I was programming it by Flash Programmer appear errors. 

I've changed a JTAG_UART in custom board design and added a reset_delay block but 

error is the same.  

Maybe someone had this problem before? 

Thanks. 

 

Error: 

# ! /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 C:/altera/qdesigns42/CamelotProject1/software/CamelotProject1/Debug 

# Creating .flash file for the FPGA configuration 

$SOPC_KIT_NIOS2/bin/sof2flash --flash=U5 --offset=0x00700000 --input=C:/altera/q 

designs42/CamelotProject1/CamelotProject1.sof --output=CamelotProject1.flash 

Info: ******************************************************************* 

Info: Running Quartus II Convert_programming_file 

Info: Command: quartus_cpf --no_banner --convert C:/altera/qdesigns42/CamelotPro 

ject1/CamelotProject1.sof CamelotProject1.rbf 

Info: Quartus II Convert_programming_file was successful. 0 errors, 0 warnings 

Info: Processing ended: Thu Mar 24 13:18:37 2005 

Info: Elapsed time: 00:00:00 

# Programming flash with the FPGA configuration 

$SOPC_KIT_NIOS2/bin/nios2-flash-programmer --input=CamelotProject1.flash --sof=$ 

SOPC_KIT_NIOS2/components/Camelot_Custom_Board/system/Camelot_Custom_Board.sof - 

-cable='USB-Blaster [USB-0]' --base=0x00800000 

24.03.2005 13:18:39 - (INFO) nios2-flash-programmer: Launching Quartus Programme 

r to download: 

C:/altera/kits/nios2/components/Camelot_Custom_Board/system/Camelot_Custom_ 

Board.sof 

Send (64) failed. 

Unable to synchronize with target. 

24.03.2005 13:19:19 - (SEVERE) nios2-flash-programmer: Error opening target hard 

ware 

24.03.2005 13:19:19 - (SEVERE) nios2-flash-programmer:  

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. 

# Creating .flash file for the project 

$SOPC_KIT_NIOS2/bin/elf2flash --flash=U5 --base=0x00000000 --end=0x800000 --rese 

t=0x0 --input=CamelotProject1.elf --output=cfi_flash_0.flash --boot=$SOPC_KIT_NI 

OS2/components/altera_nios2/boot_loader_cfi.srec 

# Programming flash with the project 

$SOPC_KIT_NIOS2/bin/nios2-flash-programmer --input=cfi_flash_0.flash --sof=__NO_ 

SOF_PLEASE__ --cable='USB-Blaster [USB-0]' --base=0x00800000 

24.03.2005 13:19:20 - (INFO) nios2-flash-programmer: SOF-download skipped. 

Send (8) failed. 

Unable to synchronize with target. 

24.03.2005 13:19:51 - (SEVERE) nios2-flash-programmer: Error opening target hard 

ware 

24.03.2005 13:19:51 - (SEVERE) nios2-flash-programmer:  

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.
0 Kudos
9 Replies
Altera_Forum
Honored Contributor II
453 Views

 

--- Quote Start ---  

originally posted by camelot@Mar 24 2005, 01:31 PM 

hi! 

 

i've made a board with cpld and flash as in cyclone development kit, but different is 

cpld epm3128a only. i ran it on quartus 4.0 (sp1) and nios 1.0 (sp1) and 

it is configuring and working ok. i try to configure it in new version of quartus 4.2 with sp1 single 

and nios 2 1.1, but when i was programming it by flash programmer appear errors. 

i've changed a jtag_uart in custom board design and added a reset_delay block but 

error is the same.  

maybe someone had this problem before? 

thanks. 

 

error: 

# ! /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 c:/altera/qdesigns42/camelotproject1/software/camelotproject1/debug 

# creating .flash file for the fpga configuration 

$sopc_kit_nios2/bin/sof2flash --flash=u5 --offset=0x00700000 --input=c:/altera/q 

designs42/camelotproject1/camelotproject1.sof --output=camelotproject1.flash 

info: ******************************************************************* 

info: running quartus ii convert_programming_file 

info: command: quartus_cpf --no_banner --convert c:/altera/qdesigns42/camelotpro 

ject1/camelotproject1.sof camelotproject1.rbf 

info: quartus ii convert_programming_file was successful. 0 errors, 0 warnings 

    info: processing ended: thu mar 24 13:18:37 2005 

    info: elapsed time: 00:00:00 

# programming flash with the fpga configuration 

$sopc_kit_nios2/bin/nios2-flash-programmer --input=camelotproject1.flash --sof=$ 

sopc_kit_nios2/components/camelot_custom_board/system/camelot_custom_board.sof - 

-cable='usb-blaster [usb-0]' --base=0x00800000 

24.03.2005 13:18:39 - (info) nios2-flash-programmer: launching quartus programme 

r to download: 

    c:/altera/kits/nios2/components/camelot_custom_board/system/camelot_custom_ 

board.sof 

send (64) failed. 

unable to synchronize with target. 

24.03.2005 13:19:19 - (severe) nios2-flash-programmer: error opening target hard 

ware 

24.03.2005 13:19:19 - (severe) nios2-flash-programmer:     

  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. 

# creating .flash file for the project 

$sopc_kit_nios2/bin/elf2flash --flash=u5 --base=0x00000000 --end=0x800000 --rese 

t=0x0 --input=camelotproject1.elf --output=cfi_flash_0.flash --boot=$sopc_kit_ni 

os2/components/altera_nios2/boot_loader_cfi.srec 

# programming flash with the project 

$sopc_kit_nios2/bin/nios2-flash-programmer --input=cfi_flash_0.flash --sof=__no_ 

sof_please__ --cable='usb-blaster [usb-0]' --base=0x00800000 

24.03.2005 13:19:20 - (info) nios2-flash-programmer: sof-download skipped. 

send (8) failed. 

unable to synchronize with target. 

24.03.2005 13:19:51 - (severe) nios2-flash-programmer: error opening target hard 

ware 

24.03.2005 13:19:51 - (severe) nios2-flash-programmer:     

  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. 

--- Quote End ---  

 

NIOS 1.1 bug?
0 Kudos
Altera_Forum
Honored Contributor II
453 Views

I have also problems with the ide flash programmer and i decided to use  

the NIOS SDK SHELL and shell scripts for programming. 

 

in your example, perhaps there is missing the  

--devive=<device number> part in the call to nios2-flash-programmer 

try to write your own script to program the flash, 

e.g edit 

 

# ################################################################################ script to flash a file 

# FILE TO FLASH 

FLASH_FILE=$1 

# PATH TO FLASH PROGRAMMER BOARD FILE 

BOARD_CONF_FILE=BOARD_1DVI02_EP1C6.sof 

# CABLE 

CABLE="USB-Blaster [USB-0]"# NO OF DEVICE in JTAG_CHAIN 

JTAG_DEVICE=2# BASEADDRESS OF FLASH IN FLASHPROGRAMMERDESIGN (!!! not in APPLICATIONDESIGN) 

FP_BASEFLASH=0x00800000 

# #################### 

 

echo ---------------------------------------------------------------------------- 

echo "PROGRAM FILE : "$FLASH_FILE 

echo "BOARD FILE : "$BOARD_CONF_FILE  

echo "CABLE : "$CABLE  

echo "JTAG-DEVICE : "$JTAG_DEVICE  

echo "FLASHPRG BASE ADD : "$FP_BASEFLASH 

echo ---------------------------------------------------------------------------- 

 

nios2-flash-programmer --input=$FLASH_FILE --sof=$BOARD_CONF_FILE --device=$JTAG_DEVICE --cable=$CABLE --base=$FP_BASEFLASH 

if [ $? != 0 ] 

then 

echo "--- !!! ERROR !!! !!! ERROR !!! !!! ERROR !!! !!! ERROR !!! ---"  

exit 1 

fi 

 

echo "### SUCCESS# ## SUCCESS# ## SUCCESS# ## SUCCESS# ## SUCCESS # ##"  

exit 0
0 Kudos
Altera_Forum
Honored Contributor II
453 Views

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

--- Quote Start ---  

# script to flash a file[/b] 

--- Quote End ---  

 

 

Where is the file? 

 

And the error says 

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

--- Quote Start ---  

Unable to synchronize with target.[/b] 

--- Quote End ---  

 

 

Maybe It is the problem that set the inapposite parameters of the common flash interface. 

Altera says nothing about how to set the parameters. I read the flash datasheet, want to find something about setup/hold/wait time with the Avalon interface, but get nothing. 

 

Can anybody give some index?
0 Kudos
Altera_Forum
Honored Contributor II
453 Views

Hi LiangYi, 

 

the file is given by the command line to the script (Command line parameter $1), 

you have to call this script in the bash shell (NiosII SDK Shell) )with e.g. 

 

"sh flash CamelotProject1.flash"
0 Kudos
Altera_Forum
Honored Contributor II
453 Views

I added a device number and cable in .sh file, but error the same. 

Maybe someone from NIOS developers knows what I should do in this  

situation. 

 

Thx.
0 Kudos
Altera_Forum
Honored Contributor II
453 Views

To Camelot, 

 

First, have you tested your memory with memtest project? If tested successfully, I think it is the problem of your Flash Programming Design. 

 

You should deal with the clk and reset_n pins(in your Flash Programming Design) the same to your real design. 

 

I do this and success.
0 Kudos
Altera_Forum
Honored Contributor II
453 Views

In NIOS 2 1.0 my board works, programmes and configures correctly, from this I think it is bug in new 

release of NIOS 2. My question is what I can do to remove this bug?
0 Kudos
Altera_Forum
Honored Contributor II
453 Views

But I use the latest version, it success. 

 

My SW is Nios II 1.1 Eval + Quartus II 4.2 SP1. 

HW is Microtronix Cyclone Dev Board. 

 

I mean that if Clk Pin in your Flash Programming Design is assigned to the right Pin in your real design and use the same Pll or reset delay circuit.
0 Kudos
Altera_Forum
Honored Contributor II
453 Views

On my 1C20 Development kit it works too. But not in my board.

0 Kudos
Reply