建立SOPC工程后软件编译时报错rwdata is not within region ram解决办法

问题描述:在建立SOPC工程时使用了片上的存储器(on chip memory)作为CPU(NIOS II)的程序和数据存储器,存储器的大小设置为4096,此时硬件编译能通过,在开发软件时,eclipse报错如下:

c:/intelfpga/17.1/nios2eds/bin/gnu/h-x86_64-mingw32/bin/../lib/gcc/nios2-elf/5.3.0/../../../../../H-x86_64-mingw32/nios2-elf/bin/ld.exe: address 0x2080 of run_led3.elf section `.rwdata' is not within region `ram'
c:/intelfpga/17.1/nios2eds/bin/gnu/h-x86_64-mingw32/bin/../lib/gcc/nios2-elf/5.3.0/../../../../../H-x86_64-mingw32/nios2-elf/bin/ld.exe: address 0x236c of run_led3.elf section `.bss' is not within region `ram'
c:/intelfpga/17.1/nios2eds/bin/gnu/h-x86_64-mingw32/bin/../lib/gcc/nios2-elf/5.3.0/../../../../../H-x86_64-mingw32/nios2-elf/bin/ld.exe: address 0x2080 of run_led3.elf section `.rwdata' is not within region `ram'
c:/intelfpga/17.1/nios2eds/bin/gnu/h-x86_64-mingw32/bin/../lib/gcc/nios2-elf/5.3.0/../../../../../H-x86_64-mingw32/nios2-elf/bin/ld.exe: address 0x236c of run_led3.elf section `.bss' is not within region `ram'
collect2.exe: error: ld returned 1 exit status
make: *** [run_led3.elf] Error 1

此时报错的内容应该是指内存不足,可能的解决方法就是:

第一种方法:增加SOPC硬件系统部分RAM的容量,比如增加到32768,具体大小可能要根据软件工程的大小和FPGA的片上内存大小来共同决定。

建立SOPC工程后软件编译时报错rwdata is not within region ram解决办法_第1张图片 修改RAM内存大小

修改内存大小后,由于增加的内存地址可能会占用以前已经分配好的基地址,此时会报错如下:

Error: kernel.nios_II.data_master: ram.s1 cannot be at 0x1000 (0x0 or 0x8000 are acceptable)
Error: kernel.nios_II.data_master: nios_II.debug_mem_slave (0x2800..0x2fff) overlaps ram.s1 (0x1000..0x8fff)
Error: kernel.nios_II.instruction_master: ram.s1 cannot be at 0x1000 (0x0 or 0x8000 are acceptable)
Error: kernel.nios_II.instruction_master: nios_II.debug_mem_slave (0x2800..0x2fff) overlaps ram.s1 (0x1000..0x8fff)

 报错后重新分配基地址(system-assign base addresses)即可。

第二种方法:在硬件系统中添加SDRAM CONTROLLER,将片上的RAM替换为外接的SDRAM存储器。

如果以上两种方法不能解决错误,可以修改eclipse BSP工程中的设置,右键选择BSP工程-选择popertise-选择NIOS II BSP popertise,取消support C++,勾选Reduced device dirvers和small C library,还可以选择优化等级(一般Level 2),设置如下图:

建立SOPC工程后软件编译时报错rwdata is not within region ram解决办法_第2张图片 软件优化设置

 

 

你可能感兴趣的:(FPGA设计)