Forum Discussion
Altera_Forum
Honored Contributor
16 years ago --- Quote Start --- I have discovered that my program/stack/heap etc. are all stored on the ddr2. How do I know which addresses Nios use in the ddr2? Is it recommended to keep this on a different memory? Thanks for the help so far. --- Quote End --- Solution 1 In order to choose where your program sections (code/stack/etc.) are loaded into ddr2 you must use a custom linker script, but I've never used it with Nios IDE, so I can't tell you how to do it. Solution 2 If you have another memory device, you can move there all program sections: open your system library project properties and you'll find where each section is mapped to, and possibly can move it. Solution 3 (best) Anyway, instead of using IOWR_32DIRECT I'd rather alloc a memory buffer and I'd use it to write data: the linker will automatically adjust addresses and will avoid it overlaps other memory sections. Example: char bigbuffer[BIG_BUFFER_SIZE]; while(bytes_to_process--) { bigbuffer[sdram_addr++] = *(conn->rx_rd_pos)); conn->rx_rd_pos = conn->rx_rd_pos + 1; /* this avoids memory corruption when your memory gets filled */ if (sdram_addr >= BIG_BUFFER_SIZE) sdram_addr = 0; } Hope this will help you Regards Cris