OK, here's some instructions (nios II).
I'm looking for the info on the differences btw NI and NII.
Kerri
**
I started with a standard_1s40 design (I used the verilog version, but it doesn't matter).
In SOPC Builder
Open SOPC Builder.
Add (another) Nios II Processor
I chose small, software breakpoints only. choose any variant; doesn't matter.
Rename cpu_0 to "second_cpu".
note that "second_cpu" comes up showing the masters connection columns, and that the masters are not connected to any devices.
Change second_cpu jtag_debug_module base address to "0x00930000".
(by default, it will come up with base address 0x0. this will conflict with ext_flash when we connect the data master to ext_flash).
Add a jtag_uart instance.
Rename "jtag_uart_0" to "second_jtag_uart"
Change jtag_uart_0 base address to 0x00940000.
(not necessary, but sopc builder assigned it a weird base address when i added it).
Connected the second_cpu instruction master to ext_ram_bus,
onchip_ram_64_kbytes, sdram (* connect to some memory device)
Connected the second_cpu data master to ext_ram_bus. onchip_ram_64_kbytes, led_pio, lcd_display, seven_seg_pio, button_pio, second_jtag_uart, and sdram. (i connected to so much stuff because i wanted to run "count_binary" on it.)
Changed the IRQ for button_pio from "NC" to "2" for second_cpu. (needed for count_binary)
Changed the IRQ for second_jtag_uart from "NC" to "5" for second_cpu. (needed for any jtag_uart stuff using HAL)
Kept the IRQ for lan91c111 as "NC" (default). (* connect to some memory device)
I disconnected second_jtag_uart from cpu's data master (remains connected to second_cpu's data master)
Go to More "second_cpu" Settings tab.
Change Reset Address to onchip_ram_64_kbytes.
TRICKY: Change Exception Address Offset to 0x00800020.
You SHOULD change the exception address, because N2IDE will use the exception address as the basis for where to build software for the CPU. if you do not change the exception address, you may inadvertently cause both CPUs to be running the same software, or even worse, writing over the same area with one CPU while another is running in it!
You're finished. Hit the Generate button.
Notes on SOPC Generation
For generation of the cpu that exists in the design, you'll get this warning in the file cpu_gen_log_0.txt:
Warning: currently assigned JTAG instance ID 0 for cpu/jtag_debug_module is shared by second_cpu/jtag_debug_module. Reassigned to 1.
This is perfectly fine, and no cause to worry. It just means that you'll have to recompile any software associated with this cpu. You'd be wise to do so after SOPC generation anyway.
This design took about 7.5 minutes to generate on my system.
In Quartus
1 Compile! This can be done simultaneously with Nios II IDE Compilation, below.
Nios II IDE, Compilation
Open Nios II IDE. I did so by clicking on the "Run Nios II IDE" button in SOPC Builder after system generation was complete.
File -> New -> Project..., Altera Nios II , C/C++ Application, click "Next >"
Select Project Template to Hello World.
Reassign Name: to "cpu_hello_world".
Defaults to correctly selected SOPC Builder System and CPU "cpu", so I didn't have to change it.
Press "Finish" (accept default of making a new system library for this).
File -> New -> Project..., Altera Nios II , C/C++ Application, click "Next >"
Select Project Template to Count Binary.
Reassign Name: to "second_cpu_count_binary".
defaults to correctly selected SOPC Builder System, so I didn't have to change it.
Change "Select Target Hardware CPUa" to second_cpu.
Press "Finish" (accept default of making a new system library for this).
Back in Nios II IDE's main window, press the "Build all" icon. (Because I don't have any other software projects around, this is cool for me, but you might have some other projects sitting around that you don't want to rebuild)
Nios II IDE, Running
TRICKY: go to Window -> Preferences -> Nios II Run and Build Settings. Check the checkbox that says "Allow multiple active run/debug sessions", press "Apply", then "OK".
Highlight "second_cpu_count_binary" in the left-hand pane labelled C/C++ projects. (having this highlighted allows defaults of next steps to come up correctly)
Choose the menu item Run -> Debug... . We want to make a new run/debug configuration, so highlight "Nios II Hardware" and press "New".
The name will default to "second_cpu_count_binary Nios II HW configuration", the project will be correctly set to "second_cpu_count_binary", the Nios II ELF Executable will correctly be set to "Debug/second_cpu_count_binary.elf". there is nothing you need to do on this page.
Press the "Target Connection" tab, which (on my system) has a red X indicating that the values assigned to this tab are not correct.
Choose the JTAG Cable that you are using (i used USB-Blaster). It is allowable to leave the JTAG Device as "automatic". The Nios II Terminal communications device should already be set to "second_jtag_uart".
TRICKY: press the "Debugger" tab. choose a random 4-digit number for "TCP port for Debugger". This will be the port that the tool uses for second_cpu. This number has to be unique in that it does not conflict with whatever TCP port number you give the other cpu "cpu".
This is expected to be an automatic step in Nios II IDE 1.1
Hit the "Debug" button. the program should download. N2IDE shifts to the Debugging perspective, and becomes halted when it hits the breakpoint at "main".
press the "play icon to get the program running. it's not neccessary to have one cpu in any particular state while downloading/debugging the other(s).
Go back to the C/C++ development perspective using the icon or =Window -> Open Perspective -> C/C++ Development=.
Highlight the cpu_hello_world project. (again, having this highlighted merely allows defaults of next steps to come up correctly)
Choose the menu item Run -> Debug... We want to make a new run/debug configuration, so highlight "Nios II Hardware" and press "New".
The name will default to "cpu_hello_World Nios II HW configuration, the project will be correctly set to "cpu_hello_World", the Nios II ELF Executable will correctly be set to "Debug/cpu_hello_World.elf". there is nothing you need to do on this page.
Press the "Target Connection" tab, which (on my system) has a red X indicating that the values assigned to this tab are not correct.
Choose the JTAG Cable that you are using (i used USB-Blaster). It is allowable to leave the JTAG Device as "automatic". The Nios II Terminal communications device should already be set to "jtag_uart".
Press the "Debugger" tab. you may either choose a random 4-digit number for "TCP port for Debugger", or leave the default value of 2342 if you had chosen a different number for second_cpu_count_binary. This will be the port that the tool uses for cpu cpu. This number has to be unique in that it does not conflict with whatever TCP port number you give the other cpus.
Hit the "Debug" button. The program should download. N2IDE shifts to the Debugging perspective, and becomes halted when it hits the breakpoint at "main".
You will note that both programs are running simultaneously on each of their cpus. You may halt/step/view each of the theads individually from here. I don't think there are any other steps to particular to debugging multiple cpus from here...