Forum Discussion

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

How to check if the onchip_mem is full?

I'm running AN429 sample code (VIP core) on my 3C120 evaluation board. I add button pio to the SOPC which already have VIP core inside. Quartus can generate ptf ok. However, when I try to build the count_binary sample code, it says memory full. How can I check if the memory is full? Does it mean I have to go to SOPC builder and change each memory address? (I tried the auto addressing but it generated some other errors) Thx

make -s all includes

Compiling count_binary.c...

Linking count_binary_0.elf...

/cygdrive/c/altera/91/nios2eds/bin/nios2-gnutools/H-i686-pc-cygwin/bin/../lib/gcc/nios2-elf/3.4.6/../../../../nios2-elf/bin/ld: region onchip_mem is full (count_binary_0.elf section .text). Region needs to be 17528 bytes larger.

/cygdrive/c/altera/91/nios2eds/bin/nios2-gnutools/H-i686-pc-cygwin/bin/../lib/gcc/nios2-elf/3.4.6/../../../../nios2-elf/bin/ld: section .rodata [00000020 -> 000007db] overlaps section .exceptions [00000020 -> 000001c7]

/cygdrive/c/altera/91/nios2eds/bin/nios2-gnutools/H-i686-pc-cygwin/bin/../lib/gcc/nios2-elf/3.4.6/../../../../nios2-elf/bin/ld: section .rwdata [000007dc -> 0000232f] overlaps section .text [000001c8 -> 0000c477]

/cygdrive/c/altera/91/nios2eds/bin/nios2-gnutools/H-i686-pc-cygwin/bin/../lib/gcc/nios2-elf/3.4.6/../../../../nios2-elf/bin/ld: section .bss [00002330 -> 0000254b] overlaps section .text [000001c8 -> 0000c477]

collect2: ld returned 1 exit status

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

Build completed in 3.015 seconds

9 Replies

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

    binary_counter shouldn't use many memory space, right?...

    My SOPC has 8k on_chip RAM (same as AN 429) already
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Just to be safe try the small_hello_world template that you have in the IDE it is very small.

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

    The errors are most certainly telling you that the onchip memory is full.

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

    Now, I use the standard-built SOPC, it's alright. 'Coz it has external DDR.

    However, is there anyway in IDE that I can check how full the on chip RAM is? Thx
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    All you can do is look at the size of your compiled ELF file. This information is given to you at the end of a successful build. You can also open a nios2 command line console at any time and use the "nios2-elf-size" command on your compiled elf file to see how large it is. This of course does not take stack and heap considerations into account.

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

    Wait, even when I try the hello world, it says it is full???

    I just added the led, button and LCD to the AN429 video sample code.

    It has 32k byte on chip.

    I'm confused. I think the error is not reflecting the real 'coz of the problem.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    It is the problem with the AN429 SOPC, I use it to run the "hello world". Same error. >_<

    But, can anyone tell me what's wrong? It has cpu, on chip memory, and other VIP stuff.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    It's telling you the truth. Hello World with no modifications compiles to about 66K code size. Using the standard C library is heavy. Also, running a hosted application is very heavy. Additionally, having the optimization set to 0 for your BSP and applications turns out large code sizes.

    Conversely, using the "Hello World Small" application results in a program of only 408 bytes in size.

    Read the section entitled "Reducing Code Footprint" beginning on page 6-30 of this document:

    http://www.altera.com/literature/hb/nios2/n2sw_nii52004.pdf

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

    Right, I just made my on_chip mem really big and it runs ok now. Thx.