Have your Nios reset to that memory location, and regenerate the system.
Then in the IDE compile the code with the system library targetting the text portion (or rodata if you want it there too) to that onchip memory.
Go back to Quartus and compile your hardware (that onchip memory has a hex file associated to it, and by compiling in the IDE you created the contents for it). I recommend you use the onchip ROM instead of onchip RAM (more memory selection, and you don't have to worry about your memory getting wiped out accidentally by your code).