Forum Discussion

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

a problem of building project in nios2 IDE

http://forum.niosforum.com/work2/style_emoticons/<#EMO_DIR#>/huh.gif

hello

i created a project with the example hello_world, but when i builded the project, it generated errors. c-builder description was as follows:

"make -s rebuild

Compiling hello_world.c...

Linking hello_world_6.elf...

/cygdrive/c/altera/kits/nios2/bin/nios2-gnutools/H-i686-pc-cygwin/bin/../lib/gcc-lib/nios2-elf/3.3.3/../../../../nios2-elf/bin/ld: region RAM is full (hello_world_6.elf section .text)

/cygdrive/c/altera/kits/nios2/bin/nios2-gnutools/H-i686-pc-cygwin/bin/../lib/gcc-lib/nios2-elf/3.3.3/../../../../nios2-elf/bin/ld: section .text [00000328 -> 0000b5e7] overlaps section .entry [00002000 -> 0000201f]

/cygdrive/c/altera/kits/nios2/bin/nios2-gnutools/H-i686-pc-cygwin/bin/../lib/gcc-lib/nios2-elf/3.3.3/../../../../nios2-elf/bin/ld: section .rodata [00000020 -> 0000051f] overlaps section .exceptions [00000020 -> 00000327]

/cygdrive/c/altera/kits/nios2/bin/nios2-gnutools/H-i686-pc-cygwin/bin/../lib/gcc-lib/nios2-elf/3.3.3/../../../../nios2-elf/bin/ld: section .rwdata [00000520 -> 00000f9f] overlaps section .text [00000328 -> 0000b5e7]

collect2: ld returned 1 exit status

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

make: *** [rebuild] Error 2

Build completed "

i had tried some way to solve the problem,but didn&#39;t success. The corresponding hardware system is consist of cpu, boot_rom, ram, uart. while i used the example "standard" as the hardware system, it could build the project successfully.

could you help me with this problem, thank you very much!

3 Replies

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

    The answer is there in your error message

    <div class='quotetop'>QUOTE </div>

    --- Quote Start ---

    region RAM is full[/b]

    --- Quote End ---

    Either increase the size of your memory or look at the section on reducing code footprint in the Nios II Software developers handbook.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Hi, I am new to Nios2. I have the same problem when using "small"

    example. When switching to "standard", it can be compiled successfully.

    This was a simple "hello_world" appliation for cyclone 1c20. In the "small"

    example comes with NiosII software, the on-chip-RAM is only 2K.

    However, the error message said it need ~11KB bigger.

    So, as mentioned by Rugbyblock, I change the compiler setting to -o3 and set

    -DALT_USE_SMALL_DRIVERS. It still needs a lot of memory(~9K). So, I have to

    go back to SOPC to change on-chip-RAM length to 16KB. Then it works.

    I am not sure whther it is normal that a "hello_world" program needs ~13KB

    memory. Or I am doing something wrong. If it needs ~13KB RAM, why the

    "small" example from Altera only set RAM size to 2KB?

    Thanks for any help.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Yes, I would say that&#39;s pretty normal. A printf(), which supports floating point, can consume a lot of memory.

    Also, you don&#39;t have to play around with the hello_world example, so much, to see what options you should choose, though it is educational. There are pre-made "Hello World Small" and "Hello LED" that demonstrate the techniques you can use to reduce your code&#39;s footprint.

    Best Regards,

    - slacker