Nios II IDE代码优化,quartus ii 11.0版本IDE

  开发Altera Nios II软件可使用Nios II IDE或 Nios II Software BuildTools for Eclipse(即:Nios II SBT for Eclipse),使用“Build All”或“Build Project”编译工程后有时会出现如下错误:
c:/altera/11.0/nios2eds/bin/gnu/h-i686-mingw32/bin/../lib/gcc/nios2-elf/4.1.2/../../../../nios2-elf/bin/ld.exe:xxx.elf section `.text' will not fit in region`onchip_mem'
c:/altera/11.0/nios2eds/bin/gnu/h-i686-mingw32/bin/../lib/gcc/nios2-elf/4.1.2/../../../../nios2-elf/bin/ld.exe:region `onchip_mem' overflowed by nnn bytes
collect2: ld returned 1 exit status
make: *** [xxx.elf]Error 1
  其中:“xxx”是工程名,“nnn”是十进制数字,“.text”表示代码段,有时也可能是“.bss”(未初始化的变量段)、“.rodata”(只读数据区, 一般存放静态全局变量)、“.rwdata”(可读写变量数据区)等。
  上述错误表示程序的代码段太大,FPGA片上内存(Onchip Memory)不够,差“nnn”字节,编译出错。有时即使是一个很简单的“Hello World”程序,如果使用的FPGA片内资源(内存)少,由于编译时要链接系统库(如设备驱动等),也好出现上述错误。

解决方法---针对Quartus ii 11版本IDE

1.右击app工程-》选择properties  

2.点击Nios ii Application properties中的debug level和optimization level修改为图示选项

3.右键BSP工程选择properties,按照如图设置

4.打开BSP Editor,点击setting

5.点击advanced,设置以下选项

6.重新编译工程,一般可解决问题,若还存在错误,请修改RAM大小选项

原文地址:https://www.cnblogs.com/yongleili717/p/11253006.html