Forum Discussion
Altera_Forum
Honored Contributor
16 years agoI 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