You can use insight GDB GUI to debug kernel. Insight is the (same) GDB integrated with GUI interface.
You must include JTAG debug module in SOPC Builder. Using level 1 is OK. But level 2 is better, as it supports two hardware data watchpoints. (Placing a hardware data watchpoint as "awatch *(int *)0" is very useful to catch a common NULL pointer dereference bug.)
The debug info (-g) is disabled by default. To enable debug info,
Kernel hacking -->
[*] Kernel debugging
[*] Compile the kernel with debug info
To disable optimization of your driver, add rule like this to your Makefile, eg, driver/net/Makefile,
CFLAGS_atse.o = -O0
You may find more info from linux-2.6/Documentation/kbuild/makefiles.txt
The kernel object file is linux-2.6.x/vmlinux, which is an ELF format object containing debug information. You can not use zImage here, as the debug information is stripped off. You may use the same method to debug u-boot or others. If you want to debug kernel modules or user space programs, you need will more setup than what is described here. The debugging of user space programs will be discussed in another wiki later.
1. You will need USB-blaster and jtagd properly configured. Run "jtagconfig" to verify it is working. You may refer to <a href="/OperatingSystems/UClinux/QuartusforLinux">QuartusforLinux , <a href="/LinuxGdbServer">LinuxGdbServer or alteraforum for related.
2. Configure sof
3. Edit a file, say linux.gdb, containing gdb startup commands. You may add more break points to the codes which you want to debug.
This is optional, but it is handy to use a command file rather than do it by hand.
target remote localhost:2342
4. Edit a short shell script, say debuglinux.sh, to start gdb-server to listen at, say 2342 port, and start insight. Remember to do chmod +x debuglinux.sh . You can also modify nios2-debug to do the same job.