12-19-2011 01:45 PM
Hi,I´m a newbie in Altera and now I got a problem. I want lo load my source code to control my IP Core. I have a cyclon III DEV Board which has maximum 3888kbits of on chip memory but my code is much bigger. So how can I handle this problem? Thanks for youre advice! Regards
12-19-2011 02:55 PM
Thanks for your advice!But the point is that I already have a DDR2 SDRAM. My problem is now how to tell the core that the main function is not on the on-chip memory but in the SDRAM and also how can I load the Software on the SDRAM and not on the on-Chip memory. My idea was to load a small code on the on-chip mem which has the information that the main code is on the SDRAM. But I don´t know how to do this!
12-19-2011 03:15 PM
Option 1If you want to move a whole memory section to ddr2 or to any another memory, select it in the BSP properties. e.g. : stack in onchip memory, code in ddr2, data in ddr2, ... Option 2 If you want to move a single function to a specific memory, add __attribute__ ((section (".my_memory"))) after the function declaration, where 'my_memory' is the name you assigned to your memory in sopc builder or Qsys. e.g. int function_in_ddr2(int param) __attribute__ ((section (".ddr2_ext_mem"))); Option 3 Use a custom linker scripts and map whatever you want wherever you need.
12-19-2011 04:51 PM
Also, if you want to have code/data into multiple sections, you need to consider how the 'load' process will work.The JTAG loader uses the elf program headers to work out where to write each code/data area - so can load directly into the relevant area. The EPCS loader can only load one big chunk of data - so must load into external memory - code is added to alt_main() to copy the code/data to its correct physical address. The Altera linker scripts assume you are going to use (something like) the EPCS loader. This means they just don't work if you are trying to only use tightly coupled memory. You might also find that a lot of your code size it just bloat caused by using printf() and the malloc/free that happen in order to let you call printf().