Nios® V/II Embedded Design Suite (EDS)
Support for Embedded Development Tools, Processors (SoCs and Nios® V/II processor), Embedded Development Suites (EDSs), Boot and Configuration, Operating Systems, C and C++
12745 Discussions

howto start debugger with reset ?

Altera_Forum
Honored Contributor II
1,630 Views

I want to start the debugger with resetting the cpu before starting. 

This is to get a defined behavior of the system as it would be  

started with poweron. 

Otherwise each program starts is undefined !!! 

 

 

I checked the command line of nios-gdb-server and found the following switch 

 

-r/--reset-target Always reset the target processor before use 

 

I started a NIOS Shell and isued the command and got the following output: 

 

[SOPC Builder]$ nios2-gdb-server -r 

Using cable "USB-Blaster [USB-0]", device 2, instance 0x00 

Resetting and pausing target processor: OK 

Leaving target processor paused 

 

I saw the cpu stopping and PIO ports get cleared, that means reset really seams to work. 

 

Now I do the following: 

 

1. issue reset in nios shell 

2. start program in nios ide debugger 

3. stop program in nios ide debugger 

new cycle 

1. issue reset in nios shell 

... 

 

can this be done automatic from nios ide ??? 

does this reset really works on all cpu peripherals ??? 

why does ide debugger has no option to reset the cpu before launching debugger ??? 

 

thanks
0 Kudos
5 Replies
Altera_Forum
Honored Contributor II
698 Views

I perfectly understand what you say, I also have the same problem when using mutexes and their default initialization value. 

 

Currently the thing that I do is very similar, I use the Quartus II programmer to reprogram everytime the FPGA before running an application... 

 

It would be really useful to be able to reset the hardware automatically fro inside the Nios II IDE... 

 

bye 

 

Paolo
0 Kudos
Altera_Forum
Honored Contributor II
698 Views

nios2-gdb-server only resets its CPU if it has to because always resetting it will break some multiprocessor systems. 

 

As you've figured out, there is a parameter which can be added to nios2-gdb-server which will force nios2-gdb-server to always reset the CPU. 

 

If you want to integrate this into the IDE then you should hack the shell script nios2-download to set --reset-target if an elf file is provided. Note that the IDE calls nios2-download twice at the moment, once before nios2-terminal and once after. Hacking your shell scripts is of course not supported by Altera.
0 Kudos
Altera_Forum
Honored Contributor II
698 Views

I'am not a shell script expert, 

I changed line 38 in nios2-download 

from "reset_target=no" 

to "reset_target=yes" 

 

when I start the debugger I get the last message (previous messages are cleared from 

console)  

.. 

info threads 

warning: RMT ERROR : failed to get remote thread list 

.. 

then program starts from flash ??? 

 

 

i also tried to add the following command to external tools: 

Location: 

C:\altera\kits\nios2\bin\nios2-gdb-server.exe 

Arguments: 

-r 

 

I can manually run this command by IDE but it says: 

generating markers..., building...,generating markers... 

this works, but it's annoying slow ! 

can the ide simply start an external program,  

without trying to rebuild the whole world ! 

 

can anyone help in hacking the download script, or is there another solution. 

 

thanks
0 Kudos
Altera_Forum
Honored Contributor II
698 Views

 

--- Quote Start ---  

originally posted by fischer@May 18 2005, 05:16 PM 

i can manually run this command by ide but it says: 

generating markers..., building...,generating markers... 

this works, but it's annoying slow ! 

can the ide simply start an external program,  

without trying to rebuild the whole world ! 

--- Quote End ---  

 

 

Try to hack the checkbox in windows/preferences/rundebug/launching/build if required ... the IDE in that way will not check if the projects are updated... 

 

Paolo
0 Kudos
Altera_Forum
Honored Contributor II
698 Views

 

--- Quote Start ---  

originally posted by wombat@May 18 2005, 09:04 AM 

nios2-gdb-server only resets its cpu if it has to because always resetting it will break some multiprocessor systems. 

 

as you've figured out, there is a parameter which can be added to nios2-gdb-server which will force nios2-gdb-server to always reset the cpu. 

 

if you want to integrate this into the ide then you should hack the shell script nios2-download to set --reset-target if an elf file is provided.  note that the ide calls nios2-download twice at the moment, once before nios2-terminal and once after.  hacking your shell scripts is of course not supported by altera. 

--- Quote End ---  

 

thanks for this switch, 

however it would be usefull if ALTERA implements a switch in the debugger 

settings to provide a reset. 

 

<div class='quotetop'>QUOTE </div> 

--- Quote Start ---  

nios2-gdb-server only resets its CPU if it has to because always resetting it will break some multiprocessor systems[/b] 

--- Quote End ---  

 

 

there should be some note in the documents that there is no reset.
0 Kudos
Reply