Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
8 years ago

Compilation Error

Dear All,

I'm trying to build a very basic system on Altera's DE2 board and following the correct procedure as specified by the provided tutorial, but for the last two days, I'm just stuck in this stupid error and I have no idea what is it, I'm making a simple 'Hello World' application using NIOS II processor in which I added on-chip memory and JTAG_UART and nothing else.. Following are the errors I'm getting while I compile the application software on Eclipse IDE;

address 0x7f60 of hello_world.elf section `.rwdata' is not within region `onchip_memory2_0'

address 0x9c88 of hello_world.elf section `.bss' is not within region `onchip_memory2_0'

address 0x9c88 of hello_world.elf section `.onchip_memory2_0' is not within region `onchip_memory2_0'

hello_world.elf section `.text' will not fit in region `onchip_memory2_0'

make: *** [hello_world.elf] Error 1

region `onchip_memory2_0' overflowed by 31880 bytes

Please help me how to get rid of all these mentioned above :-(

8 Replies

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Check in the BSP editor that you have set up the locations of the parts of memory in the appropriate components in your Qsys system (the linker script). You have them set up in onchip_memory2_0, but maybe you've specified a different address location in the Nios parameter editor.

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    --- Quote Start ---

    Check in the BSP editor that you have set up the locations of the parts of memory in the appropriate components in your Qsys system (the linker script). You have them set up in onchip_memory2_0, but maybe you've specified a different address location in the Nios parameter editor.

    --- Quote End ---

    c:/altera/13.0sp1/nios2eds/bin/gnu/h-i686-mingw32/bin/../lib/gcc/nios2-elf/4.1.2/../../../../nios2-elf/bin/ld.exe: hello_world.elf section `.text' will not fit in region `onchip_memory2_0'

    do you understand this line?? I have checked the Nios II BSP editor linker script section and all the memory sections are specified in the onchip_memory2_0

    Can the onchip_memory size be the reason? I have specified 4K as given in the tutorial..
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Like I said, you also need to check the Nios II parameter editor as well to see where you put the start of memory in which Qsys component and if it's at the correct address. Maybe onchip_memory2_0 is not big enough.

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    region `onchip_memory2_0' overflowed by 31880 bytes 

    You've overflowed your on chip memory by 31kB. In other words your program is likely too big for the memory you are trying to store it in.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Okay here is the update.. I just increased the amount of On-Chip memory from 4096 bytes to around 20K bytes and it just solved the problem. But I was really surprised that how can a simple 'Hello Word' program occupies that much memory, may be invisible code behind the scene is the reason :-P anyways then I started facing another issue of program downloading into the FPGA board (NIOS II IDE for Eclipse) which luckily got solved.

    So thank you sstrell and TCWORLD for your kind cooperation.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    was having the same error - resolved it by removing the# include for system.h and adding only required# define for needed variables in the project.

  • jluqueq's avatar
    jluqueq
    Icon for New Contributor rankNew Contributor

    in my case I solved a similar issue by checking small c lib. in BSP properties.