18:24:51 **** Build of configuration Nios II for project helloworld **** make all Info: Building ../helloworld_bsp/ D:/intelFPGA_lite/17.1/nios2eds/bin/gnu/H-x86_64-mingw32/bin/make --no-print-directory -C ../helloworld_bsp/ [BSP build complete] Info: Compiling helloworld.c to obj/default/helloworld.o nios2-elf-gcc -xc -MP -MMD -c -I../helloworld_bsp//HAL/inc -I../helloworld_bsp/ -I../helloworld_bsp//drivers/inc -pipe -D__hal__ -DALT_NO_INSTRUCTION_EMULATION -DALT_SINGLE_THREADED -O0 -g -Wall -mno-hw-div -mno-hw-mul -mno-hw-mulx -mgpopt=global -o obj/default/helloworld.o helloworld.c Info: Linking helloworld.elf nios2-elf-g++ -T'../helloworld_bsp//linker.x' -msys-crt0='../helloworld_bsp//obj/HAL/src/crt0.o' -msys-lib=hal_bsp -L../helloworld_bsp/ -Wl,-Map=helloworld.map -O0 -g -Wall -mno-hw-div -mno-hw-mul -mno-hw-mulx -mgpopt=global -o helloworld.elf obj/default/helloworld.o -lm -msys-lib=m d:/intelfpga_lite/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 0x10df4 of helloworld.elf section `.bss' is not within region `onchip_memory2_0' d:/intelfpga_lite/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 0x10df4 of helloworld.elf section `.bss' is not within region `onchip_memory2_0' collect2.exe: error: ld returned 1 exit status make: *** [helloworld.elf] Error 1 18:24:53 Build Finished (took 2s.649ms)

 错误是在链接阶段出现的,提示 .bss 段(未初始化的全局/静态变量存放的区域)的地址 0x10df4 不在名为 onchip_memory2_0 的存储器区域内。

 

程序需要的内存空间超过了片上存储器 onchip_memory2_0 的可用大小。链接器尝试将 .bss 段放在该存储器中,但计算出的结束地址(0x10df4)已经超出了该存储器的地址范围。

 

解决办法: 直接打开onchip IP 把ram空间开大一点,比如之前我设置的是32768,现在我设置65536, 问题就解决了。