--- Quote Start ---
If I store the code for Nios II in the serial configuration device, and the Nios II uses on-chip memory as instruction memory. After configuration, the instruction memory is blank, right? So Nios II can do nothing. How can I load the code in the serial configuration device into the on-chip instruction memory? Should I define user logic to do that? Thanks!
--- Quote End ---
the epcs componet in sopc contains a bootloader to copy your code to ram.
add one of these and set the reset vector to the epcs component.
the documentation on this is reasonable.