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

NIOS II Command Shell

Altera_Forum
Honored Contributor II
1,573 Views

How to program/download .flash file into flash memory using NIOS II 9.0 Command Shell with serial cable?

0 Kudos
4 Replies
Altera_Forum
Honored Contributor II
648 Views

1) In case with the "serial cable", you are refering to a USB-Blaster Cable, than you can use the Nios IDE software to download your software in the flash memory. 

 

2) Some development boards, such as these from TerasIC have a software utility by which you can download whatever file from your PC onto the memories on your board. 

 

3) You can of course also make a small Nios-II processor that takes input from your serial cable via a UART and fills the information in the Flash memory.
0 Kudos
Altera_Forum
Honored Contributor II
648 Views

What is need to type in to IDE command shell to download the flash file to my flash memory. I had tried nios2_flash_programmer, but it says command not found. Is there an example to run like "Hello World"? 

 

[NiosII EDS]? ....... nios2-flash-programmer..... 

 

Can the flash file be download with the use of serial port rather through the USB Blaster cable? 

 

I had tried using flash programmer in the IDE with just the .flash file into flash memory, but it does seem to work. What option should be used for .flash file into flash memory? 

 

It would be helpful if I have the ability to download using Nios II Command Shell and using Nios II IDE methods.
0 Kudos
Altera_Forum
Honored Contributor II
648 Views

This doesn't have the right information? 

 

http://www.altera.com/literature/ug/ug_nios2_flash_programmer.pdf
0 Kudos
Altera_Forum
Honored Contributor II
648 Views

I use the NiosII Command Shell to program my FPGA This happend in 6 steps using the simple script (prog.sh). 

 

The arguments are the .SOF file and .ELF file. 

 

E.g: "sh prog.sh my_top.sof my_software.elf" 

 

Below following the script code: 

(try that matters to you and take care with the values wich i used for base address, sysid, ...) 

 

 

 

 

 

# !/bin/bash 

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

#  

# Gravacao do XXXX na flash do PCI Kit 

#  

#  

 

echo 

echo "------------------------------------------------" 

echo " XXXXXXX" 

echo 

echo " Script para gravacao da logica e software do " 

echo " projeto XXXXXXXXXXXx na flash do PCI Kit " 

echo  

echo " XXXXXX, Built Tue Nov 17 2009" 

echo 

echo "------------------------------------------------" 

 

 

sof_file=$1 

elf_file=$2 

 

echo 

echo 

echo " ARQUIVO SOF: $1" 

echo " ARQUIVO ELF: $2" 

echo 

echo " Gravacao em 6 passos..." 

echo 

echo 

 

echo 

echo " 1# Creating .flash file for the FPGA configuration" 

echo 

"$SOPC_KIT_NIOS2/bin/sof2flash" --epcs --input="$sof_file" --output="NEW_TOP.flash" 

 

echo 

echo "2# Programming flash with the FPGA configuration" 

echo 

"$SOPC_KIT_NIOS2/bin/nios2-flash-programmer" --epcs --base=0x04001000 --cable='USB-Blaster [USB-0]' --sidp=0x04030000 --id=1624645854 --timestamp=1258370507 --accept-bad-sysid --instance=0 "NEW_TOP.flash" 

 

echo 

echo "3# Creating .flash file for the project " 

echo 

"$SOPC_KIT_NIOS2/bin/elf2flash" --epcs --after="NEW_TOP.flash" --input="$elf_file" --output="epcs_flash_controller.flash" 

 

echo 

echo "4# Programming flash with the project" 

echo 

"$SOPC_KIT_NIOS2/bin/nios2-flash-programmer" --epcs --base=0x04001000 --cable='USB-Blaster [USB-0]' --sidp=0x04030000 --id=1624645854 --timestamp=1258370507 --accept-bad-sysid --instance=0 "epcs_flash_controller.flash" 

 

echo 

echo "5# Creating .flash file for the datafile" 

echo 

"$SOPC_KIT_NIOS2/bin/bin2flash" --base=0x04001000 --location=0xFF0000 --input="$elf_file" --output="NEW_SOFTWARE.flash" 

 

echo 

echo "6# Programming flash with the datafile" 

echo 

"$SOPC_KIT_NIOS2/bin/nios2-flash-programmer" --epcs --base=0x04001000 --cable='USB-Blaster [USB-0]' --sidp=0x04030000 --id=1624645854 --timestamp=1258370507 --accept-bad-sysid --instance=0 "NEW_SOFTWARE.flash" 

 

echo 

echo 

echo "=============================" 

echo " FIM DA GRAVACAO!!!" 

echo "verifique se houve erros" 

echo "=============================" 

echo 

echo "Obs: Pressione o botao RECONFIGURE na placa PCI" 

echo " ou desligue/ligue para iniciar o sistema." 

echo 

echo 

 

# the end
0 Kudos
Reply