Forum Discussion
Altera_Forum
Honored Contributor
20 years agoI think the best method is to convert your hex file into a comma-separated string of numbers, save it as a file (say, "my_init_memory.h") and include that in your C source file like this:
static const int my_init_array[] __attribute__ ((section (".my_init_memory"))) = {# include "my_init_memory.h" }; If you do it this way, you have the benefit of going with the flow, and you get your simulation contents files built automatically for you. Perhaps there's a way to augment the normal build makefile to convert your hex file to the .h file each time the build happens (only really an issue if your hex file changes frequently). If you don't care about memory simulation contents, you could overwrite the Nios II IDE's version of my_init_memory.hex with your own after each software build, or just before each Quartus compilation. If none of the ideas posted so far work for you, I'm pretty sure there's a cheesy workaround which would prevent the unwanted commands from going into the makefile in the first place. Let me know if a cheesy workaround sounds interesting http://forum.niosforum.com/work2/style_emoticons/<#EMO_DIR#>/smile.gif