Forum Discussion
Altera_Forum
Honored Contributor
15 years agoIf your application is small enough (probably means you aren't using any altera library functions!) it will run faster from internal memory (use tightly coupled instruction memory) - much like having an instruction cache that is pre-filled with the code.
Similarly use tightly coupled data memory for 'normal' data. However you may well need to write your own linker script, and decide on how the code/data will be downloaded to get it into the correct areas. You also need to link the .rodata into the data, not the code (don't use gcc4 - altera moved switch statement jump tables into .code from .rodata). On our card we use the PCIe slave to load everything, holding the nios in soft reset until the code is present. Writing code to read the elf program headers is fairly simple, or the code/data can be extracted and inserted into the data area of the host program using several objcopy commands (it is even possible to link the host program with the symbol table of the nios one - allowing direct access to data items with a suitable host driver!).