[Lab 3] Program does not fit in 16k ram

[Lab 3] Program does not fit in 16k ram

by Tanguy Sagi Husseini -
Number of replies: 4

Hello,

When writing a simple program that prints "hello world", the build fails because the resulting program is too big for the 16k of RAM that are given to the CPU:
/home/solene/intelFPGA/intelFPGA_lite/18.1/nios2eds/bin/gnu/H-x86_64-pc-linux-gnu/bin/../lib/gcc/nios2-elf/5.3.0/../../../../../H-x86_64-pc-linux-gnu/nios2-elf/bin/ld: mulpro.elf section `.text' will not fit in region `cpu_0_0_onchip_memory2_0'
/home/solene/intelFPGA/intelFPGA_lite/18.1/nios2eds/bin/gnu/H-x86_64-pc-linux-gnu/bin/../lib/gcc/nios2-elf/5.3.0/../../../../../H-x86_64-pc-linux-gnu/nios2-elf/bin/ld: region `cpu_0_0_onchip_memory2_0' overflowed by 1460 bytes

I tried editing the BSP in the configuration pane and removed the "-g" flag and added "-Os" to, which reduced the overflow from 6k to 1.4k, but it still doesn't fit.Am I doing something wrong? In the last lab I had the same issue with OS/II, and "fixed" it by increasing the amount of available memory, but I assume this is not what was expected.

Also this is about Lab 3 but I could not find the forum for it so i post it here.

Thank you.

In reply to Tanguy Sagi Husseini

Re: [Lab 3] Program does not fit in 16k ram

by Tanguy Sagi Husseini -
Alternatively, maybe we are supposed to put the code in the bigger SDRAM flash then. I will try this.
In reply to Tanguy Sagi Husseini

Re: [Lab 3] Program does not fit in 16k ram

by Tanguy Sagi Husseini -
I seem to have solved the problem by checking the option to use the small C library in the BSP editor, now the program is small enough. I am still interested in knowing if this is what we are supposed to do.
In reply to Tanguy Sagi Husseini

Re: [Lab 3] Program does not fit in 16k ram

by René Beuchat -

Hello, 

Yes it is the best solution to reduce the RAM used. The full library uses 15k only for the print function. But needed for %f printing. 

In this case the SRAM has to be increased. 

In the report after compilation on Quartus, you can see the size of the RAM used and the total available. You can adjust your need. 


In reply to Tanguy Sagi Husseini

Re: [Lab 3] Program does not fit in 16k ram

by René Beuchat -

Yes another alternative, but slower as you need access to the global memory for all accesses, except the one already in the caches.