Nios® V/II Embedded Design Suite (EDS)
Support for Embedded Development Tools, Processors (SoCs and Nios® V/II processor), Embedded Development Suites (EDSs), Boot and Configuration, Operating Systems, C and C++
12745 Discussions

Bad memory estimation in Nios II IDE

Altera_Forum
Honored Contributor II
996 Views

Hi, 

 

I have remarked an incoherence between memory size stated in SOPC Builder and Nios II IDE. 

Here is the context : I have a system in SOPC Builder where I use onchip memory to store everything. I set the size of this memory to 65536 bytes, its addresses are from 0x00010000 to 0x0001FFFF, and it is implemented via four M144K memories (checked in Quartus after compilation) which gives well 65536 bytes. 

 

Now In Nios II IDE (9.0 version), I have my program, and when I build the project it gives me the following results : 

 

--- Quote Start ---  

 

Info: (MyProject.elf) 62 KBytes program size (code + initialized data). 

Info: 5784 Bytes free for stack + heap. 

 

--- Quote End ---  

You can remark that the sum of these values is superior to 64 Kio, but I can load my program to the FPGA : 

 

--- Quote Start ---  

Downloading 00010000 ( 0%) 

Downloading 0001E968 (92%) 

Downloaded 57KB in 1.0s (57.0KB/s) 

 

Verifying 00010000 ( 0%) 

Verifying 0001E968 (92%) 

Verified OK  

Leaving target processor paused 

 

--- Quote End ---  

Now, if I add several functions to the program, I have the following after build : 

 

--- Quote Start ---  

 

Info: (MyProject.elf) 65 KBytes program size (code + initialized data). 

Info: 2156 Bytes free for stack + heap. 

 

--- Quote End ---  

We have still a sum superior to 64 Kio, but now the program size alone is superior to this value. And now I cannot load the program anymore : 

 

 

--- Quote Start ---  

 

Downloading 00010000 ( 0%) 

Downloading 0001F794 (93%) 

Downloading 00020000 (96%) 

Downloaded 60KB in 1.0s (60.0KB/s) 

 

Verifying 00010000 ( 0%) 

Verifying 0001F794 (93%) 

Verifying 00020000 (96%) 

Verify failed between address 0x20000 and 0x20793 

Leaving target processor paused 

 

--- Quote End ---  

So, my question is why the Nios II IDE thinks that there is more memory than there is actually ? 

 

I have checked the ptf file generated by SOPC Builder, and there is nothing that can let imagine this (address span of 0x00010000, address bus width of 14 bits) 

 

Thanks in advance 

 

Jérôme
0 Kudos
1 Reply
Altera_Forum
Honored Contributor II
329 Views

Check the sizes (and addresses) of the program segments using 'objdump -p'. That ought to tie up with what is being downloaded. 

The .map file from the linker might also show what is being included. 

 

It might just be the '.bss' section (zero data) that is included in the program size, but not downloaded.
0 Kudos
Reply