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++
Announcements
FPGA community forums and blogs on community.intel.com are migrating to the new Altera Community and are read-only. For urgent support needs during this transition, please visit the FPGA Design Resources page or contact an Altera Authorized Distributor.
12748 Discussions

Why does NIOS write redundant stuff to SDRAM?

Altera_Forum
Honored Contributor II
1,348 Views

Hi, 

 

I have built a system with PCIe-NIOS-SDRAM, with the program being stored in a separate onchip memory. 

I am able to read and write data to SDRAM through PCIe, And also able to read and write from NIOS2, but I observe the following things; 

+ When I use Printf statement in NIOS2IDE, I get the ascii code of printf written to SDRAM! This doesn't make any sense to me, I think its a debug feature, if so I would like to turn it off.  

+ If I don't use printf. still a few unintended bytes are written in the code space of SDRAM. But I don't want to leave any memory locations for program, thats why I have the on chip memory. 

 

Please let me know how to solve the above issues. I can provide more information, please let me know.. 

 

Thanks, 

Ujjwal
0 Kudos
3 Replies
Altera_Forum
Honored Contributor II
645 Views

It sounds like your BSP linker script is not set correctly to only use the onchip memory. Check it in the BSP editor.

0 Kudos
Altera_Forum
Honored Contributor II
645 Views

Hi Ted, 

 

Thanks for your reply.  

 

Please find attached the contents of my linker script. Is it fine? Or should I change my .heap and .stack to onchip memory instead of SDRAM? 

 

Ujjwal
0 Kudos
Altera_Forum
Honored Contributor II
645 Views

The printf code almost certainly uses malloced memory - which is why you are seeing in in SDRAM. 

I would certainly try to get the stack in on-chip memory - and to use tightly coupled on-chip memory so you don't need to allocate resources to a data cache or large i-cache (you still need an i-cache for the boot code and JTAG debug - unless you are loading the code over PCIe). 

 

If you do nee careful placement of code/data in memory blocks. I'd suggest writing your own linker script from scratch - start from the documentation rather than the default script!
0 Kudos
Reply