一、qsys添加sram模块
二、nios的bsp配置
三、程序固化
不知道为啥加入sram以后就不能用之前文章里说到的“用mem_init_install做hex,然后再直接把hex编译到sof里、再用sof做jic”这种方式做固件,加了sram以后做出来的hex一直为空。
老员工教了我另外一个方法,步骤如下:
编译逻辑工程生成sof,编译nios,然后调用gen_sof_elf_hex.sh脚本生成sof_elf.hex,再用hex做jic。
脚本内容如下:
sof=".\..\..\qii\output_files\power.sof"
elf="power.elf"
echo "sof>flash ..."; sof2flash --epcs --input=$sof --output=sof.flash --quiet
echo "elf>flash ..."; elf2flash --epcs --after=sof.flash --input=$elf --output=elf.flash
echo "cat flash ..."; cp sof.flash sof_elf.flash; cat elf.flash >> sof_elf.flash
echo "flash>hex ..."; nios2-elf-objcopy --input-target srec --output-target ihex sof_elf.flash sof_elf.hex
echo "del flash ..."; rm -f *.flash
sof和hex做jic方法如下: