nios IIcommand shell 烧录
转载
原文地址:http://www.cnblogs.com/liu_xf/archive/2011/10/23/2221880.html
在nios中,有hardware和software,分别有两个文件,如果固化到系统中,需要进行二次下载。下载hardware还好,直接在quartus programer里操作就行,可是software却要在nios ii IDE里操作,不是很方便。再说了,nios ii download elf的时候经常会出一些问题,不知道是软件bug的原因还是什么,本人在nios ii 10.0下对ep3c16下载elf总是不成功,于是采用了一个新的方法,总算将hw和sw固化成功了。
介绍:
软件版本:10.0
硬件:EP3C16240 M25P64
在nios ii 下用flash programer时,弹出如下提示:
#!/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 D:/vga_board_hdl_code/hello_nios_cy3/software/hello_world_0/Debug # Creating .flash file for the FPGA configuration"$SOPC_KIT_NIOS2/bin/sof2flash" --epcs --input="D:/vga_board_hdl_code/hello_nios_cy3/hello_cy3.sof" --output="hello_cy3.flash" Info: *******************************************************************Info: Running Quartus II Convert_programming_fileInfo: Command: quartus_cpf --no_banner --convert --device=EPCS128 --option=hello_cy3.opt D:/vga_board_hdl_code/hello_nios_cy3/hello_cy3.sof hello_cy3.pofInfo: Quartus II Convert_programming_file was successful. 0 errors, 0 warnings Info: Peak virtual memory: 93 megabytes Info: Processing ended: Sun Oct 23 17:21:45 2011 Info: Elapsed time: 00:00:02 Info: Total CPU time (on all processors): 00:00:02Info: *******************************************************************Info: Running Quartus II Convert_programming_fileInfo: Command: quartus_cpf --no_banner --convert hello_cy3.pof hello_cy3.rpdInfo: Quartus II Convert_programming_file was successful. 0 errors, 0 warnings Info: Peak virtual memory: 91 megabytes Info: Processing ended: Sun Oct 23 17:21:50 2011 Info: Elapsed time: 00:00:04 Info: Total CPU time (on all processors): 00:00:04 # Programming flash with the FPGA configuration"$SOPC_KIT_NIOS2/bin/nios2-flash-programmer" --epcs --base=0x00000000 --sidp=0x00001818 --id=1579616574 --timestamp=1319355357 --instance=0 "hello_cy3.flash"Using cable "USB-Blaster [USB-0]", device 1, instance 0x00Resetting and pausing target processor: OKReading System ID at address 0x00001818: verified : Checksumming existing contents 00000000 : Verifying existing contents 00010000 : Verifying existing contents 00020000 : Verifying existing contents 00030000 : Verifying existing contents 00000000 : Reading existing contents 00010000 : Reading existing contents 00020000 : Reading existing contents 00030000 : Reading existing contents Checksummed/read 61kB in 12.9s 00000000 ( 0%): Erasing Erase failed at offset 0 Leaving target processor paused # Creating .flash file for the project"$SOPC_KIT_NIOS2/bin/elf2flash" --epcs --after="hello_cy3.flash" --input="hello_world_0.elf" --output="epcs_flash_controller.flash" # Programming flash with the project"$SOPC_KIT_NIOS2/bin/nios2-flash-programmer" --epcs --base=0x00000000 --sidp=0x00001818 --id=1579616574 --timestamp=1319355357 --instance=0 "epcs_flash_controller.flash"Using cable "USB-Blaster [USB-0]", device 1, instance 0x00Resetting and pausing target processor: OKReading System ID at address 0x00001818: verified : Checksumming existing contents 00030000 : Verifying existing contents 00030000 : Reading existing contents Checksummed/read 42kB in 4.4s 00030000 ( 0%): Erasing Erased 64kB in 0.0s 00030000 ( 0%): Programming Program failed Leaving target processor paused
有时又没有failed的信息
#!/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 D:/MySoftwares/QuartusII/Mywork/sopc_project/led_test/software/led_test/Debug # Creating .flash file for the FPGA configuration "$SOPC_KIT_NIOS2/bin/sof2flash" --epcs --input="D:/MySoftwares/QuartusII/Mywork/ sopc_project/led_test/led_test.sof" --output="led_test.flash" Info: ******************************************************************* Info: Running Quartus II Convert_programming_file Info: Command: quartus_cpf --no_banner --convert --device=EPCS128 --option=led_t est.opt D:/MySoftwares/QuartusII/Mywork/sopc_project/led_test/led_test.sof led_t est.pof Info: Quartus II Convert_programming_file was successful. 0 errors, 0 warningsInfo: Peak virtual memory: 70 megabytesInfo: Processing ended: Wed Mar 30 12:34:48 2011Info: Elapsed time: 00:00:02Info: Total CPU time (on all processors): 00:00:02 Info: ******************************************************************* Info: Running Quartus II Convert_programming_file Info: Command: quartus_cpf --no_banner --convert led_test.pof led_test.rpd Info: Quartus II Convert_programming_file was successful. 0 errors, 0 warningsInfo: Peak virtual memory: 68 megabytesInfo: Processing ended: Wed Mar 30 12:34:51 2011Info: Elapsed time: 00:00:03Info: Total CPU time (on all processors): 00:00:02 # Programming flash with the FPGA configuration "$SOPC_KIT_NIOS2/bin/nios2-flash-programmer" --epcs --base=0x01001800 --sidp=0x0 1002018 --id=1794073991 --timestamp=1301451768 --instance=0 "led_test.flash" Using cable "USB-Blaster [USB-0]", device 1, instance 0x00 Resetting and pausing target processor: OK Reading System ID at address 0x01002018: verified: Checksumming existing contents 00000000 : Verifying existing contents 00010000 : Verifying existing contents 00020000 : Verifying existing contents 00000000 : Reading existing contents 00010000 : Reading existing contents 00020000 : Reading existing contents Checksummed/read 54kB in 1.4s 00000000 ( 0%): Erasing 00010000 (33%): Erasing 00020000 (66%): Erasing Erased 192kB in 1.9s (101.0kB/s) 00000000 ( 0%): Programming 00010000 (33%): Programming 00020000 (66%): Programming Programmed 139KB +53KB in 3.3s (58.1KB/s) Did not attempt to verify device contents Leaving target processor paused # Creating .flash file for the project "$SOPC_KIT_NIOS2/bin/elf2flash" --epcs --after="led_test.flash" --input="led_tes t.elf" --output="epcs_controller.flash" # Programming flash with the project "$SOPC_KIT_NIOS2/bin/nios2-flash-programmer" --epcs --base=0x01001800 --sidp=0x0 1002018 --id=1794073991 --timestamp=1301451768 --instance=0 "epcs_controller.fla sh" Using cable "USB-Blaster [USB-0]", device 1, instance 0x00 Resetting and pausing target processor: OK Reading System ID at address 0x01002018: verified: Checksumming existing contents 00020000 : Verifying existing contents 00020000 : Reading existing contents Checksummed/read 42kB in 1.1s 00020000 ( 0%): Erasing Erased 64kB in 0.6s (106.6kB/s) 00020000 ( 0%): Programming Programmed 23KB +41KB in 0.7s (91.4KB/s) Did not attempt to verify device contents Leaving target processor paused
但重启电源后,NIOS不运行,甚至连config_done的灯都常亮(hw配制完成后,应该是灭的),看来连前面固化的pof都给冲掉了。
在cyclone和cyclone ii上都是可以的,从来没出过这种问题,现在cyclone iii上却总是不成功,Altera说是9.0软件的bug,在9.0 SP2上面解决了,可我又没有SP2,换成10.0后还是不行;开始怀疑是不是硬件问题,但我用JTAG和AS模式都可以,而且用JTAG 下载JIC也正常,FLASH换成EPCS4也是一样,这说明硬件是没问题的,可能问题在epcs_contoller和nios ii里面。
苦寻数日,终未解决,后以只好另寻它法。
心想,即然JTAG下载JIC到FLASH正常,那么能不能将HW和HS合并成一个JIC呢,答案是肯定的。
1、将HW和SW合成一个JIC文件
需要的文件:sof,elf;
step1:先将硬件映像和软件映像转换成flash文件
打开nios II command shell,输入:
sof2flash --input=hello_cy3.sof --output=hwimage.flash --epcs --verbose elf2flash --input=hello_world_0.elf --output=swimage.flash --epcs --after=hwimage.flash --verbose
step2: 把flash文件转化成hex文件
nios2-elf-objcopy -I srec -O ihex hwimage.flash hwimage.hex nios2-elf-objcopy -I srec -O ihex swimage.flash swimage.hex
step3:打开Quartus® II Convert Programming File 工具,给Flash Loader添加器件类型,然后添加第2步转化出来的hex文件。添加hex文件时,选中“绝对地址”选项。
点击Gererate,即生成了jic文件,再检查生成的 .map 文件有hwimage.hex在起始地址0x0,swimage.hex文件在hwimage.hex结束地址后的起始地址1
hwsw_file.map显示了地址信息
BLOCK START ADDRESS END ADDRESShwimage.hex 0x00000000 0x00030FA5 swimage.hex 0x00030FA6 0x0003131DNote: All the addresses in this file are byte addresses
当然了,也可以只转换swimage,hwimage直接用sof就可以了,不过,这个我没试,这里有说明
http://www.altera.com.cn/support/kdb/solutions/rd10132010_126.html
最后,下载JIC文件,哈哈,NIOS综于跑起来了。
2、将HW和SW合成一个SOF文件
其实在quartus中,也能像Xilinx 的EDK那样将hw和sw合成同一个bitstream。但是SW必须是在片内运行的。
我们知道,NIOS II是不需要自已写bootloader的,NIOS II帮你写好了,但是只能从指定的FLASH Loader,但如果你要从其它的存储器Loader,比如说SD卡,那么就要自已写bootloader了,这样可以将bootloader和sof合成一个文件。
这个方法,无需在SOPC Builder内添加epcs_controller模块;
将CPU的reset地址和vector设置在onchip_mem;
generate之后,无需立即重新编译Quartus 工程。
在Nios II IDE中将system library的的program memary(.text)等,都设为onchip_mem;如下图:
再重新build project。
这个时候Nios II IDE自动创建onchip_memory初始化文件onchip_memory.hex,保存在与SOPC Builder系统文件(.ptf)同一个文件夹下。
然后重新编译Quartus 工程,则自动将onchip_memory.hex内容包含在sof和pof文件中。
然后在 Quartus Programmer中用AS模式下载POF就可以了。再重新上电,发现NIOS 就跑起来了。
结语:
NIOS 出问题后不是很好解决,有些问题很难通过console输出的信息来判定问题所在,再加上编译的时间较长,这也增加了测试的时间。当然咯,有些是软件bug,但也有些是时序问题,比如说你对sopc builder里面做修改后,综合出来的结果会不一样,warring也不一样,例如,我在quartus 10.0里nios在onchip_memory能跑到100M,SDRAM 140M,但改成在sdram里运行后,RUN时,提示verifly错误,NIOS不能运行。改成90M 100M就可以了。所以说,掌握对warring的理解,和新的解决方法也是很不错的,必竟时间是有限的,只要目的达到了,就OK了,你说呢。
nios IIcommand shell 烧录相关推荐
- 编写nios-shell时想到的问题-回车vs换行
在编写nios上类shell用户交互代码时.由于要检測终端输入字符.所以想到了这个问题,故分析之. 回车符的ascii码,ASCII码13 '\r' 换行符的ascii码.ASCII码10 '\n' ...
- FPGA通信第三篇--TCP
FPGA通信第三篇–TCP 1 开发目的 本文针对UDP等通信技术不可靠以及速率低的问题,开发基于NIOS软核的TCP通信技术,以实现稳定可靠的高速数据通信. 2 TCP通信技术开发流程 2.1 简介 ...
- emmc linux.格式化参数,大家都是怎么格式化emmc芯片的?能在ADB SHELL 中操作吗?uboot 就实现了GPT分区和烧录功能...
大家都是怎能格式化emmc芯片的,我用DM3730芯片.用的是2.3.4代码 ,kernel是2.6.37 .系统外部sd启动是可以的,我加入了emmc芯片,我在uboot下分区,在uboot下把E ...
- nios 双核 烧录_FPGA烧写NIOS ii程序至FLASH(epcs)中
硬件平台:黑金开发板 软件平台:quartus 11.0 NIOS II 11.0IDE FPGA芯片:EP4CE6F17C8N 1. 新建工程,bdf文件,这些不做具体说明了,网络资料详 ...
- [NIOS] 如何Erase EPCS flash內容
以下資料是給我自己做個以後查詢使用. ================================================== 手動清除EPCS內的資料步驟: 1. 先開啟 Nios II ...
- 关于怎么将Quartus和Nios程序一起固化到FPGA里面
系统:win8.1 SDK:Quartus II 14.1 FPGA:Cyclone IV 1.将Quartus生成的.pof文件(配置Flash即可自动生成,这里不讨论),与Nios生成的.elf文 ...
- 树莓派(Raspberry Pi 3) - 系统烧录及系统使用
转自:https://blog.csdn.net/u012313335/article/details/53405734 树莓派(Raspberry pi)是一块集成度极高的ARM开发板,不仅包含了H ...
- 玩转mini2440开发板之【编译烧录rootfs根文件系统全过程记录】
前段时间研究了一下如何使用busybox编译和生成最简linux根文件系统(rootfs),并在mini2440开发板上使用NFS网络文件系统进行挂载启动,今天继续研究如何将该根文件系统烧录到开发板上 ...
- 工程师的NIOS II学习笔记(转)
来源:嵌入式在线 作者:山城棒棒儿军 发布时间:2009-09-22 12:29:31 Nios Development Board Reference Manual, Stratix II Edit ...
- nios ii小实验——第一个demo指导书
1.新建工程:打开Quartus II 13.0,点击File->New Project Wizard,点击Next后可以看到如图2所示的对话框,选择工程路径给工程命名(注意:工程名必须和顶层模 ...
最新文章
- 百度云Java三面,面试题及答案!
- WCF分布式开发必备知识(2):.Net Remoting
- 2019 序列号_抖音发布2019年度报告;苹果序列号;熊猫互娱进入破产程序
- 吉林白山:“五脏俱全”的智能WiFi路灯点亮智慧城市
- 使用Chrome开发者工具研究JavaScript里函数的原生实现
- 还有什么芯片没涨?ST、ON、Microchip、Xilinx、东芝开启新一轮涨价潮
- sklearn 机器学习 Pipeline 模板
- 大数据2019年的三大趋势你看了吗?
- 设置maven的阿里云代理
- 赞!图像生成PyTorch库火了,涵盖18+ SOTA GAN实现
- SQL——联接分类和本质
- 多面集的表示定理的必要性的证明
- 华为交换机vlan配置教程
- ONES 冯斌:从工程师到CTO,与不确定性和信息不完备为伴|ONES Talk
- 【FOC控制】英飞凌TC264无刷驱动方案simplefoc移植(1)-霍尔编码器移植
- 程序物语(八):我心戚戚
- 初中计算机ps教程,初中信息技术《Photoshop 初探——基本操作》教学设计
- CentOS/使用RPM管理包
- Java函数的基本知识
- Oracle表空间及数据文件操作