Currently I'm using a dual NIOS II system on the Cyclone III starter kit. Each processor is using half of the SDRAM (no communication between the two) for instructions/data.The problem is that when starting the processors, only one of the processors (CPU 1) consistently executes to its exit() call. CPU 0, more often than not, doesn't even make it to it's main() call before it stalls/stops. Watching the debug messages, it will stall in various places in the HAL boot sequence. Sometimes even during the middle of transmitting a debug message. For example, for the debug message "Entering alt_main, calling alt_irq_init", it may only get as far as "Entering alt_main, calling" when it stops. Each processor has it's own BSP and they're running identical code. In fact, the code is just symlink'd for the second processor. The design meets timing so I don't think that's the problem. A snapshot of most of the qsys file is attached. I was hoping someone might have some insight into this. I've been stuck on this for a while. Thanks in advance.
I seem to have found the source of the problem which is the enabling of gprof in the BSPs. I disabled gprof support and now everything is working consistently (as far as I can tell).While profiling isn't entirely essential, are there any suggestions as to a fix for this? Without using the "--write-gmon" in the nios2-download command, is there an [automated] way to know when the processor has reached the end? I've modified the nios2-download command to call the gdb-server with the "--wait-target-exit" switch, but the gdb-server process doesn't seem to return even after the main() process has exited. UPDATE: My particular implementation is automated (I test a number of different NIOS 2 architecture configurations with a number of different applications) so the program testing all of these needed to be automated. I figured out how to make nios2-download return when the NIOS 2 application was finished executing. To do this, two things must be done: As above, modify the nios2-download script to include the "--wait-target-exit" switch on the call to nios2-gdb-server. So add the following to line 609 (just above the gdb-server call): arglist="$arglist --wait-target-exit" In your BSP directory, find the setting "hal.make.bsp_cflags_defined_symbols", and change the line <value>none</value> to <value>-dalt_break_on_exit</value> And now nios2-download should return after its finished executing. I have a fairly specific set of requirements but hopefully this is useful to someone!