After installation of OpenOCD
http://blog.csdn.net/iamlvshijie/article/details/7423611
we can test GCB Sever before development.
What is GDB Server?
from wikipedia:
gdbserver is a computer program that makes it possible to remotely debug other programs.[1] Running on the same system as the program to be debugged, it allows the GNU Debugger to connect from another system; that is, only the executable to be debugged needs to be resident on the target system, while the source code and a copy of the binary file to be debugged reside on the developer’s local computer. The connection can be either TCP or a serial line.
Step1: Run OpenOCD GDB Server
run your openocd, telling it you jtag interface and target like this, I write a bat file for windows.
@echo OpenOCD JLink GDBServer
c:
cd cygwin\openocd\tcl
openocd -f interface/jlink.cfg -f target/stm32f1x.cfg
pause
then I check the network connecting:
Step2: IAR Setting
open a IAR Project, then make the projects.
choose project>Options>Debugger
select GDB Server,
then
type localhost, 3333 //attention, there is a comma before 3333
so why is 3333? we check it out.
openocd use the tcp port 3333.
Step3 Debugging
then start debugging: Project>Download> Debug
check it again:
It proves what is GDB server.
Done. It is a little slower than using jlink directly.