在nios2 command shell中将nios2-Linux操作系统文件下载到开发板(贾毫杰)
将程序下载到SDRAM中运行
1).打开nios2 command shell
开始->所有程序->altera->NiosII EDS 7.2->NiosII 7.2 Command Shell
2)nios2-configure-sof --cable=USB-Blaster ~/mycpu.sof #配置FPGA芯片,如果是并口则将USB-Blaster
#改为ByteBlasterMV
2)nios2-download --cable=USB-Blaster -g zImage #将zImage文件下载到开发板中
3)nios2-terminal --cable=USB-Blaster #进入开发板终端
将程序擦写到Flash,使开发板上电启动后就开始运行
1).打开nios2 command shell
所有程序->altera->NiosII EDS 7.2->NiosII 7.2 Command Shell
2).将FPGA配置文件(.pof)烧到EPCS中,这一步骤很简单,可参考大多数SOPC教材
3).将zImage文件转化为flash文件,并加入boot代码,用于系统启动后将程序从flash搬运到SDRAM中
elf2flash --base=0x000000 --end =0x7fffff --reset=0x0 --input=zImage --output=ext_flash.flash --
boot=D:/altera2/kits/nios2_60/components/altera_nios2/boot_loader_cfi.srec
4).将3中生成的flash文件擦写到flash中
nios2-flash-programmer --base=0x0 --cable=ByteBlasterMV -g ext_flash.flash
5).擦写完成后,进入开发板终端,可以看到系统已经启动
断电后,再进入开发板可以看到操作系统可以自动运行
下面是英文网站(www.nioswiki.com)上复制过来的资料,分为几种不同的方式实现上电即运行。
1. sof in EPCS, program in CFI
Using DE2_NET v1.5 as example (see TryOutuClinux ), find out and change the sof path, cfi base
and epcs base below.
Open a Linux shell terminal, (or a Nios2 command shell on Windows)
# config the fpga
nios2-configure-sof ~/download/DE2_NET.sof
# change to your uClinux image dir
cd ~/uClinux-dist/images
# Creating .flash file for the FPGA configuration
sof2flash --epcs --input=~/download/DE2_NET.sof --output=standard.flash
# Programming flash with the FPGA configuration
nios2-flash-programmer --epcs --base=0x00680800 standard.flash
# Creating .flash file for the project
elf2flash --base=0x00000000 --end=0x3fffff --reset=0x0 --input=zImage --output=ext_flash.flash -
-boot=$SOPC_KIT_NIOS2/components/altera_nios2/boot_loader_cfi.srec
# Programming flash with the project
nios2-flash-programmer --base=0x00000000 ext_flash.flash
2. sof in CFI, program in CFI
Using Altera Nios Dev board, Cyclone II 2C35 , standard example, find out and change the sof
path, and cfi base below.
# config the fpga
nios2-configure-sof $SOPC_KIT_NIOS2/examples/verilog/niosII_cycloneII_2c35/standard/standard.sof
# change to your uClinux image dir
cd ~/uClinux-dist/images
# Creating .flash file for the FPGA configuration
sof2flash --offset=0xC00000 --
input=$SOPC_KIT_NIOS2/examples/verilog/niosII_cycloneII_2c35/standard/standard.sof --
output=standard.flash
# Programming flash with the FPGA configuration
nios2-flash-programmer --base=0x00000000 standard.flash
# Creating .flash file for the project
elf2flash --base=0x00000000 --end=0xffffff --reset=0x0 --input=zImage --output=ext_flash.flash -
-boot=$SOPC_KIT_NIOS2/components/altera_nios2/boot_loader_cfi.srec
# Programming flash with the project
nios2-flash-programmer --base=0x00000000 ext_flash.flash
3. sof in EPCS, program in EPCS
Using Altera Nios Dev board, Cyclone II 2C35 , standard example, find out and change the sof
path, and epcs base below.
# config the fpga
nios2-configure-sof $SOPC_KIT_NIOS2/examples/verilog/niosII_cycloneII_2c35/standard/standard.sof
# change to your uClinux image dir
cd ~/uClinux-dist/images
# Creating .flash file for the FPGA configuration
sof2flash --epcs --
input=$SOPC_KIT_NIOS2/examples/verilog/niosII_cycloneII_2c35/standard/standard.sof --
output=standard.flash
# Programming flash with the FPGA configuration
nios2-flash-programmer --epcs --base=0x02200000 standard.flash
# Creating .flash file for the project
elf2flash --epcs --after=standard.flash --input=zImage --output=epcs_controller.flash --
boot=$SOPC_KIT_NIOS2/components/altera_nios2/boot_loader_epcs.srec
# Programming flash with the project
nios2-flash-programmer --epcs --base=0x02200000 epcs_controller.flash